dep is missing version info when installed via homebrew

Created on 21 Sep 2017  ·  24Comments  ·  Source: golang/dep

What version of dep are you using (dep version)?


0.3.1

What dep command did you run?

dep version

First, the output of these commands when dep is installed via homebrew:

~ ‹minikube› » dep version
dep:
 version     : devel
 build date  :
 git hash    :
 go version  : go1.9
 go compiler : gc
 platform    : darwin/amd64
~ ‹minikube› » ls -alh /usr/local/bin/dep
lrwxr-xr-x  1 beeradb  admin  27 Sep 20 13:23 /usr/local/bin/dep -> ../Cellar/dep/0.3.1/bin/dep

Now, the output of dep version if I grab it from the releases page:

~ ‹minikube› » ./dep-darwin-amd64 version
dep:
 version     : v0.3.1
 build date  : 2017-09-19
 git hash    : 83789e2
 go version  : go1.9
 go compiler : gc
 platform    : darwin/amd64
bug

Most helpful comment

Is this sufficient?

iMac-TMP:~ joe$ dep version
dep:
 version     : 0.3.2
 build date  : 
 git hash    : 
 go version  : go1.9.2
 go compiler : gc
 platform    : darwin/amd64

and for head builds

iMac-TMP:~ joe$ dep version
dep:
 version     : HEAD-52307d4
 build date  : 
 git hash    : 
 go version  : go1.9.2
 go compiler : gc
 platform    : darwin/amd64

All 24 comments

I got the same, bot from brew install dep and go get -u github.com/golang/dep/cmd/dep

go get -u github.com/golang/dep/cmd/dep is always going to produce a binary that reports its dep version as devel - no way around that. at least, not we make it into the toolchain and can maybe solve that problem for eeeeeveryone 😄

however, it is a problem that homebrew isn't reporting correctly. that one we definitely need to fix. @aleksi, i know you looked at this before - do you think you could have another look? 🙏

Homebrew builds dep with go build: https://github.com/Homebrew/homebrew-core/blob/master/Formula/dep.rb#L21
I will try to change it to use build-all.bash.

@sdboyer build-all.bash should be fixed first to work on macOS. At the moment it fails on date --iso-8601 – no such flag. Please choose your preferred format: https://stackoverflow.com/a/7216394/1856060

After #1201 is merged and next release (0.3.2?) is out, I think I can change Homebrew formula to use git tags and build-all.bash script.

the custom format you picked for dates in #1201 was fine 😄

this'll be fixed when we tag the next release, so closing this out now.

Hi, I'm still seeing this in v0.3.2 included a repro below to show steps.

16:07 $ brew uninstall dep
Uninstalling /usr/local/Cellar/dep/0.3.2... (7 files, 11.3MB) 
16:08 $ dep
-bash: /usr/local/bin/dep: No such file or directory
16:08 $ brew install dep
==> Downloading https://homebrew.bintray.com/bottles/dep-0.3.2.high_sierra.bottle.tar.gz
Already downloaded: /Users/lawrence/Library/Caches/Homebrew/dep-0.3.2.high_sierra.bottle.tar.gz
==> Pouring dep-0.3.2.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/dep/0.3.2: 7 files, 11.3MB
16:08 $ dep
dep is a tool for managing dependencies for Go projects

Usage: dep <command>

Commands:

  init     Initialize a new project with manifest and lock files
  status   Report the status of the project's dependencies
  ensure   Ensure a dependency is safely vendored in the project
  prune    Prune the vendor tree of unused packages
  version  Show the dep version information

Examples:
  dep init                               set up a new project
  dep ensure                             install the project's dependencies
  dep ensure -update                     update the locked versions of all dependencies
  dep ensure -add github.com/pkg/errors  add a dependency to the project

Use "dep help [command]" for more information about a command.
16:08 $ dep version
dep:
 version     : devel
 build date  : 
 git hash    : 
 go version  : go1.9.1
 go compiler : gc
 platform    : darwin/amd64

Just tried to fix that. Unfortunately, homebrew downloads https://github.com/golang/dep/archive/v0.3.2.tar.gz which does not contains .git directory required for build-all.bash.

@sdboyer Can we reopen that issue?

@ilovezfs May you help us there?

We can just pass the -ldflags -X main.version=#{version} and it should be fine.

But that way we will miss git hash. Well, I guess that's better than now. Thank you!

Is this sufficient?

iMac-TMP:~ joe$ dep version
dep:
 version     : 0.3.2
 build date  : 
 git hash    : 
 go version  : go1.9.2
 go compiler : gc
 platform    : darwin/amd64

and for head builds

iMac-TMP:~ joe$ dep version
dep:
 version     : HEAD-52307d4
 build date  : 
 git hash    : 
 go version  : go1.9.2
 go compiler : gc
 platform    : darwin/amd64

Awesome!

Feel free to say "no" and we can do all the fields and make it pretty :)

In my opinion, that's enough. And that's definitely a step forward.

shipped.

Works great, nice work - you guys are quick!

```
~$ brew install dep
==> Downloading https://homebrew.bintray.com/bottles/dep-0.3.2.high_sierra.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/3c/3c11e644294f1202fcddab946d90a72c9eaecda93a1d5c75e18098cf3be7c5f5?__gda__=exp=15

################################################################## 100.0%

==> Pouring dep-0.3.2.high_sierra.bottle.1.tar.gz
🍺 /usr/local/Cellar/dep/0.3.2: 7 files, 11.3MB
~$ dep version
dep:
version : 0.3.2
build date :
git hash :
go version : go1.9.3
go compiler : gc
platform : darwin/amd64
~$```

any changes needed from me here?

Nope. 😄

Hmm, just upgraded (High Sierra) and don't see this. It still says "version: devel"

brew upgrade dep
Error: dep 0.4.1 already installed
rfay@Randy-Air:~$ dep version
dep:
 version     : devel
 build date  :
 git hash    :
 go version  : go1.9.2
 go compiler : gc
 platform    : darwin/amd64
bash-3.2$ brew instal dep
==> Installing dependencies for dep: go
==> Installing dep dependency: go
==> Downloading https://homebrew.bintray.com/bottles/go-1.9.3.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring go-1.9.3.high_sierra.bottle.tar.gz
==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
  https://golang.org/doc/code.html#GOPATH

You may wish to add the GOROOT-based install location to your PATH:
  export PATH=$PATH:/usr/local/opt/go/libexec/bin
==> Summary
🍺  /usr/local/Cellar/go/1.9.3: 7,652 files, 294.0MB
==> Installing dep
==> Downloading https://homebrew.bintray.com/bottles/dep-0.4.1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring dep-0.4.1.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/dep/0.4.1: 7 files, 11.9MB
bash-3.2$ dep version
dep:
 version     : 0.4.1
 build date  : 
 git hash    : 
 go version  : go1.9.3
 go compiler : gc
 platform    : darwin/amd64
bash-3.2$

So there's something wrong with your installation. If you file a ticket in https://github.com/Homebrew/homebrew-core/ and fill out the issue template completely, we can help you figure out what's up.

Silly me. I had a go get version in $GOPATH/bin for testing of the govendor patch. All is well. Sorry.

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

@rfay Thanks for posting that, I was being just as silly but I hadn't thought about checking for the source until I saw your post. Once the source was removed, the install worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wallrj picture wallrj  ·  27Comments

cpapidas picture cpapidas  ·  50Comments

mastoj picture mastoj  ·  29Comments

ankitm123 picture ankitm123  ·  28Comments

sdboyer picture sdboyer  ·  46Comments