Skip to content

Update dependency golangci/golangci-lint to v2.3.0 #3649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
working-directory: ${{ matrix.directory }}
version: v2.2.2 # renovate: datasource=github-tags depName=golangci/golangci-lint
version: v2.3.0 # renovate: datasource=github-tags depName=golangci/golangci-lint

njs-lint:
name: NJS Lint
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
- javascript

- repo: https://github.com/golangci/golangci-lint
rev: v2.2.2
rev: v2.3.0
hooks:
- id: golangci-lint-full
name: golangci-lint-root
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GO_LINKER_FLAGS = $(GO_LINKER_FLAGS_OPTIMIZATIONS) $(GO_LINKER_FlAGS_VARS)

# tools versions
# renovate: datasource=github-tags depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION = v2.2.2
GOLANGCI_LINT_VERSION = v2.3.0
# renovate: datasource=docker depName=kindest/node
KIND_K8S_VERSION = v1.33.2
# renovate: datasource=github-tags depName=norwoodj/helm-docs
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/nginx/agent/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func NewServer(

// Start is a runnable that starts the gRPC server for communicating with the nginx agent.
func (g *Server) Start(ctx context.Context) error {
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", g.port))
var lc net.ListenConfig
listener, err := lc.Listen(ctx, "tcp", fmt.Sprintf(":%d", g.port))
if err != nil {
return err
}
Expand Down
11 changes: 7 additions & 4 deletions tests/framework/collector.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package framework

import (
"context"
"fmt"
"os/exec"

Expand All @@ -17,18 +18,20 @@ const (

// InstallCollector installs the otel-collector.
func InstallCollector() ([]byte, error) {
ctx := context.Background()
repoAddArgs := []string{
"repo",
"add",
"open-telemetry",
"https://open-telemetry.github.io/opentelemetry-helm-charts",
}

if output, err := exec.Command("helm", repoAddArgs...).CombinedOutput(); err != nil {
if output, err := exec.CommandContext(ctx, "helm", repoAddArgs...).CombinedOutput(); err != nil {
return output, err
}

if output, err := exec.Command(
if output, err := exec.CommandContext(
ctx,
"helm",
"repo",
"update",
Expand All @@ -47,7 +50,7 @@ func InstallCollector() ([]byte, error) {
"--wait",
}

return exec.Command("helm", args...).CombinedOutput()
return exec.CommandContext(ctx, "helm", args...).CombinedOutput()
}

// UninstallCollector uninstalls the otel-collector.
Expand All @@ -57,7 +60,7 @@ func UninstallCollector(resourceManager ResourceManager) ([]byte, error) {
"--namespace", CollectorNamespace,
}

output, err := exec.Command("helm", args...).CombinedOutput()
output, err := exec.CommandContext(context.Background(), "helm", args...).CombinedOutput()
if err != nil {
return output, err
}
Expand Down
22 changes: 16 additions & 6 deletions tests/framework/ngf.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ type InstallationConfig struct {
func InstallGatewayAPI(apiVersion string) ([]byte, error) {
apiPath := fmt.Sprintf("%s/v%s/standard-install.yaml", gwInstallBasePath, apiVersion)

if output, err := exec.Command("kubectl", "apply", "-f", apiPath).CombinedOutput(); err != nil {
cmd := exec.CommandContext(
context.Background(),
"kubectl", "apply", "-f", apiPath,
)
output, err := cmd.CombinedOutput()
if err != nil {
return output, err
}

Expand All @@ -53,7 +58,7 @@ func InstallGatewayAPI(apiVersion string) ([]byte, error) {
func UninstallGatewayAPI(apiVersion string) ([]byte, error) {
apiPath := fmt.Sprintf("%s/v%s/standard-install.yaml", gwInstallBasePath, apiVersion)

output, err := exec.Command("kubectl", "delete", "-f", apiPath).CombinedOutput()
output, err := exec.CommandContext(context.Background(), "kubectl", "delete", "-f", apiPath).CombinedOutput()
if err != nil && !strings.Contains(string(output), "not found") {
return output, err
}
Expand Down Expand Up @@ -84,7 +89,7 @@ func InstallNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {

GinkgoWriter.Printf("Installing NGF with command: helm %v\n", strings.Join(fullArgs, " "))

return exec.Command("helm", fullArgs...).CombinedOutput()
return exec.CommandContext(context.Background(), "helm", fullArgs...).CombinedOutput()
}

// CreateLicenseSecret creates the NGINX Plus JWT secret.
Expand Down Expand Up @@ -127,7 +132,12 @@ func CreateLicenseSecret(k8sClient client.Client, namespace, filename string) er
// UpgradeNGF upgrades NGF. CRD upgrades assume the chart is local.
func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {
crdPath := filepath.Join(cfg.ChartPath, "crds") + "/"
if output, err := exec.Command("kubectl", "apply", "-f", crdPath).CombinedOutput(); err != nil {
cmd := exec.CommandContext(
context.Background(),
"kubectl", "apply", "-f", crdPath,
)
output, err := cmd.CombinedOutput()
if err != nil {
return output, err
}

Expand All @@ -152,7 +162,7 @@ func UpgradeNGF(cfg InstallationConfig, extraArgs ...string) ([]byte, error) {

GinkgoWriter.Printf("Upgrading NGF with command: helm %v\n", strings.Join(fullArgs, " "))

return exec.Command("helm", fullArgs...).CombinedOutput()
return exec.CommandContext(context.Background(), "helm", fullArgs...).CombinedOutput()
}

// UninstallNGF uninstalls NGF.
Expand All @@ -161,7 +171,7 @@ func UninstallNGF(cfg InstallationConfig, k8sClient client.Client) ([]byte, erro
"uninstall", cfg.ReleaseName, "--namespace", cfg.Namespace,
}

output, err := exec.Command("helm", args...).CombinedOutput()
output, err := exec.CommandContext(context.Background(), "helm", args...).CombinedOutput()
if err != nil && !strings.Contains(string(output), "release: not found") {
return output, err
}
Expand Down
6 changes: 4 additions & 2 deletions tests/framework/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package framework

import (
"bytes"
"context"
"fmt"
"log/slog"
"net/http"
Expand Down Expand Up @@ -49,9 +50,10 @@ func PortForward(config *rest.Config, namespace, podName string, ports []string,

go func() {
for {
ctx := context.Background()
if err := forward(); err != nil {
slog.Error("error forwarding ports", "error", err)
slog.Info("retrying port forward in 1s...")
slog.ErrorContext(ctx, "error forwarding ports", "error", err)
slog.InfoContext(ctx, "retrying port forward in 1s...")
}

select {
Expand Down
17 changes: 11 additions & 6 deletions tests/framework/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ func InstallPrometheus(
rm ResourceManager,
cfg PrometheusConfig,
) (PrometheusInstance, error) {
output, err := exec.Command(
ctx := context.Background()
output, err := exec.CommandContext(
ctx,
"helm",
"repo",
"add",
Expand All @@ -50,7 +52,8 @@ func InstallPrometheus(
return PrometheusInstance{}, fmt.Errorf("failed to add Prometheus helm repo: %w; output: %s", err, string(output))
}

output, err = exec.Command(
output, err = exec.CommandContext(
ctx,
"helm",
"repo",
"update",
Expand All @@ -62,7 +65,8 @@ func InstallPrometheus(
scrapeInterval := fmt.Sprintf("%ds", int(cfg.ScrapeInterval.Seconds()))

//nolint:gosec
output, err = exec.Command(
output, err = exec.CommandContext(
ctx,
"helm",
"install",
prometheusReleaseName,
Expand Down Expand Up @@ -110,7 +114,8 @@ func InstallPrometheus(

// UninstallPrometheus uninstalls Prometheus from the cluster.
func UninstallPrometheus(rm ResourceManager) error {
output, err := exec.Command(
output, err := exec.CommandContext(
context.Background(),
"helm",
"uninstall",
prometheusReleaseName,
Expand Down Expand Up @@ -208,7 +213,7 @@ func (ins *PrometheusInstance) QueryWithCtx(ctx context.Context, query string) (
}

if len(warnings) > 0 {
slog.Info(
slog.InfoContext(context.Background(),
"Prometheus query returned warnings",
"query", query,
"warnings", warnings,
Expand Down Expand Up @@ -240,7 +245,7 @@ func (ins *PrometheusInstance) QueryRangeWithCtx(ctx context.Context,
}

if len(warnings) > 0 {
slog.Info(
slog.InfoContext(context.Background(),
"Prometheus range query returned warnings",
"query", query,
"range", promRange,
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/results.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package framework

import (
"context"
"encoding/csv"
"fmt"
"io"
Expand Down Expand Up @@ -77,7 +78,7 @@ func generatePNG(resultsDir, inputFilename, outputFilename, configFilename strin
gnuplotCfg := filepath.Join(filepath.Dir(pwd), "scripts", configFilename)

files := fmt.Sprintf("inputfile='%s';outputfile='%s'", inputFilename, outputFilename)
cmd := exec.Command("gnuplot", "-e", files, "-c", gnuplotCfg)
cmd := exec.CommandContext(context.Background(), "gnuplot", "-e", files, "-c", gnuplotCfg)
cmd.Dir = resultsDir

output, err := cmd.CombinedOutput()
Expand Down