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.
Why don't you use https://pkg.go.dev/testing#T.Setenv ?
There was a problem hiding this comment.
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.
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.
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.