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

Consistent way to reference Gopkg.toml in CLI #558

Closed nbosscher closed 6 years ago

nbosscher commented 6 years ago

This is more of a request for discussion rather than an issue. I find the dep sub-commands to be quite inconsistent in behaviour with each other and with the go compiler. Here's my suggestion, I'm sure there are holes in it, but I just want to start a discussion.

Proposed behavior

$ cd MyProject
$ mkdir -p ./src/my-package
$ export GOPATH=`pwd`

# write some code...

# initializes dep in my-package, .toml and .lock reside in ./src/my-package
# location based on "$GOPATH/src/$PKG/Gopkg.toml"
$ dep init my-package

# ensures deps in my-package (assumes ./src/my-package/Gopkg.toml, .lock)
$ dep ensure my-package

# updates deps in my-package (assumes ./src/my-package/Gopkg.toml, .lock)
$ dep ensure my-package -update

# prune deps in my-package (assumes ./src/my-package/Gopkg.toml, .lock)
$ dep prune my-package

# same as current cd ./src/my-package; dep status package-list...
$ dep status my-package -pkg=[packages list...]

godep version output

dep:
 version     : devel
 build date  : 
 git hash    : 
 go version  : go1.9.1
 go compiler : gc
 platform    : darwin/amd64

go version output

go version go1.9.2 darwin/amd64
nbosscher commented 6 years ago

Sorry, wrong repo