tools / godep

dependency tool for go
http://godoc.org/github.com/tools/godep
BSD 3-Clause "New" or "Revised" License
5.55k stars 455 forks source link

godep cannot work with the new alias functionality #521

Closed dlsniper closed 7 years ago

dlsniper commented 7 years ago

Steps to reproduce behavior

Pull in the latest x/net/context package and save it in a project it works with.

florin@laptop [06:07:22 PM] [~/golang/src/github.com/gopheracademy/gopher] [master]
-> % godep save ./...
godep: /home/florin/golang/src/github.com/gopheracademy/gopher/vendor/golang.org/x/net/context/go18.go:17:14: expected type, found '=' (and 1 more errors)

godep version output

godep v74 (linux/amd64/go1.7beta2)

go version output

go version go1.7.3 linux/amd64
freeformz commented 7 years ago

This is because godep was compiled with the go/ast package from go1.7, which doesn't support aliases.

Some ways to "solve" this:

  1. Write my own parser for build tags and import statements (that's really the only reason godep parses files at all).
  2. recompiling godep with go tip should work around the issue.
  3. Other?
NeoCN commented 7 years ago

we come across the same issue.

dlsniper commented 7 years ago

I guess we can close this for now as Alias have been postponed for 1.9

freeformz commented 7 years ago

Yay

calebhearth commented 7 years ago

I'm still seeing this, @freeformz. I was on 1.7.4 and updated to the beta thinking this might be related.

godep save ./...
godep: WARNING: Godep workspaces (./Godeps/_workspace) are deprecated and support for them will be removed when go1.8 is released.
godep: Godeps/_workspace/src/golang.org/x/net/context/go18.go:17:14: expected type, found '=' (and 1 more errors)
$ go version
go version go1.8beta1 darwin/amd64
$ godep version
godep: WARNING: Godep workspaces (./Godeps/_workspace) are deprecated and support for them will be removed when go1.8 is released.
godep v75 (darwin/amd64/go1.8beta1)
lucasmrod commented 6 years ago

Came across this issue with go1.9 (with now official support for type alias) FYI: Fixed by recompiling godep with go1.9.