You can create instances of a struct in Go using the type and struct keywords. Here's an example of a struct with a field and how to create an instance of it:
main.go241 chars14 linesIn this example, we declare a Person struct with a Name field of type string. We then create an instance of the struct p using literal syntax and assign "Bob" to the Name field. After that, we access the Name field of the struct by calling p.Name and print "Bob" to the console using fmt.Println().
gistlibby LogSnag