Skip to content

cmd/rebuild: rebuild -w is not the same as internal cmd/go action #23321

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

Closed
ianlancetaylor opened this issue Jan 3, 2018 · 1 comment
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

In cmd/go/internal/work/buildid.go the method (*Builder).updateBuildID, when invoked with rewrite true, implies that it is the same as go tool buildid -w. But the code in the updateBuildID` method does this:

	newID := a.buildID[:strings.LastIndex(a.buildID, buildIDSeparator)] + buildIDSeparator + hashToString(hash)
	if len(newID) != len(a.buildID) {
		return fmt.Errorf("internal error: build ID length mismatch %q vs %q", a.buildID, newID)
	}

while the code in cmd/buildid/buildid.go does this:

	tail := id
	if i := strings.LastIndex(id, "."); i >= 0 {
		tail = tail[i+1:]
	}
	if len(tail) != len(hash)*2 {
		log.Fatalf("%s: cannot find %d-byte hash in id %s", file, len(hash), id)
	}
	newID := id[:len(id)-len(tail)] + fmt.Sprintf("%x", hash)

These should be the same.

I imagine that the code in cmd/go is considered correct and the code in cmd/buildid should change.

@ianlancetaylor ianlancetaylor added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jan 3, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Jan 3, 2018
@ianlancetaylor
Copy link
Contributor Author

I think this is a dup of #23181.

@golang golang locked and limited conversation to collaborators Jan 3, 2019
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants