Original post


I don’t understand what this code does… it was in the GolangUK Conference ’17

What I’ve understood:
The constant “GOPHER” string is fed into the gogopher, which is an instance of Gopher()…

What does the &Gopher{Gopher : “gopher”} do?
What is the purpose of json:"gopher" string?

Any insight is much appreciated/

Take a look at https://tour.golang.org/methods/6.

See https://gobyexample.com/json

Thank you!
One more follow up:
Can I call the file containing parser.ParseFile on itself?

You call ParseFile on a filename. This can of course be the filename of the .go source of the current program.