My project structure is like this.
packagetest/
main.go
lib.go
In main.go, I have this code.
package m
On the golang.org webpage you can read about the build command that:
If the arguments are a list of .go files, build treats them as a list of source files specifying a single package.
So, go build main.go will treat main.go as a single package. Instead, you should use:
go build
to include all files in the folder.