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

Open
dmitshur opened this issue Mar 30, 2018 · 2 comments

Comments

@dmitshur
Copy link
Member

commented Mar 30, 2018

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.

@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 label Mar 31, 2018

@FiloSottile

This comment has been minimized.

Copy link
Member

commented Mar 31, 2018

/cc @andybons

@andybons

This comment has been minimized.

Copy link
Member

commented Apr 1, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.