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.