Skip to content

cmd/go: go install fails when given source file path #8424

Closed
@campoy

Description

@campoy
What steps will reproduce the problem?
1. ~/bug.go contains any program compiling successfully (e.g.
http://play.golang.org/p/RQT4BfIN7h)
2. go install ~/bug.go

Reading the documentation of "go install" I expect it to fail because ~/bug.go
is not an import path.

Instead this error message is logged: "go install: no install location for .go
files listed on command line (GOBIN not set)"

In any case there's a documentation in the bug, since there's no mention $GOBIN.

Once the expected behavior clarified I'm happy to try to fix it.

Activity

ianlancetaylor

ianlancetaylor commented on Aug 1, 2014

@ianlancetaylor
Contributor

Comment 1:

Labels changed: added repo-main, release-none.

added this to the Unplanned milestone on Apr 10, 2015
carstn

carstn commented on Sep 14, 2015

@carstn

The same incorrect error message is outputted when you go install some .go file that doesn't contain a main package.

For example, if you run go install mgorus.go on github.com/weekface/mgorus, the compiler complains:
go install: no install location for .go files listed on command line (GOBIN not set).
This doesn't describe the correct problem. The problem is that you can install only main packages, not that GOBIN is not set (echo $GOBIN returns /Users/carstn/Code/go/bin).

current go version and os: go1.5 darwin/amd64

coltin

coltin commented on Nov 12, 2015

@coltin

@carstn is correct, I'm seeing the same thing. I tried to install a library with GOBIN set and I get this error message.

$ go version
go version go1.5.1 darwin/amd64

bcmills

bcmills commented on Jan 23, 2019

@bcmills
Contributor

#23439 is a duplicate of this, but has quite a bit more discussion. Consolidating into that issue.

locked and limited conversation to collaborators on Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bradfitz@rsc@coltin@campoy@ianlancetaylor

        Issue actions

          cmd/go: go install fails when given source file path · Issue #8424 · golang/go