Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go test stale code #12074

Closed
Vellocet opened this issue Aug 8, 2015 · 4 comments
Closed

cmd/go: go test stale code #12074

Vellocet opened this issue Aug 8, 2015 · 4 comments

Comments

@Vellocet
Copy link

Vellocet commented Aug 8, 2015

I am running go 1.4.1
My os is ubuntu server 14.04

When running two different unit tests with "go test", I get unexpected results, as if it has not rebuilding packages that have changed.

This has only happened twice so far.
The first time go test complained about an import cycle that no longer existed. After poking at the code for a bit, it suddenly starts running again. I revert all of my changes and it continues to work fine.

The second time I had a test which json marshals a struct, one of the elements was missing in the marshaled string. When I changed the order of the elements of the struct, the element appeared in the string. When I reverted it, it continued to work.

I haven't been able to reproduce this bug as the code currently works fine, and only breaks temporarily. This has also only happened with those two tests. All of my other tests work as expected when I change the code.

@davecheney
Copy link
Contributor

Without details it is hard to advise, but one common case of this stake
behaviour was deleting a file from a package. Up to go 1.4.2 this would not
cause the package to be recompiled thus letting dependant packages behave
as if the symbols in that file were still present.

A simple way to verify this is to delete $GOPATH/pkg.

Thanks

Dave

On Sat, 8 Aug 2015 10:01 Vellocet notifications@github.com wrote:

I am running go 1.4.1
My os is ubuntu server 14.04

When running two different unit tests with "go test", I get unexpected
results, as if it has not rebuilding packages that have changed.

This has only happened twice so far.
The first time go test complained about an import cycle that no longer
existed. After poking at the code for a bit, it suddenly starts running
again. I revert all of my changes and it continues to work fine.

The second time I had a test which json marshals a struct, one of the
elements was missing in the marshaled string. When I changed the order of
the elements of the struct, the element appeared in the string. When I
reverted it, it continued to work.

I haven't been able to reproduce this bug as the code currently works
fine, and only breaks temporarily. This has also only happened with those
two tests. All of my other tests work as expected when I change the code.


Reply to this email directly or view it on GitHub
#12074.

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Aug 8, 2015
@ianlancetaylor ianlancetaylor changed the title go test stale code cmd/go: go test stale code Aug 8, 2015
@Vellocet
Copy link
Author

Vellocet commented Aug 8, 2015

Good to know about deleting files. Both of the structs in question were generated by a protocol buffer compiler.

@gopherbot
Copy link

CL https://golang.org/cl/22432 mentions this issue.

mk0x9 pushed a commit to mk0x9/go that referenced this issue Apr 27, 2016
It comes up every few months that we can't understand why
the go command is rebuilding some package.
Add diagnostics so that the go command can explain itself
if asked.

For golang#2775, golang#3506, golang#12074.

Change-Id: I1c73b492589b49886bf31a8f9d05514adbd6ed70
Reviewed-on: https://go-review.googlesource.com/22432
Reviewed-by: Rob Pike <r@golang.org>
@rsc
Copy link
Contributor

rsc commented Nov 2, 2017

Fairly certain this bug is fixed.

@rsc rsc closed this as completed Nov 2, 2017
@golang golang locked and limited conversation to collaborators Nov 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants