I have just managed to get Golang to use local packages.
Go takes the approach that all packages are to be considered to be remote even if they are not.
This means that you need to define your projects package location in
go.mod as if it were installed from the remote repository that you will deploy it to. You can then import the local module as if it were from that location but it will resolve to a local copy.
You can then import
./mymodule folder in your project. All go files in that folder will be imported.
The practical advantage is that you can use the same sample code if the library is local or remote without needing a distinct bundling tool.
go test command is also odd. It by default only runs the tests in the current folder.
You need to use
go test. ./... to get all the tests to run (which will be all files named
*_test.go in the filesystem.
This is not very intuitive.