Skip to content

Instantly share code, notes, and snippets.

@moomdate
Created November 24, 2019 03:07
Show Gist options
  • Select an option

  • Save moomdate/ad9661f3aa9c6c68578c8aaca561ba65 to your computer and use it in GitHub Desktop.

Select an option

Save moomdate/ad9661f3aa9c6c68578c8aaca561ba65 to your computer and use it in GitHub Desktop.
without pointer
package main
import "fmt"
type Student struct {
id string
name string
age int
}
func main() {
student1 := make(map[string]Student)
student1["0"] = Student{
id: "B99999",
name: "Surasak ABC",
age: 18,
}
fmt.Printf("%v\r\n", student1)
fmt.Println("name:", student1["0"].name)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment