Skip to content

Commit

Permalink
fix: Version stringer for example (800.0 should be 800)
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Apr 27, 2024
1 parent bbd64de commit d839502
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ type Version uint32
func (v Version) String() string {
s := make([]byte, 4)
binary.BigEndian.PutUint32(s, uint32(v))
if (s[2] & 0xFF) == 0 {
return fmt.Sprintf("%d", binary.BigEndian.Uint16(s[:2]))
}
if (s[3] & 0xFF) == 0 {
return fmt.Sprintf("%d.%d", binary.BigEndian.Uint16(s[:2]), s[2])
}
Expand Down

0 comments on commit d839502

Please sign in to comment.