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

Increase leniency of semver parsing #2742

Merged
merged 1 commit into from
Feb 28, 2020
Merged

Conversation

nhynes
Copy link
Contributor

@nhynes nhynes commented Feb 27, 2020

Not all sources of semvers provide three fields. For instance, runtime.Version() will return only major and minor when it's part of a release build (usage). This fixes oasis-node startup issues.

var semVers []uint16
for _, v := range split {
i, err := strconv.ParseUint(v, 10, 16)
var semVers []uint16 = []uint16{0, 0, 0}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe nil?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that this preallocates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I mean like Option<u16>

@codecov
Copy link

codecov bot commented Feb 28, 2020

Codecov Report

Merging #2742 into master will decrease coverage by 0.08%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2742      +/-   ##
==========================================
- Coverage      63%   62.92%   -0.09%     
==========================================
  Files         383      383              
  Lines       36094    36094              
==========================================
- Hits        22742    22713      -29     
+ Misses      10525    10516       -9     
- Partials     2827     2865      +38
Impacted Files Coverage Δ
go/common/version/version.go 84% <66.66%> (ø) ⬆️
go/consensus/tendermint/api/api.go 73.58% <0%> (-15.1%) ⬇️
go/storage/metrics.go 72.64% <0%> (-7.7%) ⬇️
go/storage/api/root_cache.go 70.11% <0%> (-6.9%) ⬇️
go/runtime/tagindexer/tagindexer.go 68.47% <0%> (-4.35%) ⬇️
go/storage/client/client.go 75.63% <0%> (-3.79%) ⬇️
go/storage/mkvs/urkel/urkel.go 85.71% <0%> (-3.58%) ⬇️
go/storage/database/database.go 74.56% <0%> (-3.51%) ⬇️
go/storage/mkvs/urkel/insert.go 86.39% <0%> (-2.73%) ⬇️
go/runtime/transaction/transaction.go 75.9% <0%> (-2.41%) ⬇️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 207cb64...938a6e8. Read the comment docs.

@nhynes
Copy link
Contributor Author

nhynes commented Feb 28, 2020

mdlint is giving spurious errors
.changelog/2742.bugfix.md:4:6 MD034/no-bare-urls Bare URL used [Context: "https://golang.org/pkg/runtime..."

[foo][0]
[0]: https://bar

is not a bare url

@pro-wh
Copy link
Contributor

pro-wh commented Feb 28, 2020

Does Go claim to use semver?

@pro-wh
Copy link
Contributor

pro-wh commented Feb 28, 2020

if I search "semver," I find this https://semver.org/#spec-item-2:

A normal version number MUST take the form X.Y.Z

and then they don't explain what "normal" refers to

Copy link
Contributor

@pro-wh pro-wh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright seeing as we're elsewhere cramming the Go runtime version down parseSemVerStr's throat, we might as well not make our node panic

@nhynes nhynes merged commit a4e4e99 into master Feb 28, 2020
@nhynes nhynes deleted the nhynes/fix/semver-parsing branch February 28, 2020 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants