Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Go 1.7rc1 - can't find import: "golang.org/x/net/http2/hpack" #635

Closed
unrolled opened this issue Jul 12, 2016 · 22 comments · Fixed by #640
Closed

Go 1.7rc1 - can't find import: "golang.org/x/net/http2/hpack" #635

unrolled opened this issue Jul 12, 2016 · 22 comments · Fixed by #640
Assignees
Labels

Comments

@unrolled
Copy link

I've added https://github.com/sideshow/apns2 as a vendor to my project, which in turn requires golang.org/x/net/http2. Everything builds properly in Go 1.6.2. I installed Go 1.7rc1 (via brew install go --devel), and now I receive this error frame.go:17: can't find import: "golang.org/x/net/http2/hpack". I've tried updating my vendors and gb, but nothing seems to help.

$ env DEBUG=. gb build

2016/07/12 08:31:25 cmd.go:82: project root "/Users/cory/code/unrolled/ecw/api"
2016/07/12 08:31:25 depfile.go:185: loading depfile at "/Users/cory/code/unrolled/ecw/api/depfile"
2016/07/12 08:31:25 depfile.go:33: no depfile, nothing to do.
2016/07/12 08:31:25 match.go:18: /Users/cory/code/unrolled/ecw/api ..
2016/07/12 08:31:25 match.go:108: matchPackages: ...
2016/07/12 08:31:25 main.go:118: args: [app config cron cron/airindex cron/alerts cron/hourly cron/radar cron/radaroutages cron/weather handlers middleware models stats utilities]
2016/07/12 08:31:26 install.go:70: /Users/cory/code/unrolled/ecw/api/pkg/darwin-amd64/golang.org/x/net/http2.a is missing
2016/07/12 08:31:26 context.go:309: cd /Users/cory/code/unrolled/ecw/api/vendor/src/golang.org/x/net/http2; [/usr/local/Cellar/go/1.7rc1/libexec/pkg/tool/darwin_amd64/compile -p golang.org/x/net/http2 -pack -o /var/folders/z3/3jtkpww516v63hmn5q8xc2s40000gn/T/gb901701484/golang.org/x/net/http2.a -I /var/folders/z3/3jtkpww516v63hmn5q8xc2s40000gn/T/gb901701484 -I /Users/cory/code/unrolled/ecw/api/pkg/darwin-amd64 -complete client_conn_pool.go configure_transport.go errors.go fixed_buffer.go flow.go frame.go go16.go go17.go gotrack.go headermap.go http2.go pipe.go server.go transport.go write.go writesched.go]
# golang.org/x/net/http2
frame.go:17: can't find import: "golang.org/x/net/http2/hpack"
FATAL: command "build" failed: exit status 2
2016/07/12 08:31:26 context.go:288: removing work directory: /var/folders/z3/3jtkpww516v63hmn5q8xc2s40000gn/T/gb901701484

$ gb env

GB_PROJECT_DIR="/Users/cory/code/unrolled/ecw/api"
GB_SRC_PATH="/Users/cory/code/unrolled/ecw/api/src:/Users/cory/code/unrolled/ecw/api/vendor/src"
GB_PKG_DIR="/Users/cory/code/unrolled/ecw/api/pkg/darwin-amd64"
GB_BIN_SUFFIX="-darwin-amd64"
GB_GOROOT="/usr/local/Cellar/go/1.7rc1/libexec"

$ go env

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/cory/gocode"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7rc1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7rc1/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/z3/3jtkpww516v63hmn5q8xc2s40000gn/T/go-build663616406=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
@YvanDaSilva
Copy link

@unrolled This is not related to GB but to Go 1.7rc1 See : golang/go#16333
If you compile the last version it should be "solved" << with a hack if you look at that issue resolution.

@YvanDaSilva
Copy link

YvanDaSilva commented Jul 15, 2016

@davecheney As mentioned on golang/go#16333 (comment)

The new fix for Go 1.7 will in fact trigger a "bug" in GB with "_" not being allowed in the following regex :

if !regexp.MustCompile(`^([A-Za-z0-9-]+)(\.[A-Za-z0-9-]+)+(/[A-Za-z0-9-_.~]+)*$`).MatchString(path) {

@kevinburke
Copy link
Contributor

kevinburke commented Jul 22, 2016

I get this same issue trying to vendor most new libraries.

Steps to reproduce:

  1. Download and compile go1.7rc3. I'm using a Mac, but I am guessing this error can be reproduced on any machine.

  2. Recompile gb using the new go1.7rc3

  3. Create a new GOPATH and src dir - not sure whether this is necessary, but did it to isolate the code.

```bash
mkdir /tmp/new-gopath
pushd /tmp/new-gopath
    mkdir src
    export GOPATH=$(PWD)
popd
```
  1. Run gb vendor fetch github.com/vektra/mockery. This fails with an error; here's the output I get.
```
$ gb vendor fetch github.com/vektra/mockery
fetching recursive dependency github.com/vektra/errors
fetching recursive dependency golang.org/x/tools/go/loader
fetching recursive dependency golang.org/x/tools/go/ast/astutil
fetching recursive dependency golang.org/x/tools/go/buildutil

fetching recursive dependency golang.org/x/tools/imports
fetching recursive dependency golang_org/x/net/http2/hpack
FATAL: command "fetch" failed: "golang_org/x/net/http2/hpack" is not a valid import path
FATAL: command "vendor" failed: exit status 1
```

Here's the state of the manifest and the tree after that's complete: https://gist.github.com/kevinburke/6fbddb351bdfbd902e904bfb4084ebd1

Note also if you try to run it again, gb insists all packages have been downloaded, even though several are missing.

$ gb vendor fetch github.com/vektra/mockery
FATAL: command "fetch" failed: github.com/vektra/mockery is already vendored
FATAL: command "vendor" failed: exit status 1

@kevinburke
Copy link
Contributor

I just tried downloading/compiling gb with Go 1.6.3, then rerunning gb vendor fetch, and still ran into the same problem.

@kevinburke
Copy link
Contributor

FWIW, here's a patch to make version reporting easier: #639

@davecheney
Copy link
Contributor

Thank you for reporting this issue.

The problem is caused by golang/go@4d00937 which renamed $GOROOT/src/vendor/golang.org to golang_org to fix golang/go#16333

The solution is not to change the regex, but to add enough support for vendor/ to gb to be able to pick up the vendored copy of the net/http2 packages from $GOROOT.

@davecheney davecheney added the bug label Jul 23, 2016
@davecheney davecheney self-assigned this Jul 23, 2016
@davecheney
Copy link
Contributor

wrt.

Note also if you try to run it again, gb insists all packages have been downloaded, even though several are missing.

$ gb vendor fetch github.com/vektra/mockery
FATAL: command "fetch" failed: github.com/vektra/mockery is already vendored
FATAL: command "vendor" failed: exit status 1

This is technically correct, vektra/mockery has been written to the manifest file, but it's cold comfort because you'll need to vendor each extra dependency by hand (or remove vektra/mockery) and fetch it again.

davecheney added a commit that referenced this issue Jul 24, 2016
Fixes #635

golang/go#16333 renamed $GOROOT/src/vendor/golang.org to
$GOROOT/src/vendor/golang_org. This solved a nasty problem where code in
GOROOT would shadow any other copy of the net/http2 library, but meant
that gb vendor could no longer resolve the package and try to fetch it
(even if that was pointless).

To solve this, include $GOROOT/src/vendor in the set of search paths so
that golang_org/net/http/... is always found (if present).

I'll add a test for this in the integration test repo.
davecheney added a commit that referenced this issue Jul 24, 2016
#640)

* cmd/gb-vendor: search $GOROOT/src/vendor when resolving recursive deps

Fixes #635

golang/go#16333 renamed $GOROOT/src/vendor/golang.org to
$GOROOT/src/vendor/golang_org. This solved a nasty problem where code in
GOROOT would shadow any other copy of the net/http2 library, but meant
that gb vendor could no longer resolve the package and try to fetch it
(even if that was pointless).

To solve this, include $GOROOT/src/vendor in the set of search paths so
that golang_org/net/http/... is always found (if present).

I'll add a test for this in the integration test repo.

* internal/vendor: handle missing depset roots

$GOROOT/src/vendor does not exist in Go < 1.6
@brendandburns
Copy link

Is there a good way to fix this? I'm still seeing this with go 1.7 and gb from head...

@davecheney
Copy link
Contributor

It should be fixed in tip. If you've upgraded go make sure you rebuild gb.

On 26 Sep. 2016, at 13:47, Brendan Burns [email protected] wrote:

Is there a good way to fix this? I'm still seeing this with go 1.7 and gb from head...


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.

@brendandburns
Copy link

Thanks for the quick reply.

I did a go get github.com/constabulary/gb into a fresh GOPATH so I think I'm ok, but I'll check my path and try again...

@brendandburns
Copy link

Yeah, I'm still seeing this and I believe I'm correctly installed. Is there a way to get gb to kick out the version that it thinks it is running on?

(do I need to re-vendor the dependency?)

@davecheney
Copy link
Contributor

nope, gb doesn't have a version command, sorry, it's a long story.

On Mon, Sep 26, 2016 at 2:03 PM, Brendan Burns [email protected]
wrote:

Yeah, I'm still seeing this and I believe I'm correctly installed. Is
there a way to get gb to kick out the version that it thinks it is
running on?

(do I need to re-vendor the dependency?)


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#635 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAcA0nsr6GvZ8ZxdmuDqO-vg_KCbGtvks5qt0QAgaJpZM4JKes-
.

@davecheney
Copy link
Contributor

The sad story of a version number is #595

The easiest solution would be to remove gb and gb-vendor wherever you find them in you path and do a go get -u -v github.com/constabulary/gb/...

@davecheney davecheney reopened this Sep 26, 2016
@brendandburns
Copy link

ah, I re-built gb but not gb-vendor, perhaps the problem...

@brendandburns
Copy link

(might I suggest at least a --verbose flag that logs the current git commit, precisely for use-cases like this, even if you are far from 1.0)

@davecheney
Copy link
Contributor

I hope that is the problem. It's taking me a while to page back in the
details of that bug

On Mon, 26 Sep 2016, 14:28 Brendan Burns [email protected] wrote:

ah, I re-built gb but not gb-vendor, perhaps the problem...


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
#635 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAcA4AssDcejt6ZtcjS9eME0QuZFhiwks5qt0n9gaJpZM4JKes-
.

@davecheney
Copy link
Contributor

The problem is, how to do that inside the framework of the go tool.

I don't want to go down the route, just yet, of adding makefilea or othrt
wrappers as that will increase the support burden from non unix users.

On Mon, 26 Sep 2016, 14:29 Brendan Burns [email protected] wrote:

(might I suggest at least a --verbose flag that logs the current git
commit, precisely for use-cases like this, even if you are far from 1.0)


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
#635 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAcA4E0ytjbQfZRy-jAZ9PJbNe_lMmrks5qt0o3gaJpZM4JKes-
.

@brendandburns
Copy link

sorry to drag you back into the bug, but I can't seem to get this to work, here's a repro:

git clone https://github.com/metaparticle-io/container-lib.git
cd container-lib/sharder
gb build all

If that works for you, then clearly my dev environment is borked somehow...

@davecheney
Copy link
Contributor

@brendandburns that worked fine for me at tip.

Which version of Go are you using? On the off chance that you are using 1.7rc1 you'll have to move off that version as that broke not just gb, but go packages using external repos

@thomasmodeneis
Copy link

thomasmodeneis commented Oct 12, 2016

Right, I'm facing similar issue but with golang.org/x/net/http2.

../../server.go:50:2: cannot find package "golang.org/x/net/http2" in any of:
        /usr/local/go/src/golang.org/x/net/http2 (from $GOROOT)

and I'm on:
go1.7.1 darwin/amd64
From what I could understand from @davecheney "quote":

The problem is caused by golang/go@4d00937 which renamed $GOROOT/src/vendor/golang.org to golang_org to fix golang/go#16333

and second quote:
On the off chance that you are using 1.7rc1 you'll have to move off that version as that broke not just gb, but go packages using external repos

Sorry but this is a bit confused and gets me a little worried about the actual state of go package management. :|

Sometimes, people like me comes to opened issues, asking about something else that is not exactly what the defect is about, but is related and I appologise for this, however because the problem seems very similar, I understand that the question is pertinent to the topic, so I hope you guys don't mind it.

When I try to go get the golang.org/x/net/http2, I'm running into:

$ go get golang.org/x/net/http2
# cd /opt/gocode/src/golang.org/x/net; git pull --ff-only
From https://go.googlesource.com/net
   cf4effb..6dba816  master     -> origin/master
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

    git pull <remote> <branch>

package golang.org/x/net/http2: exit status 1

Sorry but this error is really unclear, any ideas ?

This is my go env

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/opt/gocode"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  • Update:
    I've managed to work around the issue, and it was pretty much what I had to do other times for 1.4,1.5,1.6,1.7 .... delete all the go packages and start it over go getting one by one.

I feel like there is something broken and people are not being told about it, perhaps we should advise people about this a bit better ?

Thanks and sorry to disturb.

@davecheney
Copy link
Contributor

Right, I'm facing similar issue but with golang.org/x/net/http2.
../../server.go:50:2: cannot find package "golang.org/x/net/http2" in any of:
/usr/local/go/src/golang.org/x/net/http2 (from $GOROOT)
and I'm on:
go1.7.1 darwin/amd64

Is this related to gb, or the go tool. If it's gb can you please open a new issue with the output of running the relevant command with env DEBUG=. set.

From what I could understand from @davecheney "quote":
The problem is caused by golang/go@4d00937 which renamed $GOROOT/src/vendor/golang.org to golang_org to fix golang/go#16333
and second quote:

My comment related to the way the vendor/ support, when used in the standard library shadows any matching package in a users GOPATH. This does not affect gb, gb does not use `GOPATH.

On the off chance that you are using 1.7rc1 you'll have to move off that version as that broke not > just gb, but go packages using external repos

You need to move off 1.7rc1, it is not production quality.

Sorry but this is a bit confused and gets me a little worried about the actual state of go package management. :|

Yes, it's a mess.

Sometimes, people like me comes to opened issues, asking about something else that is not exactly what the defect is about, but is related and I appologise for this, however because the problem seems very similar, I understand that the question is pertinent to the topic, so I hope you guys don't mind it.

Hopefully I've answer your question. If it's related to the go tool, i'm sorry I cannot help you here. If it's related to gb, I recommend opening a new issue.

When I try to go get the golang.org/x/net/http2, I'm running into:

$ go get golang.org/x/net/http2

`; git pull --ff-only

From https://go.googlesource.com/net
cf4effb..6dba816 master -> origin/master
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.

git pull

package golang.org/x/net/http2: exit status 1
Sorry but this error is really unclear, any ideas ?

This looks like the go tool, something has moved your copy of /opt/gocode/src/golang.org/x/net into a disconnected head state. Remove the directory and try again.

Update: I've managed to work around the issue, and it was pretty much what I had to do other times for 1.4,1.5,1.6,1.7 .... delete all the go packages and start it over go getting one by one.
I feel like there is something broken and people are not being told about it, perhaps we should advise people about this a bit better ?

You shouldn't have to do this. This problem looks like a problem with the go tool, not gb, please raise an issue on https://github.com/golang/go.

@davecheney
Copy link
Contributor

I'm going to close this issue for the moment. I'm pretty sure the workaround in place should work.

PLEASE if anyone else has this problem, please raise a new issue so we have a clean chain of debugging information.

I'm going to lock this issue to ensure this happens. Thank you for your understanding.

@constabulary constabulary locked and limited conversation to collaborators Oct 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants