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' reports GOBIN not set when installing .go source file #28122

Closed
nutmix opened this Issue Oct 10, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@nutmix
Copy link

nutmix commented Oct 10, 2018

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

go version go1.10.2 darwin/amd64

Does this issue reproduce with the latest release?

unknown.

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

GOARCH="amd64"
GOBIN="/Users/xxx/go/bin"
GOCACHE="/Users/xxx/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xxx/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hz/mqzhd2cj5cj48knw7wkywpnh0000gn/T/go-build293557160=/tmp/go-build -gno-record-gcc-switches -fno-common"

Above I have replaced my username with xxx

What did you do?

Very simple. I am trying to do "go install" on github.com/golang-migrate/migrate/migrate.go
My env vars are correctly exported (since years).

What I have trided:
$ cd ~/go/src/github.com/golang-migrate/migrate/
$ go install migrate.go
go install: no install location for .go files listed on command line (GOBIN not set)
$ echo $GOBIN
/Users/xxx/go/bin
$ ls $GOBIN
long list of installed go binaries.
$ echo $GOPATH
/Users/xxx/go
$ export GOBIN=$GOPATH/bin
$ echo $GOBIN
/Users/xxx/go/bin
$ go install migrate.go
go install: no install location for .go files listed on command line (GOBIN not set)

What did you expect to see?

Expected it to install migrate

What did you see instead?

go install: no install location for .go files listed on command line (GOBIN not set)
when GOBIN IS set, exported, exists, and has the correct ownership and permissions.

@bcmills bcmills changed the title go install reports GOBIN not set when GOBIN and GOPATH are correctly set and exported. cmd/go: 'go install' reports GOBIN not set when installing .go source file Oct 10, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Oct 10, 2018

Change https://golang.org/cl/141337 mentions this issue: go/scanner: don't return token.INVALID for ".." sequence

Edit: Was incorrectly referenced because of typo in CL.

@nutmix

This comment has been minimized.

Copy link
Author

nutmix commented Oct 10, 2018

Is there a work around? i.e. a way to install go programs?

@hellozee

This comment has been minimized.

Copy link
Contributor

hellozee commented Oct 19, 2018

go install github.com/golang-migrate/migrate works though, plus they provide a separate Makefile for the development purposes.

@bcmills bcmills added this to the Go1.13 milestone Nov 16, 2018

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Dec 21, 2018

@nutmix I can't reproduce this and I don't know how it ever would have worked.

For the past ~two years, github.com/golang-migrate/migrate/migrate.go has relied upon a type defined in another file within the package:
https://github.com/golang-migrate/migrate/blob/418d41c2a18a96c5ed7f69e350531e450eaaf27d/migrate.go#L60

That means that it cannot be built from command-line file arguments, unless you list all of the non-test .go files, and that does work.

_gopath$ export GO111MODULE=off
_gopath$ go1.12beta1 get github.com/golang-migrate/migrate
_gopath$ cd src/github.com/golang-migrate/migrate/

_gopath/src/github.com/golang-migrate/migrate$ go1.12beta1 install migrate.go
# command-line-arguments
./migrate.go:60:6: undefined: Logger

_gopath/src/github.com/golang-migrate/migrate$ go1.12beta1 install $(ls *.go | grep -v '_test.go')

_gopath/src/github.com/golang-migrate/migrate$ export GOBIN=$GOPATH/bin

_gopath/src/github.com/golang-migrate/migrate$ go1.12beta1 install $(ls *.go | grep -v '_test.go')

_gopath/src/github.com/golang-migrate/migrate$

Please give a concrete list of commands that we can run exactly, starting from an empty GOPATH, to reproduce the problem.

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jan 21, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Jan 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.