Skip to content

Commit

Permalink
🌱 simplify syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Mahdhaoui <alexandre.mahdhaoui@gmail.com>
  • Loading branch information
alexandremahdhaoui committed Apr 27, 2024
1 parent 6449beb commit 0ad4c4c
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions hack/tools/cmd/gomodcheck/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,28 @@ func main() {
}

if versionToRef, ok := upstreamModules[mod]; ok {
upstreams := make([]upstream, 0)
outOfSyncUpstream := make([]upstream, 0)

for upstreamVersion, upstreamRef := range versionToRef {
if version != upstreamVersion {
upstreams = append(upstreams, upstream{
Ref: upstreamRef,
Version: upstreamVersion,
})
if version == upstreamVersion { // pass if version in sync.
continue
}
}

if len(upstreams) > 0 {
oosMods = append(oosMods, oosMod{
Name: mod,
Version: version,
Upstreams: upstreams,
outOfSyncUpstream = append(outOfSyncUpstream, upstream{
Ref: upstreamRef,
Version: upstreamVersion,
})
}

if len(outOfSyncUpstream) == 0 { // pass if no out of sync upstreams.
continue
}

oosMods = append(oosMods, oosMod{
Name: mod,
Version: version,
Upstreams: outOfSyncUpstream,
})
}
}

Expand Down

0 comments on commit 0ad4c4c

Please sign in to comment.