0

Issue is similar to the one described here but the answer did not help me.

I use Go 1.4 built from source. I have issued $ go install -x -a to force the rebuild of all packages (although I only made a change to a single go file). The project is well structured and contains a command in a file named main.go with package main and func main() I am running out of ideas but gained a better understanding of the build process...

$ go env
GOARCH="386"
GOBIN=""
GOCHAR="8"
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jdevoo/Downloads/go"
GORACE=""
GOROOT="/home/jdevoo/go"
GOTOOLDIR="/home/jdevoo/go/pkg/tool/linux_386"
CC="gcc"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

Any ideas?

Community
  • 1
  • 1
jdevoo
  • 46
  • 2
  • 5
  • What about go build then go install (no parameter)? Would you see your program compiled in `/home/jdevoo/Downloads/go/bin`? Where is your main.go? Directly under `/home/jdevoo/Downloads/go/src`? – VonC Jan 11 '15 at 14:59
  • tried - no change. The file main.go is under `github.com/eris-ltd/decerver/cmd/decerver` - I see install generating the archives but not run the last linker step – jdevoo Jan 11 '15 at 15:05
  • Where is your `main.go`? Directly under `/home/jdevoo/Downloads/go/src`? – VonC Jan 11 '15 at 15:07
  • my $GOPATH does not include multiple entries and I tried with a simple hello program which worked well and produced hello binary – jdevoo Jan 11 '15 at 15:09
  • Can you try and move your main.go under a subfolder within `/home/jdevoo/Downloads/go/src`? Or did you mean that your `GOPATH` hasn't even a `src` in it? – VonC Jan 11 '15 at 15:10

1 Answers1

0

It really depends on where exactly is your main.go.

It should be in $GOPATH/src/yourProject/main.go, for a go install to generate a $GOPATH/bin/yourProject.
That is what "Your first program" describes.

$GOPATH is your workspace, and should always include src, pkg and bin.

To get a binary specifically for that command:

cd $GOPATH/src/github.com/eris-ltd/decerver/cmd/decerver/
go get
# or
go install

Note the -x option is supposed to "print the command" only.
-a would force rebuilding.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • roger that. Workspace contains the 3 folders. The application was installed using `go get github.com/eris-ltd/decerver` followed by `cd $GOPATH/src/github.com/eris-ltd/decerver/cmd/decerver/` then `go get -d .` and `go install` - this worked and had produced the original binary. All I tried to do is modify one file and re-generate the executable. That's why I am stuck - not sure what is wrong... super weird – jdevoo Jan 11 '15 at 15:19
  • what else can prevent the linker from kicking in? Go is leaving me with the archive files... that's it – jdevoo Jan 11 '15 at 15:20
  • Maybe that modified go file isn't used by main.go, and the build process doesn't rebuild the `decerver` command as a result? – VonC Jan 11 '15 at 15:38
  • OK - I managed to get a new binary by accident. I issued `go get -x` from the directory containing main.go – jdevoo Jan 11 '15 at 15:55