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

Empty build details when using go install #1776

Open
pboguslawski opened this issue Jun 2, 2022 · 5 comments
Open

Empty build details when using go install #1776

pboguslawski opened this issue Jun 2, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pboguslawski
Copy link

Describe the bug
When you build athens using go install, no version nor build time is set:

$ GOBIN=/tmp go install github.com/gomods/athens/cmd/proxy@latest
go: downloading github.com/gomods/athens v0.11.0
[...]

$ /tmp/proxy -version
Build Details:
	Version:	
	Date:	

Expected behavior

Version and build date are set automatically based on version selected by go install for installation and current time.

May help:
https://www.reddit.com/r/golang/comments/u1a7ah/how_to_embed_version_when_go_installing_since_you/

Environment (please complete the following information):

  • OS: Linux 64bit
  • Go version : 1.18
  • Proxy version : 0.11.0
  • Storage (fs/mongodb/s3 etc.) : any
@DrPsychick DrPsychick added this to the 0.12.1 milestone Mar 29, 2023
@nrwiersma
Copy link
Contributor

It turns out with the way the debug build info is set, this is not really possible to do consistently, as the build info can only be read in the main package, and we need the info in main and http handler.

@DrPsychick DrPsychick modified the milestones: 0.12.1, 0.13.x thereafter May 7, 2023
@matt0x6F
Copy link
Contributor

matt0x6F commented Jan 13, 2024

@nrwiersma would it not be possible to derive this information in the main package and pass it to the handler?

I could see changing build.go to a pointer whose value can be set once from main and read by many packages.

@matt0x6F
Copy link
Contributor

I've recently discovered we actually do provide a way to get a versioned Go binary: https://docs.gomods.io/install/build-from-source/

@pboguslawski
Copy link
Author

I've recently discovered we actually do provide a way to get a versioned Go binary:

This does not resolve issue which is about installing with go install, without messing with compiler flags.

@matt0x6F matt0x6F reopened this Apr 23, 2024
@matt0x6F matt0x6F added the enhancement New feature or request label Apr 25, 2024
@matt0x6F matt0x6F modified the milestones: 0.13.x thereafter, 1.0.0 Apr 25, 2024
@matt0x6F
Copy link
Contributor

I think that's fair. I've assigned this to our 1.0.0 milestone because if you can go install you can probably follow the versioned binary instructions. Redoing the build system would be a larger effort. This may fall under having more reproducible builds as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants