Closed
Description
The documentation of go build
says:
The -o flag forces build to write the resulting executable or object
to the named output file or directory, instead of the default behavior described
in the last two paragraphs. If the named output is a directory that exists,
then any resulting executables will be written to that directory.
However an object is generated only if the -o
flag specifies a file.
To make things more confusing, when I have a non main package in the project root and a main package in a sub-directory, go build -o file ./...
reports:
go build: cannot write multiple packages to non-directory file