Read release info from build info#652
Conversation
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.
|
The SDK requires baseline Go 1.18, so this is no issue Line 3 in 97a00a4 Any chance you could add some tests? |
No, I'm not being paid by Sentry. |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #652 +/- ##
==========================================
- Coverage 80.65% 80.54% -0.12%
==========================================
Files 43 43
Lines 4332 4338 +6
==========================================
Hits 3494 3494
- Misses 712 718 +6
Partials 126 126
☔ View full report in Codecov by Sentry. |
|
Hi Matt. |
👋 just trying to use your software over here. |
I understand, but we would like to handle this PR as any other PRs we receive from contributors. |
|
Yeah and that's fine. You're welcome to add your own tests. I'm not sure how this is easily testable and it's a trivial change. But since you're insisting, there's no tests at all for this entire function. We've already worked around this by simply using my code in our own config. Figured I'd try to upstream it since it makes sense for others. |
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.