Skip to content

cmd/go: Embed import path to binary to enable rebuilding #16814

Closed
@joneskoo

Description

@joneskoo

Edit: After more thought and discussion embedding the import path in binary seems like the way to go. This would enable upgrading an installed binary application in many cases.

Original submission below:

I'd like to have go get and go install produce a manifest along with the binary that indicates when the binary was compiled, what package produced it.

This is useful to understand why I have binaries in my bin/ and would allow e.g. updating them in bulk later through some mechanism (TBD outside of this issue).

Why this should be enabled by default? Many existing tools (e.g. editors) have a mechanism to install tools (e.g. go guru). To have a complete manifest, including already shipping editors and external applications, this should be updated by default (if someone insists, with opt-out flag).

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

    $ go version
    go version go1.7 darwin/amd64
    
  2. What operating system and processor architecture are you using (go env)?

    Uh, isn't this redundant to 1.?

  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

    $ go get golang.org/x/review/git-codereview
    
  4. What did you expect to see?

    A manifest file listing where the binary came from being generated along with the binary

    E.g.

    2016-08-21T07:33:00Z package golang.org/x/review/git-codereview SHA256:619b8b31e9aed60e19051d403e01214847124370752bae131a0d96c022830e25
    

    This could be a simple text file in $GOPATH/bin/.manifest or something more fancy. KISS would support a simple log format. The exact fields open to discussion, but I feel that timestamp, package and hash of the binary generated are minimal; possibly VCS version could be nice.

  5. What did you see instead?

    No manifest file generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.early-in-cycleA change that should be done early in the 3 month dev cycle.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions