Comments (22)
Thanks. I don't know if I'll be able to fix this before
I go on vacation, but hopefully you can get by with
the workaround for a few weeks.
from godep.
Here is a repro for hk:
#!/bin/sh
set -ex
git checkout master
git branch -d old || true
git checkout -b old 208ceb0f3033800f0560913497490888b9c1cacf
rm -rf Godeps/_workspace/pkg
godep go install
git checkout master
godep go build -x
Initial observations:
- things are only put in
Godeps/_workspace/pkg
whengodep go install
is used - if
-a
is added togodep go build
it works but ends up doing a lot of extra recompiling of the runtime and stdlib
from godep.
Awesome. A reproducible test case makes this so much easier! Thanks.
from godep.
Confirmed the issue is still there in current master c703322
from godep.
I'm still seeing this and made a self-contained repro at https://github.com/sqs/godeps-stale-pkg-repro.
I don't think this is godep's fault, but my current guess is that something godep does is triggering it. Basically, dependency pkgs in Godeps/_workspace are shown as Stale with godep go list
, are rebuilt if you run godep go install
on them directly, but aren't rebuilt if you run godep go install
on a pkg that imports them.
go help install
says: "Install compiles and installs the packages named by the import paths, along with their dependencies." This seems to imply that the same operation should be performed on dependencies as on the named package arguments to go install
.
My current guesses are either:
- I'm completely misunderstanding what
go install
should do. - There's an special, undocumented way (or that I haven't seen the docs for) in which
go install
treats sub-GOPATHs or GOPATHs with underscore-leading names. - There's a bug in how the go tool treats sub-GOPATHs or GOPATHs with underscore-leading names.
FWIW, go1.4beta1 has the same issue.
from godep.
I've been running into this quite a bit with a few recent projects. I've just added a step that cleans the pkg directory as part of my build, but it'd be good to see this fixed.
from godep.
Not sure if it's related to this or not but yesterday I had to nuke $GOPATH/pkg
to get a godep go install
to work.
from godep.
Following up on this, we experience this 100% of the time when checking out git branches with different files in Godeps/_workspace/src
(because the old pkg files are there), git pulling commits that change files in Godeps/_workspace/src
, editing .go
files in Godeps/_workspace/src
, etc. It's also something that confuses people we're onboarding. The workaround is to nuke the Godeps/_workspace/pkg
dir, of course.
The thing that's kept me from digging into this more (beyond the repro at https://github.com/sqs/godeps-stale-pkg-repro) is that nobody else seems to experience this issue with such regularity. And that makes me suspect that something is different about our setup. For the other folks who have reported this, does this issue occur all of the time, or just occasionally?
from godep.
@sqs hi I actually just ran into this today. I changed a dependency and ran a godep go update [dep]
. The JSON file seemed to be correctly updated, but the .a
files in pkg were stale from a previous build. Nuking the pkg directory fixed it.
This is the first time I've run into this that I have noticed. I suspect/fear that it has been happening all along, periodically, but I just haven't noticed it for whatever reason.
from godep.
I think I found the root cause:
// Have installed copy, probably built using current compilers,
// and built after its imported packages. The only reason now
// that we'd have to rebuild it is if the sources were newer than
// the package. If a package p is not in the same tree as any
// package named on the command-line, assume it is up-to-date
// no matter what the modification times on the source files indicate.
// This avoids rebuilding $GOROOT packages when people are
// working outside the Go root, and it effectively makes each tree
// listed in $GOPATH a separate compilation world.
// See issue 3149.
if p.Root != "" && !topRoot[p.Root] {
return false
}
It refers to golang/go#3149.
I can see why you wouldn't want to recompile $GOROOT packages, but I wonder if the side effect of "mak[ing] each tree listed in $GOPATH a separate compilation world" is desirable. In this case, it is not.
from godep.
On twitter @kr suggested godep save -r
as a workaround. I have not been able to test yet.
from godep.
As a workaround, we should be able to use:
godep go build -a
-a
tells go build to ignore mtime and assume everything is stale.
from godep.
Can anyone see any reason why godep should not append -a on every build and install automatically?
from godep.
Always appending -a
would slow down partial rebuilds, which would be undesirable for us (from a dev speed and iteration POV).
from godep.
It would slow down builds, but by how much? On one of my projects, I saw build times increase by around 200ms. The increase in build times is likely acceptable for the added benefit of having correct builds. :)
from godep.
Had a talk with @sqs offline, main problem is incremental builds, which typically run in 500ms vs full builds which run in around 7s.
We should probably push this upstream to the go team and get them to fix go build
instead.
from godep.
There's a related issue (from Jan 2014) with discussion here:
We made a post on golang-nuts to try to motivate improving the situation upstream in Go, but it did not catch much attention:
https://groups.google.com/d/msg/golang-nuts/Z5uJf6mEF6E/K7yb6Xc5zQUJ
It was suggested to me by minux to make the thread in golang-dev (since Russ was away at the time), which I did, but it didn't get any traction either:
https://groups.google.com/forum/#!topic/golang-dev/svxuGkGJTD8
(Just mentioning relevant links here. I am extremely familiar with this issue and would really like to see it fixed, because it forces me to avoid installing my packages and thus lose benefits of faster compilation, auto completion, etc.)
from godep.
@shurcooL How difficult would it be to submit a patch? One option would be to send them one and see if they accept it.
from godep.
Summary
@fkautz, it may be quite difficult to come up with a patch that addresses the problem but doesn't create additional problems in edge cases.
Details
The difficulty comes from having to consider all edge cases - the go
command has to deal with a lot. Most of those edge cases are less common, but still valid conditions where the go
command is expected to behave correctly. An example would be building Go from source. In some cases, the go
command needs to write to GOROOT workspace, in most other cases it should not.
It would require very careful consideration of all edge cases and planning, and seeing if it's possible to change the behavior such that this problem is resolved without compromising anything. If that can be done, I would imagine they would accept such a patch (after very thorough review).
At some point I had plans to try to do that, by making a fork of the go
tool, making the changes I would want, and seeing if everything works out. I haven't gotten around to doing that (and I don't have short term plans to do it atm).
In the end, it may end up being trivial - or impossible. You can only find out after starting the work. It's quite hard to predict.
from godep.
This issue has been resolved in Go 1.5. See golang/go#10509.
from godep.
That is a relief. I'll go ahead and close this issue now. If folks come asking about it in the future we can direct them to update to Go 1.5.
from godep.
@shurcooL @kr Fantastic news, thanks for following up on this.
from godep.
Related Issues (20)
- Command not found: 'godep'
- No command 'godep' found HOT 2
- update vendored deps to latest remote version HOT 1
- Add banner to README with link to golang/dep HOT 2
- Question about commit the vendor directory HOT 2
- sdgfc 4qswczeswdzx HOT 1
- sdgfc 4qswczeswdzxF HOT 1
- so many errors!!! HOT 1
- Godep should use go env for missing ENV variables HOT 1
- - HOT 1
- Honor build.Context.BuildTags and build.Context.ReleaseTags (and possibly file suffixes) HOT 4
- Backward compatible removal of package in dependency can cause godep save error: "no buildable Go source files in <pkg>" HOT 1
- godep does not see vendored packages within thirdpadrty dependencies HOT 1
- dep ensure hangs if ssh key has a passphrase
- Consistent way to reference Gopkg.toml in CLI HOT 1
- Can the specified directory be excluded when `godep save`
- Changed git provider. Most vendor packages are still using the old git link
- Build failed after godep save HOT 1
- i used gin, gin used +build HOT 2
- vert toml to json HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godep.