Node trees

A Go node is a struct with a large number of properties. You will learn more about defining and using Go structures in Chapter 4, The Uses of Composite Types. Everything in a Go program is parsed and analyzed by the modules of the Go compiler according to the grammar of the Go programming language. The final product of this analysis is a tree that is specific to the provided Go code and represents the program in a different way that is suited to the compiler rather than to the developer.

Please note that go tool 6g -W test.go does not work on newer Go versions. You should use go tool compile -W test.go instead.

This section will first use the following Go code, which is saved as nodeTree.go, as an example in order to see the ...

Get Mastering Go - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.