-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: do not cache tool output if tools print to stdout/stderr #27628
Comments
Using a cooked command "wrap" =
it keeps reprinting the same date+time. This is definitely cached output.
|
#27207 is about |
I'm not sure whether we should cache the result of So there's definitely a problem here either way: we just need to decide whether the fix is to update the cache key or exclude the result from caching. |
I actually don't think those are the right choices. There is a plausible use of I would probably pick "never cache if |
I vote for this. |
It looks like we have a consensus. (Moving from |
I agree that this bug needs fixing one way or another. The only way I find I have some thoughts about caching, though. It's unfortunate if we simply throw caching out the window, because it's entirely reasonable for toolexec programs to be deterministic given their input. The way Could we do the same for I think this is the best of both worlds, because current non-deterministic toolexec programs would continue to use no caching at all, while other Go-specific complex tools could take advantage of the build cache. We would have to define the bare minimum of information for |
Thinking about my comment above a bit more, I think this issue should still be fixed by simply doing no caching when Once this issue is fixed, I can then file the "opt-in caching for |
Going to mark this as a proposal since the answer is unclear and it is bound up in #41145. Maybe they should be merged. |
It turns out that this also affects the The |
I have seen the same thing with printouts from a previous run with GODEBUG=gctrace=1, being printed, even if I start without that environment variable, later on (please see https://groups.google.com/g/golang-nuts/c/UP9hIrvqDj4 for a better explanation). Is this related? |
Change https://golang.org/cl/359614 mentions this issue: |
I tried to make a run at this for Go 1.18, but ran into what appear to be some existing bugs in |
(Filed the above test-caching bug as #49267.) |
I don't think this is going to land for 1.21. (Too many existing caching bugs to work through to get it to a testable state.) |
Moving to Backlog. This will require diagnosing and fixing the existing caching bugs so that we can write an integration test for the new caching behavior, and that is a fairly large project. |
Update, Oct 7 2020: see #27628 (comment) for most recent proposal in this issue.
What version of Go are you using (
go version
)?tip (2e5c325), also Go 1.11
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
What did you expect to see?
The second invocation of
go build
doesn't have-toolexec
, so it should not invoke the toolexec command (which I think it doesn't), nor reprint its output.What did you see instead?
toolexec output is reprinted.
In fact, I think it probably should not cache at all if
-toolexec
is specified, since the external command that toolexec invokes may do anything, and (intentionally) not reproducible.cc @dr2chase
The text was updated successfully, but these errors were encountered: