Skip to content

Commit

Permalink
go/common/version: Remove MajorMinor() method from Version type
Browse files Browse the repository at this point in the history
It is no longer used.

runtime/src/common/version.rs: Remove corresponding Version's
major_minor() method.
  • Loading branch information
tjanez committed Oct 2, 2020
1 parent 75d84ad commit 4bdfc4b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 35 deletions.
1 change: 1 addition & 0 deletions .changelog/3360.breaking.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/common/version: Remove `MajorMinor()` method from `Version` type
12 changes: 0 additions & 12 deletions go/common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 0 additions & 12 deletions go/common/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
11 changes: 0 additions & 11 deletions runtime/src/common/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4bdfc4b

Please sign in to comment.