-
Notifications
You must be signed in to change notification settings - Fork 217
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
feat: Read release info from build info #704
Conversation
util_test.go
Outdated
cleanup := envSetter(map[string]string{ | ||
"SENTRY_RELEASE": releaseVersion, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use https://pkg.go.dev/testing#T.Setenv ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked the ability to set multiple environment variables in a single call but it's not strictly necessary. If you think #704 (comment) is a non-issue, I can shift to using T.Setenv
instead :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a non-issue for me. One thing that would probably be an issue is flakiness on CI as doing set/un-set environment variable within a test scope won't enable the test suite to run in parallel. See the notes on https://pkg.go.dev/testing#T.Setenv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the end both implementations are similar enough, I just moved this to T.Setenv
Since go1.18, vcs.revision gets compiled into the binary and can be read. Conveniently, debug.ReadBuildInfo has been around since go1.12, so there's no need to conditionally compile this unless sentry-go needs to support < go1.12 for some reason. So in builds newer than 1.18, this key just simply won't exist and effectively will do nothing. This is much more convenient to detect in anything go1.18 since it's much more common to have this compiled in.
… debug.ReadBuildInfo for release
Head branch was pushed to by a user without write access
9a81cfb
to
434cad0
Compare
Codecov ReportPatch coverage is
📢 Thoughts on this report? Let us know!. |
Builds from #652
For information about this change, please read the referenced PR above. This PR is building off of the previous one and adds tests for coverage.