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

x/build/cmd/releasebot: in uploadStagingRelease method, target parameter is unused #24614

Closed
dmitshur opened this issue Mar 30, 2018 · 4 comments
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dmitshur
Copy link
Contributor

Consider the current code of the Work.uploadStagingRelease method in package golang.org/x/build/cmd/releasebot:

// uploadStagingRelease uploads target to the release staging bucket.
// If successful, it records the corresponding URL in out.Link.
// In addition to uploading target, it creates and uploads a file
// named "<target>.sha256" containing the hex sha256 hash
// of the target file. This is needed for the release signing process
// and also displayed on the eventual download page.
func (w *Work) uploadStagingRelease(target string, out *ReleaseOutput) error {
	src := filepath.Join(w.runDir, out.File)
	h := sha256.New()
	f, err := os.Open(src)
	if err != nil {
		return err
	}
	_, err = io.Copy(h, f)
	f.Close()
	if err != nil {
		return err
	}
	if err := ioutil.WriteFile(src+".sha256", []byte(fmt.Sprintf("%x", h.Sum(nil))), 0666); err != nil {
		return err
	}

	dst := w.Version + "/" + out.File
	if err := gcsUpload(src, dst); err != nil {
		return err
	}
	if err := gcsUpload(src+".sha256", dst+".sha256"); err != nil {
		return err
	}

	w.releaseMu.Lock()
	out.Link = "https://" + releaseBucket + ".storage.googleapis.com/" + dst
	w.releaseMu.Unlock()
	return nil
}

What did you expect to see?

The target string parameter should either be used, or it should be removed from the method signature (and not mentioned in the comment).

What did you see instead?

Documentation talks about target (repeatedly), but the target parameter is unused in the function body.

/cc @rsc You wrote this code in CL 73333.

@dmitshur dmitshur added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 30, 2018
@FiloSottile FiloSottile changed the title golang.org/x/build/cmd/releasebot: in uploadStagingRelease method, target parameter is unused x/build/cmd/releasebot: in uploadStagingRelease method, target parameter is unused Mar 31, 2018
@gopherbot gopherbot added this to the Unreleased milestone Mar 31, 2018
@gopherbot gopherbot added the Builders x/build issues (builders, bots, dashboards) label Mar 31, 2018
@FiloSottile
Copy link
Contributor

/cc @andybons

@andybons
Copy link
Member

andybons commented Apr 1, 2018

NeedsDecision will trigger review at the weekly proposal meeting. Marking as NeedsInvestigation.

@andybons andybons added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Apr 1, 2018
@andybons andybons self-assigned this Apr 1, 2018
@andybons andybons removed their assignment Sep 18, 2019
@dmitshur
Copy link
Contributor Author

After working with this code in CL 234531, I'm pretty sure I understand what happened.

In the documentation of the uploadStagingRelease method, the word "target" really means the "release target". The out *ReleaseOutput parameter provides all the information needed for the upload operation.

It's likely the target string parameter was added in case the target name needed to be logged, but it just happened not to be.

So, this is harmless, and will be fixed by CL 234531.

@dmitshur dmitshur self-assigned this May 19, 2020
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 19, 2020
@gopherbot
Copy link

Change https://golang.org/cl/234531 mentions this issue: cmd/releasebot, cmd/release: include long tests in release process

@golang golang locked and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants