From ca70d028d8a3c1c612aafdd580eebdfc3810f2c2 Mon Sep 17 00:00:00 2001 From: Mohamed Abokammer Date: Mon, 5 Sep 2022 10:35:49 +0100 Subject: [PATCH] Update go version Signed-off-by: Mohamed Abokammer --- .github/workflows/tests.yml | 2 +- .github/workflows/ui-build.yaml | 2 +- cmds/clients/contestcli/cli/verbs.go | 5 +- cmds/contest-generator/config.go | 4 +- cmds/contest-generator/main.go | 5 +- docker/mysql/Dockerfile | 3 +- go.mod | 72 ++++++++++++++----- go.sum | 30 -------- pkg/logging/logger.go | 4 +- pkg/test/functions.go | 3 +- pkg/test/parameter_test.go | 1 + pkg/transport/http/http.go | 4 +- pkg/userfunctions/ocp/ocp.go | 16 ++--- plugins/testfetchers/uri/uri.go | 7 +- .../teststeps/exec/transport/ssh_transport.go | 3 +- plugins/teststeps/sshcmd/sshcmd.go | 4 +- tests/e2e/e2e_test.go | 5 +- 17 files changed, 89 insertions(+), 81 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ad68f243..c7a4a348 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-go@v2 with: stable: "false" - go-version: "1.16.2" + go-version: "1.18" - name: set up environment variables run: | # must do this here because `env` doesn't allow variable expansion diff --git a/.github/workflows/ui-build.yaml b/.github/workflows/ui-build.yaml index 46394b3f..21b4fb98 100644 --- a/.github/workflows/ui-build.yaml +++ b/.github/workflows/ui-build.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/setup-go@v2 with: stable: "false" - go-version: "1.16.2" + go-version: "1.18" - uses: actions/setup-node@v2 with: node-version: "16.15.1" diff --git a/cmds/clients/contestcli/cli/verbs.go b/cmds/clients/contestcli/cli/verbs.go index b9ecfba6..fbadf9ac 100644 --- a/cmds/clients/contestcli/cli/verbs.go +++ b/cmds/clients/contestcli/cli/verbs.go @@ -12,7 +12,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "os" "strconv" "strings" @@ -38,13 +37,13 @@ func run(requestor string, transport transport.Transport, stdout io.Writer) erro var jobDesc []byte if flagSet.Arg(1) == "" { fmt.Fprintf(os.Stderr, "Reading from stdin...\n") - jd, err := ioutil.ReadAll(os.Stdin) + jd, err := io.ReadAll(os.Stdin) if err != nil { return fmt.Errorf("failed to read job descriptor: %w", err) } jobDesc = jd } else { - jd, err := ioutil.ReadFile(flagSet.Arg(1)) + jd, err := os.ReadFile(flagSet.Arg(1)) if err != nil { return fmt.Errorf("failed to read job descriptor: %w", err) } diff --git a/cmds/contest-generator/config.go b/cmds/contest-generator/config.go index f110bdae..ed9c15b0 100644 --- a/cmds/contest-generator/config.go +++ b/cmds/contest-generator/config.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "io/ioutil" + "io" "log" "os" "path" @@ -147,7 +147,7 @@ func readConfig(filename string) (*Config, error) { log.Printf("Error closing file '%s': %v", filename, err) } }() - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, fmt.Errorf("failed to read file: %w", err) } diff --git a/cmds/contest-generator/main.go b/cmds/contest-generator/main.go index 31c25ae6..d1995859 100644 --- a/cmds/contest-generator/main.go +++ b/cmds/contest-generator/main.go @@ -7,7 +7,6 @@ package main import ( "fmt" - "io/ioutil" "log" "os" "path" @@ -34,7 +33,7 @@ func main() { flag.Usage = usage flag.Parse() - data, err := ioutil.ReadFile(*flagTemplate) + data, err := os.ReadFile(*flagTemplate) if err != nil { log.Fatalf("Failed to read template file '%s': %v", *flagTemplate, err) } @@ -48,7 +47,7 @@ func main() { } outfile := *flagOutfile if outfile == "" { - tmpdir, err := ioutil.TempDir("", "contest") + tmpdir, err := os.MkdirTemp("", "contest") if err != nil { log.Fatalf("Cannot create temporary directory: %v", err) } diff --git a/docker/mysql/Dockerfile b/docker/mysql/Dockerfile index 4156a579..3b751f8c 100644 --- a/docker/mysql/Dockerfile +++ b/docker/mysql/Dockerfile @@ -3,7 +3,8 @@ FROM mysql:8.0-debian # Configure golang environment to run migration against database ARG TARGETARCH RUN apt-get update && apt-get install -y curl && apt-get clean -RUN curl -L https://golang.org/dl/go1.16.2.linux-$TARGETARCH.tar.gz | tar xzf - +RUN apt-get install -y git +RUN curl -L https://golang.org/dl/go1.18.linux-$TARGETARCH.tar.gz | tar xzf - ENV GOROOT=/go ENV PATH=$PATH:/go/bin diff --git a/go.mod b/go.mod index 93d9e7c5..bdb7a46e 100644 --- a/go.mod +++ b/go.mod @@ -1,29 +1,19 @@ module github.com/linuxboot/contest -go 1.15 +go 1.18 require ( - github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/aws/aws-sdk-go v1.41.14 github.com/benbjohnson/clock v1.1.0 github.com/chappjc/logrus-prefix v0.0.0-20180227015900-3a1d64819adb - github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gin-gonic/gin v1.8.1 - github.com/go-playground/validator/v10 v10.11.0 // indirect github.com/go-sql-driver/mysql v1.6.0 - github.com/goccy/go-json v0.9.8 // indirect github.com/google/go-safeweb v0.0.0-20211026121254-697f59a9d57f github.com/google/uuid v1.3.0 github.com/insomniacslk/termhook v0.0.0-20210329134026-a267c978e590 github.com/insomniacslk/xjson v0.0.0-20210106140854-1589ccfd1a1a github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 - github.com/mattn/go-colorable v0.1.11 // indirect - github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect - github.com/onsi/ginkgo v1.12.0 // indirect - github.com/onsi/gomega v1.9.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.2 // indirect github.com/pkg/sftp v1.13.4 - github.com/pkg/term v1.1.0 // indirect github.com/pressly/goose v2.7.0+incompatible github.com/prometheus/client_golang v1.12.2 github.com/prometheus/client_model v0.2.0 @@ -33,20 +23,68 @@ require ( github.com/stretchr/testify v1.8.0 github.com/u-root/cpu v0.0.0-20210922222005-0a371c3a086d github.com/u-root/u-root v7.0.0+incompatible - github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect - github.com/xaionaro-go/atomicmap v0.0.0-20210620215405-96a7f1f95a70 // indirect github.com/xaionaro-go/metrics v0.0.0-20210425194006-68050b337673 - github.com/xaionaro-go/spinlock v0.0.0-20200518175509-30e6d1ce68a1 // indirect github.com/xaionaro-go/statuspage v0.0.0-20220629202611-97b44b308599 github.com/xaionaro-go/unsafetools v0.0.0-20210722164218-75ba48cf7b3c go.mongodb.org/mongo-driver v1.9.1 go.uber.org/atomic v1.9.0 - go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.19.1 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d + golang.org/x/text v0.3.7 + gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 +) + +require ( + github.com/OneOfOne/xxhash v1.2.8 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/demdxx/gocast v1.2.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/validator/v10 v10.11.0 // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/goccy/go-json v0.9.8 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/snappy v0.0.1 // indirect + github.com/hugelgupf/p9 v0.1.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/kevinburke/ssh_config v1.1.0 // indirect + github.com/klauspost/compress v1.13.6 // indirect + github.com/kr/fs v0.1.0 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/mattn/go-colorable v0.1.11 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/onsi/ginkgo v1.12.0 // indirect + github.com/onsi/gomega v1.9.0 // indirect + github.com/pelletier/go-toml/v2 v2.0.2 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/term v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/stretchr/objx v0.4.0 // indirect + github.com/ugorji/go/codec v1.2.7 // indirect + github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect + github.com/xaionaro-go/atomicmap v0.0.0-20210620215405-96a7f1f95a70 // indirect + github.com/xaionaro-go/spinlock v0.0.0-20200518175509-30e6d1ce68a1 // indirect + github.com/xdg-go/pbkdf2 v1.0.0 // indirect + github.com/xdg-go/scram v1.0.2 // indirect + github.com/xdg-go/stringprep v1.0.2 // indirect + github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect + go.uber.org/multierr v1.7.0 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect + golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/tools v0.1.12 // indirect golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect - gopkg.in/yaml.v2 v2.4.0 - gopkg.in/yaml.v3 v3.0.1 + google.golang.org/protobuf v1.28.0 // indirect ) diff --git a/go.sum b/go.sum index e1b53511..3580f935 100644 --- a/go.sum +++ b/go.sum @@ -69,7 +69,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/siphash v1.1.0/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4= -github.com/demdxx/gocast v0.0.0-20160708134729-106586117e3c/go.mod h1:m5ijWZkMjfROlknTNh4IjKE3VN7TPXE0B3MRruq1s9Y= github.com/demdxx/gocast v1.2.0 h1:Z9zVpAjyTWJIJwFFynnOoP30yxot4Y2QafNPSD+VEEo= github.com/demdxx/gocast v1.2.0/go.mod h1:RTyqNS6BdIq/19jJX96PlVhfqG31tldKMnpVJnPa3pw= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= @@ -81,8 +80,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= @@ -105,18 +102,15 @@ github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw= github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.9.8 h1:DxXB6MLd6yyel7CLph8EwNIonUtVZd3Ue5iRcL4DQCE= github.com/goccy/go-json v0.9.8/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -230,16 +224,10 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/labstack/echo v2.2.1-0.20161115162638-bc173df6ba59+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= -github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -262,7 +250,6 @@ github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -291,7 +278,6 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= @@ -330,19 +316,14 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/trafficstars/metrics v0.0.0-20200814135838-ec71779fd01d/go.mod h1:HHFbOLT4Kf5raCtxlL8s5cDvsJC9knlxD1EL2B8pjGw= -github.com/trafficstars/metrics v0.0.0-20210427151006-0250d8a27518/go.mod h1:C5/Cw/PdLd6mdtA1ZGI5LH+zPFzDm9f7BAfFPvZpK4Q= -github.com/trafficstars/statuspage v0.0.0-20210427155946-c18cc375df3c/go.mod h1:XOqcUBz2+snTHfxcYRBLArNhaJjOvHvRgqAuEq4w7pA= github.com/u-root/cpu v0.0.0-20210922222005-0a371c3a086d h1:DitnLbNGHuPucOQkWi73clOG+wdPgNMgUpr3hBzBJJ0= github.com/u-root/cpu v0.0.0-20210922222005-0a371c3a086d/go.mod h1:1JzU+/YbK0tQ7WbufDMLA0iVbpIQNywhiCX/paytE4k= github.com/u-root/u-root v6.0.1-0.20200118052101-6bcd1cda5996+incompatible/go.mod h1:RYkpo8pTHrNjW08opNd/U6p/RJE7K0D8fXO0d47+3YY= github.com/u-root/u-root v7.0.0+incompatible h1:u+KSS04pSxJGI5E7WE4Bs9+Zd75QjFv+REkjy/aoAc8= github.com/u-root/u-root v7.0.0+incompatible/go.mod h1:RYkpo8pTHrNjW08opNd/U6p/RJE7K0D8fXO0d47+3YY= -github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/vishvananda/netlink v1.1.1-0.20200221165523-c79a4b7b4066/go.mod h1:FSQhuTO7eHT34mPzX+B04SUAjiqLxtXs1et0S6l9k4k= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= @@ -373,7 +354,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.9.1 h1:m078y9v7sBItkt1aaoe2YlvWEXcD263e1a4E1fBrJ1c= go.mongodb.org/mongo-driver v1.9.1/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -401,8 +381,6 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -427,7 +405,6 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -439,7 +416,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -503,7 +479,6 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -512,10 +487,8 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190903213830-1f305c863dab/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -554,8 +527,6 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -677,7 +648,6 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 h1:PDIOdWxZ8eRizhKa1AAvY53xsvLB1cWorMjslvY3VA8= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= diff --git a/pkg/logging/logger.go b/pkg/logging/logger.go index 35124837..a4fb8139 100644 --- a/pkg/logging/logger.go +++ b/pkg/logging/logger.go @@ -6,7 +6,7 @@ package logging import ( - "io/ioutil" + "io" log_prefixed "github.com/chappjc/logrus-prefix" "github.com/sirupsen/logrus" @@ -41,7 +41,7 @@ func AddFields(e *logrus.Entry, fields map[string]interface{}) *logrus.Entry { // Disable sends all logging output to the bit bucket. func Disable() { - log.SetOutput(ioutil.Discard) + log.SetOutput(io.Discard) } // Trace - Set Log Level to Trace diff --git a/pkg/test/functions.go b/pkg/test/functions.go index f2f5b5e3..1b19e343 100644 --- a/pkg/test/functions.go +++ b/pkg/test/functions.go @@ -16,7 +16,8 @@ var funcMap = map[string]interface{}{ // some common pre-sets "ToUpper": strings.ToUpper, "ToLower": strings.ToLower, - "Title": strings.Title, + // nolint deprecated, but works fine + "Title": strings.Title, } var funcMapMutex sync.Mutex diff --git a/pkg/test/parameter_test.go b/pkg/test/parameter_test.go index 7266e2c8..20388e39 100644 --- a/pkg/test/parameter_test.go +++ b/pkg/test/parameter_test.go @@ -38,6 +38,7 @@ func TestParameterExpandUserFunctions(t *testing.T) { if len(a) == 0 { return "", errors.New("no params") } + // nolint deprecated, but works fine return strings.Title(a[0]), nil } require.NoError(t, RegisterFunction("CustomFunc", customFunc)) diff --git a/pkg/transport/http/http.go b/pkg/transport/http/http.go index eb0b6ce1..261737ba 100644 --- a/pkg/transport/http/http.go +++ b/pkg/transport/http/http.go @@ -10,7 +10,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -166,7 +166,7 @@ func (h *HTTP) request(requestor string, verb string, params url.Values) (*HTTPP return nil, fmt.Errorf("HTTP POST failed: %v", err) } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("cannot read HTTP response: %v", err) } diff --git a/pkg/userfunctions/ocp/ocp.go b/pkg/userfunctions/ocp/ocp.go index d092e5e0..e25065e8 100644 --- a/pkg/userfunctions/ocp/ocp.go +++ b/pkg/userfunctions/ocp/ocp.go @@ -7,7 +7,7 @@ package ocp import ( "encoding/json" - "io/ioutil" + "os" ) var parameterFile = "parameters.json" @@ -28,7 +28,7 @@ type contestParameter struct { var userFunctions = map[string]interface{}{ "getPrivateKeyFile": func(a string) (string, error) { - fb, err := ioutil.ReadFile(parameterFile) + fb, err := os.ReadFile(parameterFile) if err != nil { return "", err } @@ -46,7 +46,7 @@ var userFunctions = map[string]interface{}{ return "", nil }, "getBmcHost": func(a string) (string, error) { - fb, err := ioutil.ReadFile(parameterFile) + fb, err := os.ReadFile(parameterFile) if err != nil { return "", err } @@ -63,7 +63,7 @@ var userFunctions = map[string]interface{}{ return "", nil }, "getBmcUser": func(a string) (string, error) { - fb, err := ioutil.ReadFile(parameterFile) + fb, err := os.ReadFile(parameterFile) if err != nil { return "", err } @@ -80,7 +80,7 @@ var userFunctions = map[string]interface{}{ return "", nil }, "getBmcPassword": func(a string) (string, error) { - fb, err := ioutil.ReadFile(parameterFile) + fb, err := os.ReadFile(parameterFile) if err != nil { return "", err } @@ -97,7 +97,7 @@ var userFunctions = map[string]interface{}{ return "", nil }, "getSlotToTest": func(a string) (string, error) { - fb, err := ioutil.ReadFile(parameterFile) + fb, err := os.ReadFile(parameterFile) if err != nil { return "", err } @@ -114,7 +114,7 @@ var userFunctions = map[string]interface{}{ return "", nil }, "getGithubRepo": func(a string) (string, error) { - fb, err := ioutil.ReadFile(parameterFile) + fb, err := os.ReadFile(parameterFile) if err != nil { return "", err } @@ -131,7 +131,7 @@ var userFunctions = map[string]interface{}{ return "", nil }, "getTty": func(a string) (string, error) { - fb, err := ioutil.ReadFile(parameterFile) + fb, err := os.ReadFile(parameterFile) if err != nil { return "", err } diff --git a/plugins/testfetchers/uri/uri.go b/plugins/testfetchers/uri/uri.go index d1f3bcf3..0bd6e230 100644 --- a/plugins/testfetchers/uri/uri.go +++ b/plugins/testfetchers/uri/uri.go @@ -8,8 +8,9 @@ package uri import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" + "os" "strings" "github.com/linuxboot/contest/pkg/test" @@ -97,7 +98,7 @@ func (tf *URI) Fetch(ctx xcontext.Context, params interface{}) (string, []*test. switch scheme { case "", "file": // naively assume that it's OK to read the whole file in memory. - buf, err = ioutil.ReadFile(fetchParams.URI.Path) + buf, err = os.ReadFile(fetchParams.URI.Path) if err != nil { return "", nil, err } @@ -106,7 +107,7 @@ func (tf *URI) Fetch(ctx xcontext.Context, params interface{}) (string, []*test. if err != nil { return "", nil, err } - buf, err = ioutil.ReadAll(resp.Body) + buf, err = io.ReadAll(resp.Body) if err != nil { return "", nil, err } diff --git a/plugins/teststeps/exec/transport/ssh_transport.go b/plugins/teststeps/exec/transport/ssh_transport.go index a5f7768c..4b65422d 100644 --- a/plugins/teststeps/exec/transport/ssh_transport.go +++ b/plugins/teststeps/exec/transport/ssh_transport.go @@ -7,7 +7,6 @@ package transport import ( "fmt" - "io/ioutil" "net" "os" "strconv" @@ -56,7 +55,7 @@ func NewSSHTransport(config SSHTransportConfig) Transport { func (st *SSHTransport) NewProcess(ctx xcontext.Context, bin string, args []string) (Process, error) { var signer ssh.Signer if st.IdentityFile != "" { - key, err := ioutil.ReadFile(st.IdentityFile) + key, err := os.ReadFile(st.IdentityFile) if err != nil { return nil, fmt.Errorf("cannot read private key at %s: %v", st.IdentityFile, err) } diff --git a/plugins/teststeps/sshcmd/sshcmd.go b/plugins/teststeps/sshcmd/sshcmd.go index 545ae45f..70a7b2a7 100644 --- a/plugins/teststeps/sshcmd/sshcmd.go +++ b/plugins/teststeps/sshcmd/sshcmd.go @@ -21,8 +21,8 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" + "os" "regexp" "strconv" "time" @@ -149,7 +149,7 @@ func (ts *SSHCmd) Run( } if privKeyFile != "" { - key, err := ioutil.ReadFile(privKeyFile) + key, err := os.ReadFile(privKeyFile) if err != nil { return fmt.Errorf("cannot read private key at %s: %v", ts.PrivateKeyFile, err) } diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index a7de45e1..a63db76a 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -12,7 +12,6 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "net" "os" "strconv" @@ -389,13 +388,13 @@ func (ts *E2ETestSuite) TestRetries() { waitPort, err := getFreePort() require.NoError(ts.T(), err) - testDescrTemplate, err := ioutil.ReadFile("test-retry.yaml") + testDescrTemplate, err := os.ReadFile("test-retry.yaml") require.NoError(ts.T(), err) templ, err := template.New("test-description").Delims("[[", "]]").Parse(string(testDescrTemplate)) require.NoError(ts.T(), err) - tmpFile, err := ioutil.TempFile("", "") + tmpFile, err := os.CreateTemp("", "") require.NoError(ts.T(), err) defer func() { assert.NoError(ts.T(), tmpFile.Close())