Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go install complains that GOBIN is not set when GOBIN is, in fact, set #21115

Closed
NoraCodes opened this issue Jul 21, 2017 · 4 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@NoraCodes
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.3 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/usr/local/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build096398507=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

I ran go install in a Dockerfile. GOBIN is set to /usr/local/bin, as evinced by:

$ docker run --rm -it 8e6d5915607c bash -c "echo \$GOBIN"
/usr/local/bin

What did you expect to see?

I expected go install to put binaries in /usr/local/bin

What did you see instead?

Step 9/11 : RUN go install /go/src/github.com/<censored path>.go &&     go install /go/src/github.com/<censored path>.go
 ---> Running in 78ed3055447b
go install: no install location for .go files listed on command line (GOBIN not set)
The command '/bin/sh -c go install /go/src/github.com/<censored path>.go &&     go install /go/src/github.com/<censored path>.go' returned a non-zero code: 1
@ianlancetaylor ianlancetaylor changed the title go install complains that GOBIN is not set when GOBIN is, in fact, set cmd/go: go install complains that GOBIN is not set when GOBIN is, in fact, set Jul 21, 2017
@ianlancetaylor
Copy link
Contributor

Works for me in a simple test.

Please show us the complete steps to reproduce the problem.

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Jul 21, 2017
@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 21, 2017
@NoraCodes
Copy link
Author

NoraCodes commented Jul 21, 2017

Here's the Dockerfile, again somewhat censored (sorry about that):

FROM golang:1.8
RUN <censored; sets up /etc, doesn't touch anything Go cares about>
VOLUME /backplane
VOLUME /private

ENV GOBIN=/usr/local/bin

COPY docker-entrypoint.sh /
COPY provision-soa-service /usr/local/bin
COPY . /go/src/github.com/<censored>/ship-modules/go/shipmodule-service

RUN go install /go/src/github.com/<censored>/ship-modules/go/shipmodule-service/shipmodule_service.go && \
    go install /go/src/github.com/<censored>/ship-modules/go/shipmodule-service/vendor/github.com/<censored>/scamp-go/bin/scamp.go 
    # uncomment following lines to remove source code from container after build
    # && \
    # rm -rf /go/src/*

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["shipmodule_service", "-config", "<censored>"]

@saljam
Copy link
Contributor

saljam commented Aug 5, 2017

Are all of these packages 'main' packages? go install complains like this if you try to install a non-main package while directly referencing the . go files. See #8424.

Minimal Dockerfile to reproduce this without the censored stuff:

FROM golang:1.8

# s/package hello/package main/ for it to succeed.
RUN echo 'package hello; func main(){println("hello")}' > /hello.go

ENV GOBIN=/usr/local/bin
RUN go install /hello.go

@NoraCodes
Copy link
Author

That does appear to be the root issue. Thanks for identifying it.

@golang golang locked and limited conversation to collaborators Aug 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants