Skip to content

Commit

Permalink
fix broken elmconfig equals()
Browse files Browse the repository at this point in the history
  • Loading branch information
dave4420 committed Apr 21, 2024
1 parent e8cdc8c commit cda43d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
25 changes: 3 additions & 22 deletions src/config-types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,9 @@ type elmConfig struct {
}

func (x elmConfig) equals(y elmConfig) bool {
if x.elmCoreVersion != y.elmCoreVersion {
return false
}
if x.dictExtraVersion == nil && y.dictExtraVersion == nil {
return true
}
if x.dictExtraVersion == nil || y.dictExtraVersion == nil {
return false
}
if *x.dictExtraVersion != *y.dictExtraVersion {
return false
}
if x.setExtraVersion == nil && y.setExtraVersion == nil {
return true
}
if x.setExtraVersion == nil || y.setExtraVersion == nil {
return false
}
if *x.setExtraVersion != *y.setExtraVersion {
return false
}
return true
return x.elmCoreVersion == y.elmCoreVersion &&
versionPtrEquals(x.dictExtraVersion, y.dictExtraVersion) &&
versionPtrEquals(x.setExtraVersion, y.setExtraVersion)
}

type config struct {
Expand Down
10 changes: 10 additions & 0 deletions src/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ func parseVersion(s string) (version, error) {
func (x version) isSameMajorAndNotEarlierMinorThan(y version) bool {
return x.major == y.major && x.minor >= y.minor
}

func versionPtrEquals(x *version, y *version) bool {
if x == nil && y == nil {
return true
}
if x == nil || y == nil {
return false
}
return *x == *y
}

0 comments on commit cda43d9

Please sign in to comment.