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

buildinfo parser: handle version strings from Go dev builds #11

Merged
merged 1 commit into from
Aug 26, 2021

Conversation

nick-jones
Copy link
Contributor

With the various possible version strings in play, trying to parse
this line is a bit haphazard. We really only need to extract the
executable path, so I've switched to using a regex. That comes at
a cost of less semantic error returns, but as it happens we weren't
receiving these error lines anyway.. they are printed to stderr,
and we only capture stdout from go version -m .... There is the
option to capture stderr as well, but in a way only dealing with
stdout makes life easier as there is less of a chance we mishandle
an error line, etc.

The verifyExtracted function already picks up on any paths not
parsed from the output - I've adjusted the error handling slightly so
it's more obvious what has caused the issue.

Resolves #10

With the various possible version strings in play, trying to parse
this line is a bit haphazard. We really only need to extract the
executable path, so I've switched to using a regex. That comes at
a cost of less semantic error returns, but as it happens we weren't
receiving these error lines anyway.. they are printed to stderr,
and we only capture stdout from `go version -m ...`. There is the
option to capture stderr as well, but in a way only dealing with
stdout makes life easier as there is less of a chance we mishandle
an error line, etc.

The `verifyExtracted` function already picks up on any paths not
parsed from the output - I've adjusted the error handling slightly so
it's more obvious what has caused the issue.

Resolves #10
@nick-jones nick-jones merged commit fa9ebb1 into master Aug 26, 2021
@nick-jones nick-jones deleted the go-dev-version branch August 26, 2021 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

unrecognised version line: my-binary: devel +b7a85e0003
2 participants