I'm running into a bizarre problem at work.
I have a project. In this project are two packages, each in its own folder. Each folder contains various .go
files that are part of that package.
In folder A, if I say go build -v
, I get a list of the stuff it's building.
In folder B, if I say go build -v
, I get an immediate return with no output.
Both folders contain nothing but .go
files, and there is no easily-identifiable reason why it is building the code in the one and building nothing in the other.
go version
returns go version go1.7.5 linux/amd64
How in the world do I figure out what's going on here?
EDIT: To clarify issues brought up in comments:
There is no package main
in either folder. In the folder A, go install
produces a .a
file in the appropriate place under $GOPATH/pkg
. In folder B, go install
does not. It is doing nothing, and failing silently. Something is legitimately going wrong here.
Suggested remedies from comments include using the -a
flag (errors out on something that appears to be completely unrelated) and using the -x
flag. The -x
flag, which supposedly should give extremely verbose output, instead is useless, outputting single lines referring to temp files that do not exist once the build terminates, such as WORK=/tmp/go-build026498757
.
It's likely that you already have an up-to-date build installed in your gopath. This might mean that you did something like ran go install
on that particular package previously and have yet to modify any of the files in the directory.
Check Go's pkg
directory for the corresponding *.a
library and see if the modification timestamp on it is later than the timestamps on your source files.