From bdf94e6fe0ac16189546008c35e0f00e7b975fb3 Mon Sep 17 00:00:00 2001 From: TJ Moore Date: Wed, 11 Mar 2026 17:33:27 -0400 Subject: [PATCH] Address Go linter issues --- hack/extract-licenses.go | 2 -- internal/collector/postgres_metrics.go | 2 +- internal/controller/standalone_pgadmin/users.go | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hack/extract-licenses.go b/hack/extract-licenses.go index 4153b20466..9d93ec1201 100644 --- a/hack/extract-licenses.go +++ b/hack/extract-licenses.go @@ -104,7 +104,6 @@ the environment: https://go.dev/ref/mod#module-cache`, err = os.WriteFile(destination, data, 0o600) } if err == nil { - //nolint:gosec // G705: Output is file paths, not user input rendered in HTML. fmt.Fprintln(os.Stdout, license, "=>", destination) } if err != nil { @@ -234,7 +233,6 @@ func identifyModules(ctx context.Context, executables ...string) []string { // The `go version -m` command returns no information for empty files, and it // is possible for a Go executable to have no main module and no dependencies. if len(result) == 0 { - //nolint:gosec // G705: Output is file paths, not user input rendered in HTML. fmt.Fprintf(os.Stderr, "no Go modules in %v\n", executables) os.Exit(0) } diff --git a/internal/collector/postgres_metrics.go b/internal/collector/postgres_metrics.go index fe4202fb4b..7fc46cf943 100644 --- a/internal/collector/postgres_metrics.go +++ b/internal/collector/postgres_metrics.go @@ -256,7 +256,7 @@ func EnablePostgresMetrics(ctx context.Context, inCluster *v1beta1.PostgresClust // appendToJSONArray appends elements of a json.RawMessage containing an array // to another json.RawMessage containing an array. func appendToJSONArray(a1, a2 json.RawMessage) (json.RawMessage, error) { - var slc1 []json.RawMessage + var slc1 []json.RawMessage //nolint:prealloc // Populated by json.Unmarshal, not manual appends. if err := json.Unmarshal(a1, &slc1); err != nil { return nil, err } diff --git a/internal/controller/standalone_pgadmin/users.go b/internal/controller/standalone_pgadmin/users.go index e382c8fb11..36a76bb899 100644 --- a/internal/controller/standalone_pgadmin/users.go +++ b/internal/controller/standalone_pgadmin/users.go @@ -36,7 +36,6 @@ type pgAdminUserForJson struct { IsAdmin bool `json:"isAdmin"` // The user's password - //nolint:gosec // G117: This is a JSON serialization struct, not a hardcoded credential. Password string `json:"password"` // The username for User in pgAdmin. @@ -333,6 +332,8 @@ cd $PGADMIN_DIR // to add a user, that user will not be in intentUsers. If errors occurred when attempting to // update a user, the user will be in intentUsers as it existed before. We now want to marshal the // intentUsers to json and write the users.json file to the secret. + + //nolint:gosec // G117: Password is intentionally stored in a Kubernetes Secret. intentUserSecret.Data["users.json"], _ = json.Marshal(intentUsers) err = errors.WithStack(r.setControllerReference(pgadmin, intentUserSecret))