Skip to content

write git sha version in diagnostic message#693

Closed
whyrusleeping wants to merge 1 commit into
masterfrom
diag-version
Closed

write git sha version in diagnostic message#693
whyrusleeping wants to merge 1 commit into
masterfrom
diag-version

Conversation

@whyrusleeping
Copy link
Copy Markdown
Member

This PR finds the users go-ipfs folder in the GOPATH and queries it for the sha of the latest commit. This will be helpful to determine which nodes on the network are out of date. Older nodes will simply display the string "github.com/jbenet/go-ipfs" (which was the default value until this commit)

Comment thread diagnostics/diag.go
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder whether we could somehow make the build process go generate some code with the git commit hash. because they could be running a different binary-- if i switch branches with my daemon on, or pass a different GOPATH this doesnt work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... the problem is we cant force go generate steps to be included in the go build process. And unless we force people to use make to build, which sucks, we cant guarantee that the code has the right hash embedded...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is worse. it will fail mysteriously. binaries must not report to be a version they are not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what info should we report?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the hash of the binary?

@jbenet
Copy link
Copy Markdown
Member

jbenet commented Jan 30, 2015

i wonder whether we could somehow make the build process go generate some code with the git commit hash. because they could be running a different binary-- if i switch branches with my daemon on, or pass a different GOPATH this doesnt work.

@whyrusleeping
Copy link
Copy Markdown
Member Author

I think #691 is relevant to this.

@travisperson
Copy link
Copy Markdown
Member

What about distributed binaries not build from source on the users machine?

@whyrusleeping
Copy link
Copy Markdown
Member Author

@travisperson 🐳 ⭐ 🍍 (I dont know)

@whyrusleeping whyrusleeping self-assigned this Jan 30, 2015
@jbenet
Copy link
Copy Markdown
Member

jbenet commented Feb 2, 2015

Let's just use: repo/config.CurrentVersionNumber and start updating it frequently. (this constant should probably move to some other place). i want to get to automated semantic versioning, but soon.

@chriscool
Copy link
Copy Markdown
Contributor

One other way to do it is using something like this:

https://github.com/turon/git-rcs-keywords

Maybe we can create a script (and/or Makefile target) that sets up everything.

@whyrusleeping
Copy link
Copy Markdown
Member Author

gonna close this for now. Can reopen later if the topic comes up

@okket
Copy link
Copy Markdown

okket commented Apr 13, 2015

FYI: This is how go itself deals with the problem:
https://github.com/golang/go/blob/master/src/cmd/dist/build.go#L276

@jbenet
Copy link
Copy Markdown
Member

jbenet commented Apr 17, 2015

@okket that's clever. Though we should add this as part of the metadata on signed binaries. (we cant put it in the source code itself because that would cause another commit)

@Kubuxu Kubuxu deleted the diag-version branch February 27, 2017 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants