From c7b66c132b3808ef14763ae1bf8f64b234350f7f Mon Sep 17 00:00:00 2001 From: Maxim Kuleshov Date: Mon, 17 Oct 2022 11:10:12 +0300 Subject: [PATCH] Remove validation from ParseVersionFromCode --- versioning.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/versioning.go b/versioning.go index b304193..1a036c7 100644 --- a/versioning.go +++ b/versioning.go @@ -106,23 +106,19 @@ func MustParseVersion(str string) Version { return v } -func ParseVersionFromCode(code uint32) (Version, error) { +func ParseVersionFromCode(code uint32) Version { patch := code % 100 minor := code%100000 - patch major := code - minor - patch maj, min, p := uint16(major/100000), uint16(minor/100), uint8(patch) - if err := validate(maj, min, p); err != nil { - return Version{}, err - } - return Version{ major: maj, minor: min, patch: p, code: code, - }, nil + } } func parseUint16(str string) (uint16, error) {