You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testing: address G115 integer overflow conversion warnings and re-enable linter
Each G115 (gosec) integer overflow conversion has been evaluated and
annotated with an inline //nolint:gosec comment explaining why the
conversion is safe:
- opts/swarmopts/port.go: port numbers are in [0, 65535], within uint32
- cli/command/service/logs.go: replica count is far below math.MaxInt
- cli/compose/convert/service.go: healthcheck retries and restart policy
MaximumRetryCount are small, non-negative values
- cli/command/container/cp.go: len() is always non-negative
- cli/command/container/opts.go: ioMaxBandwidth is validated non-negative
- cli/command/container/stats_helpers.go: time diff between reads is positive
- cli/command/image/tree.go: terminal width fits well within int range
- cli/command/service/progress/progress.go: replica/running/job counts
are far below math.MaxInt; mappedSlot is a positive slot number
Remove the global G115 exclusion from .golangci.yml now that all cases
have been individually addressed.
Fixes#5584
- G306# G306: Expect WriteFile permissions to be 0600 or less (too restrictive; also flags "0o644" permissions)
114
113
- G307# G307: Deferring unsafe method "*os.File" on type "Close" (also EXC0008); (TODO: evaluate these and fix where needed: G307: Deferring unsafe method "*os.File" on type "Close")
writeOverallProgress(u.progressOut, int(running), int(replicas), rollback)//nolint:gosec // G115: running/replica counts are far below math.MaxInt in practice
344
344
345
345
ifrunning==replicas {
346
346
u.done=true
@@ -383,7 +383,7 @@ func (*replicatedProgressUpdater) tasksBySlot(tasks []swarm.Task, activeNodes ma
ifu.done||replicas>maxProgressBars||uint64(mappedSlot) >replicas {//nolint:gosec // G115: mappedSlot is a positive task slot number, safe to convert to uint64
387
387
return
388
388
}
389
389
@@ -572,8 +572,8 @@ type replicatedJobProgressUpdater struct {
0 commit comments