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

go/types: gotype requires installed packages #14918

Closed
the42 opened this issue Mar 22, 2016 · 5 comments
Closed

go/types: gotype requires installed packages #14918

the42 opened this issue Mar 22, 2016 · 5 comments

Comments

@the42
Copy link

the42 commented Mar 22, 2016

go1.6 gotype seems to be unaware of vendoring

  1. What version of Go are you using (go version)?
    1.6
  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/john/src/gocode"
    GORACE=""
    GOROOT="/home/john/opt/go"
    GOTOOLDIR="/home/john/opt/go/pkg/tool/linux_amd64"
    GO15VENDOREXPERIMENT="1"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
    CXX="g++"
    CGO_ENABLED="1"
  3. What did you do?
    john@ebola:~/src/gocode/src/github.com/the42/bevaddress$ gotype bevaddress.go

The tree is
john@ebola:~/src/gocode/src/github.com/the42/bevaddress$ tree -d
.
├── Godeps
└── vendor
└── github.com
├── gorilla
│   └── websocket
└── lib
└── pq
└── oid

8 directories

  1. What did you expect to see?
    no error (go build works)
  2. What did you see instead?
    bevaddress.go:9:2: could not import github.com/gorilla/websocket (can't find import: github.com/the42/bevaddress/vendor/github.com/gorilla/websocket)
    bevaddress.go:10:4: could not import github.com/lib/pq (can't find import: github.com/the42/bevaddress/vendor/github.com/lib/pq)
    bevaddress.go:18:16: undeclared name: websocket
@the42 the42 changed the title go/src/go/types/gotype: go/src/go/types/gotype can't find vendored packages Mar 22, 2016
@griesemer griesemer self-assigned this Mar 22, 2016
@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Mar 22, 2016
@bcomnes
Copy link

bcomnes commented Mar 27, 2016

@the42 It was recommended to me to run go install or go build -i after vending code or running for the first time. This builds out the vendor code into $GOPATH/pkg/{packagePath}/vendor/... and then gotype stops complaining. I guess its similar to an npm i step.

@ianlancetaylor ianlancetaylor changed the title go/src/go/types/gotype can't find vendored packages go/types: gotype can't find vendored packages Mar 27, 2016
@the42
Copy link
Author

the42 commented Mar 28, 2016

@bcomnes what remains is whether your recommendation is the way it should be or if it's a bug. I think it's a bug.

@griesemer
Copy link
Contributor

Related to #11415. gotype is simply an app that invokes go/types. go/types doesn't build dependencies, it simply type-checks on package and relies on compiled versions of imported packages. If those don't exist (are not installed), go/types cannot find them.

Eventually, go/importer needs to support importing from source.

@bcomnes
Copy link

bcomnes commented Mar 28, 2016

@the42 ¯\_(ツ)_/¯
@griesemer Thanks for the background. 👍

@rsc rsc changed the title go/types: gotype can't find vendored packages go/types: gotype requires installed packages May 18, 2016
@rsc rsc modified the milestones: Go1.8, Go1.7 May 18, 2016
klauern added a commit to klauern/trackello that referenced this issue Jul 18, 2016
Most of the fixes are simple things like gotype and golint, but one that
I am having some trouble with is `gotype`.  I think there are some
issues with the way that `gotype` works, and there's an issue
outstanding to cover this:

golang/go#14918
klauern added a commit to klauern/trackello that referenced this issue Jul 19, 2016
commit 7e84b5e
Author: Nick Klauer <klauer@gmail.com>
Date:   Tue Jul 19 14:23:17 2016 -0500

    print non-zero action lists

    Only print out lists with actions associated with them.  This includes adding a statistics check

commit ddd3113
Author: Nick Klauer <klauer@gmail.com>
Date:   Tue Jul 19 13:51:01 2016 -0500

    fix list printing

    I had not properly copied the trello.Card over, so it was reusing the pointer to the same item, which resulted in a ton of duplicate cards.  By making it copy that to the function parameter, it was a new item each time.

commit e100bf8
Author: Nick Klauer <klauer@gmail.com>
Date:   Tue Jul 19 13:36:27 2016 -0500

    fix sorting to be case-insensitive on list name

commit 332f778
Author: Nick Klauer <klauer@gmail.com>
Date:   Tue Jul 19 13:33:12 2016 -0500

    add sorting for board lists.

commit 84b6f46
Author: Nick Klauer <klauer@gmail.com>
Date:   Tue Jul 19 13:32:55 2016 -0500

    minor documentation

    minor documentation addition

commit ce21ed5
Author: Nick Klauer <klauer@gmail.com>
Date:   Mon Jul 18 07:50:36 2016 -0500

    update remote fork to use https instead of git protocol

    this is because the proxy at work prevents access to any git:// url.

commit b77e679
Author: Nick Klauer <klauer@gmail.com>
Date:   Sun Jul 17 19:48:11 2016 -0500

    update glide.lock dependencies

commit 7614d9c
Author: Nick Klauer <klauer@gmail.com>
Date:   Sun Jul 17 19:41:59 2016 -0500

    fix gometalinter warnings and errors

    Most of the fixes are simple things like gotype and golint, but one that
    I am having some trouble with is `gotype`.  I think there are some
    issues with the way that `gotype` works, and there's an issue
    outstanding to cover this:

    golang/go#14918

commit 34dea51
Author: Nick Klauer <klauer@gmail.com>
Date:   Sun Jul 17 12:43:05 2016 -0500

    change remote to forked version of go-trello

    I have enough changes to submit to go-trello that I'm creating separate branches and forking the project.

commit 2478da3
Author: Nick Klauer <klauer@gmail.com>
Date:   Sat Jul 16 20:59:16 2016 -0500

    start branch for parallelizing HTTP requests

    this is a bigger change and requires a lot of mutexes and things I'm not really comfortable with in Golang, so we'll start a new branch and just integrate it in later once things work.
@griesemer
Copy link
Contributor

I'm going to close this as duplicate of #11415, and in turn mark that one for Go1.8.

@golang golang locked and limited conversation to collaborators Oct 5, 2017
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

7 participants