run modernize -fix ./...

Using golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize

+ some manual cleanup in libpod/lock/shm/shm_lock_test.go as it
  generated an unused variable
+ restored one removed comment

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-09-08 18:22:43 +02:00
parent dc5a791f58
commit 8631032556
144 changed files with 500 additions and 623 deletions

View File

@ -165,7 +165,7 @@ func (p *PodmanTest) PodmanExecBaseWithOptions(args []string, options PodmanExec
// WaitForContainer waits on a started container
func (p *PodmanTest) WaitForContainer() bool {
for i := 0; i < 10; i++ {
for range 10 {
if p.NumberOfContainersRunning() > 0 {
return true
}
@ -376,7 +376,7 @@ func (s *PodmanSession) LineInOutputContainsTag(repo, tag string) bool {
// IsJSONOutputValid attempts to unmarshal the session buffer
// and if successful, returns true, else false
func (s *PodmanSession) IsJSONOutputValid() bool {
var i interface{}
var i any
if err := json.Unmarshal(s.Out.Contents(), &i); err != nil {
GinkgoWriter.Println(err)
return false
@ -438,7 +438,7 @@ func tagOutputToMap(imagesOutput []string) map[string]map[string]bool {
// iterate over output but skip the header
for _, i := range imagesOutput[1:] {
tmp := []string{}
for _, x := range strings.Split(i, " ") {
for x := range strings.SplitSeq(i, " ") {
if x != "" {
tmp = append(tmp, x)
}
@ -487,7 +487,7 @@ func IsCommandAvailable(command string) bool {
// WriteJSONFile write json format data to a json file
func WriteJSONFile(data []byte, filePath string) error {
var jsonData map[string]interface{}
var jsonData map[string]any
if err := json.Unmarshal(data, &jsonData); err != nil {
return err
}