From 4bdfc4b0ded9a74d9de620e61ccfc0965024407b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadej=20Jane=C5=BE?= Date: Fri, 2 Oct 2020 12:08:07 +0200 Subject: [PATCH] go/common/version: Remove MajorMinor() method from Version type It is no longer used. runtime/src/common/version.rs: Remove corresponding Version's major_minor() method. --- .changelog/3360.breaking.2.md | 1 + go/common/version/version.go | 12 ------------ go/common/version/version_test.go | 12 ------------ runtime/src/common/version.rs | 11 ----------- 4 files changed, 1 insertion(+), 35 deletions(-) create mode 100644 .changelog/3360.breaking.2.md diff --git a/.changelog/3360.breaking.2.md b/.changelog/3360.breaking.2.md new file mode 100644 index 00000000000..b6662adc10f --- /dev/null +++ b/.changelog/3360.breaking.2.md @@ -0,0 +1 @@ +go/common/version: Remove `MajorMinor()` method from `Version` type diff --git a/go/common/version/version.go b/go/common/version/version.go index 6e77871db71..a8ecc6eb68f 100644 --- a/go/common/version/version.go +++ b/go/common/version/version.go @@ -54,18 +54,6 @@ func (v Version) MaskNonMajor() Version { } } -// MajorMinor extracts major and minor segments of the Version only. -// -// This is useful for comparing protocol version since the patch segment can be -// ignored. -func (v Version) MajorMinor() Version { - return Version{ - Major: v.Major, - Minor: v.Minor, - Patch: 0, - } -} - var ( // SoftwareVersion represents the Oasis Core's version and should be set // by the linker. diff --git a/go/common/version/version_test.go b/go/common/version/version_test.go index af8cb884dbf..09d26ea08f6 100644 --- a/go/common/version/version_test.go +++ b/go/common/version/version_test.go @@ -18,18 +18,6 @@ func TestMaskNonMajor(t *testing.T) { require.NotEqual(v1.MaskNonMajor(), v4.MaskNonMajor(), "version.MaskNonMajor() should not match") } -func TestMajorMinor(t *testing.T) { - require := require.New(t) - - v1 := Version{1, 1, 0} - v2 := Version{1, 1, 5} - v3 := Version{1, 1, 10} - require.Equal(v1.MajorMinor(), v2.MajorMinor(), "version.MajorMinor() should match") - require.Equal(v2.MajorMinor(), v3.MajorMinor(), "version.MajorMinor() should match") - v4 := Version{1, 2, 0} - require.NotEqual(v1.MajorMinor(), v4.MajorMinor(), "version.MajorMinor() should not match") -} - func TestParseSemVer(t *testing.T) { require := require.New(t) diff --git a/runtime/src/common/version.rs b/runtime/src/common/version.rs index de5f7695086..b34cab84c2e 100644 --- a/runtime/src/common/version.rs +++ b/runtime/src/common/version.rs @@ -30,17 +30,6 @@ impl Version { patch: patch, } } - - /// Extract major and minor segments of the Version only. - /// - /// This is useful for comparing protocol version since the patch segment can be ignored. - pub fn major_minor(&self) -> Version { - Version { - major: self.major, - minor: self.minor, - patch: 0, - } - } } // Returns the version as a platform-dependent u64.