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 gives confusing message if run on a main file in the GOPATH root #5426

Closed
davecheney opened this issue May 7, 2013 · 4 comments
Milestone

Comments

@davecheney
Copy link
Contributor

What steps will reproduce the problem?

% mkdir -p /tmp/gopath/src
% export GOPATH=/tmp/gopath
% cd /tmp/gopath/src
% cat > t.go <<EOF
package main

import "fmt"

func main() { fmt.Println("Hello world") }
EOF
% go install t.go 

What is the expected output? What do you see instead?

expected, /tmp/gopath/bin/t is created

actual,

go install: no install location for directory /tmp/gopath/src outside GOPATH

Please use labels and text to provide additional information.
@cznic
Copy link
Contributor

cznic commented May 8, 2013

Comment 1:

Cannot reproduce:
(11:13) jnml@fsc-r550:~/src$ echo $GOPATH/src
/home/jnml/src
(11:13) jnml@fsc-r550:~/src$ pwd
/home/jnml/src
(11:13) jnml@fsc-r550:~/src$ cat > t.go <<EOF
> package main
> 
> import "fmt"
> 
> func main() { fmt.Println("Hello world") }
> EOF
(11:13) jnml@fsc-r550:~/src$ go install t.go 
(11:13) jnml@fsc-r550:~/src$ go clean
(11:14) jnml@fsc-r550:~/src$ go install -x t.go 
WORK=/tmp/go-build082759108
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/command-line-arguments/_obj/exe/
cd /home/jnml/src
/home/jnml/go/pkg/tool/linux_amd64/6g -o $WORK/command-line-arguments/_obj/_go_.6 -p
command-line-arguments -complete -D _/home/jnml/src -I $WORK ./t.go
/home/jnml/go/pkg/tool/linux_amd64/pack grcP $WORK $WORK/command-line-arguments.a
$WORK/command-line-arguments/_obj/_go_.6
cd .
/home/jnml/go/pkg/tool/linux_amd64/6l -o $WORK/command-line-arguments/_obj/exe/a.out -L
$WORK $WORK/command-line-arguments.a
mkdir -p /home/jnml/bin/
cp $WORK/command-line-arguments/_obj/exe/a.out /home/jnml/bin/t
(11:14) jnml@fsc-r550:~/src$ go version
go version go1.1rc2 linux/amd64
(11:14) jnml@fsc-r550:~/src$

@minux
Copy link
Member

minux commented May 8, 2013

Comment 2:

i can reproduce it using exactly dave's commands.
it's a corner case so perhaps we don't need to specially handle it
in the code, and instead just revise the error message to something
like:
go install: no install location for directory /tmp/gopath/src (not within GOPATH/src)

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 3:

Labels changed: added go1.2.

@rsc
Copy link
Contributor

rsc commented Sep 10, 2013

Comment 4:

This issue was closed by revision 159c2b7.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants