Compiling a Go package

Although you cannot execute a Go package if it does not include a main() function, you are still allowed to compile it and create an object file as follows:

$ go tool compile aPackage.go
$ ls -l aPackage.*
-rw-r--r--@ 1 mtsouk  staff   201 Dec 22 06:06 aPackage.go
-rw-r--r--  1 mtsouk  staff  4677 Dec 22 06:20 aPackage.o

If you successfully compile a Go package that you are developing using the preceding method, you must also make sure that you do not have any syntax errors in your code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.144.170