From d407c1c337232176eb5c0f77be9a8275e84e66ef Mon Sep 17 00:00:00 2001 From: Mikolaj Stefaniak Date: Fri, 13 Dec 2024 11:03:22 +0100 Subject: [PATCH] chore: go upgrade in workflows --- .github/workflows/build.yml | 4 ++-- .github/workflows/documentation.yml | 2 +- .github/workflows/release.yml | 2 +- DEVELOPMENT.md | 2 +- README.md | 2 +- docs/user-guide.md | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- internal/app/app.go | 4 ++-- internal/app/app_check_clusters.go | 2 +- internal/app/app_config.go | 8 ++++---- internal/app/app_config_test.go | 2 +- internal/app/app_scc.go | 6 +++--- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61613bf9..8906a256 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - name: Get dependencies run: go mod download @@ -45,5 +45,5 @@ jobs: - name: Lint uses: dominikh/staticcheck-action@v1.3.1 with: - version: "2023.1.7" + version: "2024.1.1" install-go: false diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index d107f7cd..65e4e122 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -53,7 +53,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - name: Get dependencies run: go mod download diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3719eec..530efd37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - name: Import GPG key id: import_gpg diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 8d4b4d5e..0c41a361 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -2,7 +2,7 @@ ## Requirements -* [Go](https://go.dev/doc/install) 1.22 or newer (to build the application) +* [Go](https://go.dev/doc/install) 1.23 or newer (to build the application) * [GNU Make](https://www.gnu.org/software/make) (to build and test easier) * [Open Policy Agent](https://www.openpolicyagent.org/docs/latest/#1-download-opa) (to test REGO policies) diff --git a/README.md b/README.md index 7975a441..addc1cdc 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Binaries for Linux, Windows and Mac are available as tarballs in the ### Source code -Go [v1.22](https://go.dev/doc/install) or newer is required. Check the [development guide](./DEVELOPMENT.md) +Go [v1.23](https://go.dev/doc/install) or newer is required. Check the [development guide](./DEVELOPMENT.md) for more details. ```sh diff --git a/docs/user-guide.md b/docs/user-guide.md index 66e7fe79..e8e60dd8 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -61,7 +61,7 @@ Binaries for Linux, Windows and Mac are available as tarballs in the ### Source code -Go [v1.22](https://go.dev/doc/install) or newer is required. Check the [development guide](../DEVELOPMENT.md) +Go [v1.23](https://go.dev/doc/install) or newer is required. Check the [development guide](../DEVELOPMENT.md) for more details. ```sh diff --git a/go.mod b/go.mod index a11bf4cb..2712625e 100644 --- a/go.mod +++ b/go.mod @@ -121,14 +121,14 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect go.opentelemetry.io/otel/trace v1.33.0 // indirect golang.org/x/crypto v0.30.0 // indirect - golang.org/x/mod v0.21.0 // indirect + golang.org/x/mod v0.22.0 // indirect golang.org/x/net v0.32.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.8.0 // indirect - golang.org/x/tools v0.26.0 // indirect + golang.org/x/tools v0.28.0 // indirect google.golang.org/genproto v0.0.0-20241209162323-e6fa225c2576 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect diff --git a/go.sum b/go.sum index f56bfbdf..8744d852 100644 --- a/go.sum +++ b/go.sum @@ -360,8 +360,8 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 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.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 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-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -416,8 +416,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/app/app.go b/internal/app/app.go index 622fd89d..72dac08a 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -171,7 +171,7 @@ func (p *PolicyAutomationApp) ClusterJSONData() error { return errors[0] } val, err := json.MarshalIndent(clusterData, "", " ") - log.Debugf("[DEBUG] cluster: " + string(val)) + log.Debugf("[DEBUG] cluster: %s", string(val)) for _, cluster := range clusterData { @@ -184,7 +184,7 @@ func (p *PolicyAutomationApp) ClusterJSONData() error { if err != nil { log.Debugf("could not format cluster details: %s", err) } - log.Debugf("cluster: " + string(val)) + log.Debugf("cluster: %s", string(val)) for _, dumpCollector := range p.clusterDumpCollectors { log.Debugf("registering cluster data with cluster dump collector %s", reflect.TypeOf(dumpCollector).String()) diff --git a/internal/app/app_check_clusters.go b/internal/app/app_check_clusters.go index 07bb7a02..16e36ecb 100644 --- a/internal/app/app_check_clusters.go +++ b/internal/app/app_check_clusters.go @@ -152,7 +152,7 @@ func (p *PolicyAutomationApp) evaluateClusters(regoPackageBases []string) error return errors[0] } val, _ := json.MarshalIndent(clusterData, "", " ") - log.Debugf("[DEBUG] cluster: " + string(val)) + log.Debugf("[DEBUG] cluster: %s", string(val)) evalResults := &evaluationResults{} for _, cluster := range clusterData { diff --git a/internal/app/app_config.go b/internal/app/app_config.go index e1a43f8d..3a4d3145 100644 --- a/internal/app/app_config.go +++ b/internal/app/app_config.go @@ -80,10 +80,10 @@ func (p *PolicyAutomationApp) loadInputsConfig(config *cfg.Config) error { if err := p.loadGKELocalInputConfig(config.Inputs.GKELocalInput); err != nil { return err } - if err := p.loadK8SApiInputConfig(config.Inputs.K8sAPI, config.CredentialsFile); err != nil { + if err := p.loadK8SApiInputConfig(config.Inputs.K8sAPI); err != nil { return err } - if err := p.loadMetricsAPIInputConfig(config.Inputs.MetricsAPI, config.CredentialsFile); err != nil { + if err := p.loadMetricsAPIInputConfig(config.Inputs.MetricsAPI); err != nil { return err } return nil @@ -114,7 +114,7 @@ func (p *PolicyAutomationApp) loadGKELocalInputConfig(config *cfg.GKELocalInput) return nil } -func (p *PolicyAutomationApp) loadK8SApiInputConfig(config *cfg.K8SAPIInput, credentialsFile string) error { +func (p *PolicyAutomationApp) loadK8SApiInputConfig(config *cfg.K8SAPIInput) error { if config == nil || !config.Enabled { return nil } @@ -128,7 +128,7 @@ func (p *PolicyAutomationApp) loadK8SApiInputConfig(config *cfg.K8SAPIInput, cre return nil } -func (p *PolicyAutomationApp) loadMetricsAPIInputConfig(config *cfg.MetricsAPIInput, credentialsFile string) error { +func (p *PolicyAutomationApp) loadMetricsAPIInputConfig(config *cfg.MetricsAPIInput) error { if config == nil || !config.Enabled { return nil } diff --git a/internal/app/app_config_test.go b/internal/app/app_config_test.go index 3b94ddbc..f7c62dec 100644 --- a/internal/app/app_config_test.go +++ b/internal/app/app_config_test.go @@ -55,7 +55,7 @@ func TestLoadCliConfig_file(t *testing.T) { func TestLoadCliConfig_with_validation(t *testing.T) { validationErrMsg := "wrong validation" validateFnMock := func(config cfg.Config) error { - return fmt.Errorf(validationErrMsg) + return fmt.Errorf("%s", validationErrMsg) } cliConfig := &CliConfig{} pa := PolicyAutomationApp{ctx: context.Background()} diff --git a/internal/app/app_scc.go b/internal/app/app_scc.go index b2ad3b73..d5add178 100644 --- a/internal/app/app_scc.go +++ b/internal/app/app_scc.go @@ -53,15 +53,15 @@ func (p *PolicyAutomationApp) ConfigureSCC(orgNumber string) error { consoleInfoColorF("GKE Policy Automation was not found in SCC, creating it..."), ) log.Info("Creating GKE Policy Automation in SCC") - *id, err = cli.CreateSource() + newId, err := cli.CreateSource() if err != nil { p.out.ErrorPrint("could not create GKE Policy Automation source in SCC", err) return err } p.out.Printf("%s %s\n", outputs.IconMagnifier, - consoleInfoColorF("Created GKE Policy Automation in SCC... [%s]", *id), + consoleInfoColorF("Created GKE Policy Automation in SCC... [%s]", newId), ) - log.Infof("Created GKE Policy Automation in SCC: %s", *id) + log.Infof("Created GKE Policy Automation in SCC: %s", newId) return nil }