Closed kjk closed 7 years ago
Ugh, cases like these should've been resolved with #696.
go get ./...
can't have helped, because only dep init
touches GOPATH. With only a single, narrow, not-relevant-here exception, dep ensure
does not know or care that GOPATH exists. That is:
I assume that's because dep only checked a local version of
github.com/golang/crypto
in$GOPATH
, which was not up-to-date, but didn't check the remote.
This kind of check doesn't happen in dep ensure
- the repository it was reading from was at $GOPATH/pkg/dep/sources/https---go.googlesource.com-crypto
.
You're 💯 certain you didn't have an older version of dep
somehow, when you originally encountered this error?
My bad, you're right. I checked the history of commands and this is probably outdated dep.
Which brings a separate issue: it should be go get -u github.com/golang/dep
to install dep, not go get -u github.com/golang/dep/cmd/dep
I have an alias updatedep="go get -u github.com/golang/dep/cmd/dep"
in my . bash_profile
because I want to be on the latest version.
For quite a while I had the incorrect go get -u github.com/golang/dep
(because who's reading docs, really), so I wasn't actually updating dep.
In this particular case I did ran updatedep
alias (so I thought I was running the latest version) but it was in a stale shell session that had the old, incorrect alias.
I know that the right command is in the readme but I'm pretty sure other people make the same assumption as I do.
I feel cmd/*
pattern is really meant for packages that are mostly libraries that come with helper programs under cmd/.
Packages that are a single program (like dep) should have the program at the top level and have their libraries under pkg/ or some such.
This is on latest mac, using latest dep 6b75d6b4c7f4b29fa3a125369da18ee0d48175eb
Here's what happened:
Notice that https://github.com/golang/crypto/commit/e1a4589e7d3ea14a3352255d04b6f1a418845e5e does exist.
I fixed it by doing:
After updating local copy of all dependencies to latest version,
dep ensure
works.I assume that's because
dep
only checked a local version ofgithub.com/golang/crypto
in$GOPATH
, which was not up-to-date, but didn't check the remote.I got into that state because I regularly work on 2 different machines.
I did
dep ensure -update
on one machine, which stamped the latest version ofgolang.org/x/crypto
.I did
git pull
on the second machine and trieddep ensure
, which failed due to outdated local copy (I think).