From 4dd58f226d937b83d8e691ab340d9b6ce08ebd06 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 18 Dec 2023 07:29:31 -0500 Subject: [PATCH] Move golang requirement from 1.18 to 1.20 Signed-off-by: Daniel J Walsh --- Makefile | 2 +- go.mod | 2 +- pkg/trust/trust.go | 14 ++++---------- test/tools/go.mod | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 76753b88805a..0c9e4f1dfeab 100644 --- a/Makefile +++ b/Makefile @@ -332,7 +332,7 @@ $(IN_CONTAINER): %-in-container: $(PODMANCMD) run --rm --env HOME=/root \ -v $(CURDIR):/src -w /src \ --security-opt label=disable \ - docker.io/library/golang:1.18 \ + docker.io/library/golang:1.20 \ make $(*) diff --git a/go.mod b/go.mod index 22964156c2cd..72ef1f9a1712 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/containers/podman/v4 -go 1.18 +go 1.20 require ( github.com/BurntSushi/toml v1.3.2 diff --git a/pkg/trust/trust.go b/pkg/trust/trust.go index 07d144bc112c..2722e867069e 100644 --- a/pkg/trust/trust.go +++ b/pkg/trust/trust.go @@ -4,6 +4,8 @@ import ( "fmt" "sort" "strings" + + "golang.org/x/exp/maps" ) // Policy describes a basic trust policy configuration @@ -51,11 +53,7 @@ func getPolicyShowOutput(policyContentStruct policyContent, systemRegistriesDirP } output = append(output, descriptionsOfPolicyRequirements(policyContentStruct.Default, template, registryConfigs, "", idReader)...) } - // FIXME: This should use x/exp/maps.Keys after we update to Go 1.18. - transports := []string{} - for t := range policyContentStruct.Transports { - transports = append(transports, t) - } + transports := maps.Keys(policyContentStruct.Transports) sort.Strings(transports) for _, transport := range transports { transval := policyContentStruct.Transports[transport] @@ -63,11 +61,7 @@ func getPolicyShowOutput(policyContentStruct policyContent, systemRegistriesDirP transport = "repository" } - // FIXME: This should use x/exp/maps.Keys after we update to Go 1.18. - scopes := []string{} - for s := range transval { - scopes = append(scopes, s) - } + scopes := maps.Keys(transval) sort.Strings(scopes) for _, repo := range scopes { repoval := transval[repo] diff --git a/test/tools/go.mod b/test/tools/go.mod index 9a509934451f..9745c351c5bc 100644 --- a/test/tools/go.mod +++ b/test/tools/go.mod @@ -1,6 +1,6 @@ module github.com/containers/podman/test/tools -go 1.18 +go 1.20 require ( github.com/cpuguy83/go-md2man/v2 v2.0.3