Skip to content

Commit 9f7c6c3

Browse files
Merge pull request #27017 from Luap99/go-1.24
Update to go 1.24
2 parents fa10748 + 43a294f commit 9f7c6c3

File tree

183 files changed

+1276
-1542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+1276
-1542
lines changed

cmd/podman/common/build.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"fmt"
66
"io"
7+
"maps"
78
"os"
89
"path/filepath"
910
"strconv"
@@ -337,9 +338,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *Buil
337338
if err != nil {
338339
return nil, err
339340
}
340-
for name, val := range fargs {
341-
args[name] = val
342-
}
341+
maps.Copy(args, fargs)
343342
}
344343
}
345344
if c.Flag("build-arg").Changed {

cmd/podman/common/completion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ func convertFormatSuggestions(suggestions []formatSuggestion) []string {
13651365
// This function will only work for pointer to structs other types are not supported.
13661366
// When "{{." is typed the field and method names of the given struct will be completed.
13671367
// This also works recursive for nested structs.
1368-
func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
1368+
func AutocompleteFormat(o any) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
13691369
// this function provides shell completion for go templates
13701370
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
13711371
// autocomplete json when nothing or json is typed
@@ -1454,7 +1454,7 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t
14541454
}
14551455
}
14561456

1457-
func getEntityType(cmd *cobra.Command, args []string, o interface{}) interface{} {
1457+
func getEntityType(cmd *cobra.Command, args []string, o any) any {
14581458
// container logic
14591459
if containers, _ := getContainers(cmd, args[0], completeDefault); len(containers) > 0 {
14601460
return &define.InspectContainerData{}

cmd/podman/containers/port.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ func port(_ *cobra.Command, args []string) error {
125125
if hostIP == "" {
126126
hostIP = "0.0.0.0"
127127
}
128-
protocols := strings.Split(v.Protocol, ",")
129-
for _, protocol := range protocols {
128+
for protocol := range strings.SplitSeq(v.Protocol, ",") {
130129
// If not searching by port or port/proto, then dump what we see
131130
if port == "" {
132131
for i := uint16(0); i < v.Range; i++ {

cmd/podman/images/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func imageSearch(cmd *cobra.Command, args []string) error {
212212
return rpt.Execute(searchReport)
213213
}
214214

215-
func printArbitraryJSON(v interface{}) error {
215+
func printArbitraryJSON(v any) error {
216216
prettyJSON, err := json.MarshalIndent(v, "", " ")
217217
if err != nil {
218218
return err

cmd/podman/inspect/inspect.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func newInspector(options entities.InspectOptions) (*inspector, error) {
7676
// inspect inspects the specified container/image names or IDs.
7777
func (i *inspector) inspect(namesOrIDs []string) error {
7878
// data - dumping place for inspection results.
79-
var data []interface{}
79+
var data []any
8080
var errs []error
8181
ctx := context.Background()
8282

@@ -157,7 +157,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
157157
}
158158
// Always print an empty array
159159
if data == nil {
160-
data = []interface{}{}
160+
data = []any{}
161161
}
162162

163163
var err error
@@ -191,8 +191,8 @@ func (i *inspector) inspect(namesOrIDs []string) error {
191191
return nil
192192
}
193193

194-
func (i *inspector) inspectAll(ctx context.Context, namesOrIDs []string) ([]interface{}, []error, error) {
195-
var data []interface{}
194+
func (i *inspector) inspectAll(ctx context.Context, namesOrIDs []string) ([]any, []error, error) {
195+
var data []any
196196
allErrs := []error{}
197197
for _, name := range namesOrIDs {
198198
ctrData, errs, err := i.containerEngine.ContainerInspect(ctx, []string{name}, i.options)

cmd/podman/machine/client9p.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func client9p(portNum uint32, mountPath string) error {
7676
conn *vsock.Conn
7777
retries = 20
7878
)
79-
for i := 0; i < retries; i++ {
79+
for range retries {
8080
// Host connects to non-hypervisor processes on the host running the VM.
8181
conn, err = vsock.Dial(vsock.Host, portNum, nil)
8282
// If errors.Is worked on this error, we could detect non-timeout errors.

cmd/podman/machine/os/manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ func GetDistribution() Distribution {
8989

9090
l := bufio.NewScanner(f)
9191
for l.Scan() {
92-
if strings.HasPrefix(l.Text(), "ID=") {
93-
dist.Name = strings.TrimPrefix(l.Text(), "ID=")
92+
if after, ok := strings.CutPrefix(l.Text(), "ID="); ok {
93+
dist.Name = after
9494
}
95-
if strings.HasPrefix(l.Text(), "VARIANT_ID=") {
96-
dist.Variant = strings.Trim(strings.TrimPrefix(l.Text(), "VARIANT_ID="), "\"")
95+
if after, ok := strings.CutPrefix(l.Text(), "VARIANT_ID="); ok {
96+
dist.Variant = strings.Trim(after, "\"")
9797
}
9898
}
9999
return dist

cmd/podman/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ import (
3838

3939
type logrusLogger struct{}
4040

41-
func (l logrusLogger) Errorf(format string, args ...interface{}) {
41+
func (l logrusLogger) Errorf(format string, args ...any) {
4242
logrus.Errorf(format, args...)
4343
}
44-
func (l logrusLogger) Debugf(format string, args ...interface{}) {
44+
func (l logrusLogger) Debugf(format string, args ...any) {
4545
logrus.Debugf(format, args...)
4646
}
4747

cmd/podman/parse/net.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ func ValidateExtraHost(val string) (string, error) {
3939
}
4040

4141
// Split the hostnames by semicolon and validate each one
42-
nameList := strings.Split(names, ";")
43-
for _, name := range nameList {
42+
for name := range strings.SplitSeq(names, ";") {
4443
if len(name) == 0 {
4544
return "", fmt.Errorf("hostname in add-host %q is empty", val)
4645
}

cmd/podman/quadlet/quadlet.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
// logrusLogger implements the logiface.Logger interface using logrus
1212
type logrusLogger struct{}
1313

14-
func (l logrusLogger) Errorf(format string, args ...interface{}) {
14+
func (l logrusLogger) Errorf(format string, args ...any) {
1515
logrus.Errorf(format, args...)
1616
}
1717

18-
func (l logrusLogger) Debugf(format string, args ...interface{}) {
18+
func (l logrusLogger) Debugf(format string, args ...any) {
1919
logrus.Debugf(format, args...)
2020
}
2121

0 commit comments

Comments
 (0)