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 105349a
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions hack/tools/cmd/gomodcheck/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,33 @@ func main() {
// then we add the version and the ref to the list of out of sync modules.
for mod, version := range projectModules {
if _, ok := excludedMods[mod]; ok {
logger.Infof("skipped excluded module: %s", mod)
logger.Infof("skipped: %s", mod)
continue
}

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 105349a

Please sign in to comment.