Skip to content

Commit 4e13dbb

Browse files
authored
Merge pull request #745 from cheftako/release-0.30
Cherry-pick 0.30: Bump golangci/golangci-lint-action from 6 to 8
2 parents 23b4594 + de189cc commit 4e13dbb

File tree

21 files changed

+111
-67
lines changed

21 files changed

+111
-67
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release-0.31
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
GO_VERSION: v1.22
14+
GOLANGCI_LINT_VERSION: v2.1.6
15+
16+
jobs:
17+
golangci:
18+
name: lint
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-go@v5
23+
with:
24+
go-version: ${{ env.GO_VERSION }}
25+
- name: golangci-lint
26+
uses: golangci/golangci-lint-action@v8
27+
with:
28+
version: ${{ env.GOLANGCI_LINT_VERSION }}
29+
args: --verbose --timeout=2m

.golangci.yaml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
1-
run:
2-
timeout: 3m
3-
skip-dirs:
4-
- vendor
1+
version: "2"
52
linters:
6-
disable-all: true
3+
default: none
74
enable:
8-
- gofmt
9-
- revive
10-
- gosec
11-
- govet
12-
- unused
5+
- gosec
6+
- govet
7+
- revive
8+
- unused
9+
exclusions:
10+
generated: lax
11+
presets:
12+
- comments
13+
- common-false-positives
14+
- legacy
15+
- std-error-handling
16+
rules:
17+
- linters:
18+
- gosec
19+
path: _test\.go
20+
- linters:
21+
- gosec
22+
path: ^tests/
23+
paths:
24+
- third_party$
25+
- builtin$
26+
- examples$
1327
issues:
1428
fix: true
15-
exclude-rules:
16-
# Don't run security checks on test files
17-
- path: _test\.go
18-
linters:
19-
- gosec
20-
- path: ^tests/
21-
linters:
22-
- gosec
29+
formatters:
30+
enable:
31+
- gofmt
32+
exclusions:
33+
generated: lax
34+
paths:
35+
- third_party$
36+
- builtin$
37+
- examples$

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ endif
3434
GOOS ?= $(shell go env GOOS)
3535
GOARCH ?= $(shell go env GOARCH)
3636
INSTALL_LOCATION:=$(shell go env GOPATH)/bin
37-
GOLANGCI_LINT_VERSION ?= 1.54.0
37+
GOLANGCI_LINT_VERSION ?= 2.1.6
3838
GOSEC_VERSION ?= 2.13.1
3939

4040
REGISTRY ?= gcr.io/$(shell gcloud config get-value project)

artifacts/images/agent-build.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG GO_TOOLCHAIN
55
ARG GO_VERSION
66
ARG BASEIMAGE
77

8-
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} as builder
8+
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} AS builder
99

1010
# Copy in the go src
1111
WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy

artifacts/images/server-build.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG GO_TOOLCHAIN
55
ARG GO_VERSION
66
ARG BASEIMAGE
77

8-
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} as builder
8+
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} AS builder
99

1010
# Copy in the go src
1111
WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy

artifacts/images/test-client-build.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG GO_TOOLCHAIN
55
ARG GO_VERSION
66
ARG BASEIMAGE
77

8-
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} as builder
8+
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} AS builder
99

1010
# Copy in the go src
1111
WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy

artifacts/images/test-server-build.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG GO_TOOLCHAIN
55
ARG GO_VERSION
66
ARG BASEIMAGE
77

8-
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} as builder
8+
FROM --platform=linux/${BUILDARCH} ${GO_TOOLCHAIN}:${GO_VERSION} AS builder
99

1010
# Copy in the go src
1111
WORKDIR /go/src/sigs.k8s.io/apiserver-network-proxy

cmd/agent/app/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func NewAgentCommand(a *Agent, o *options.GrpcProxyAgentOptions) *cobra.Command
4848
cmd := &cobra.Command{
4949
Use: "agent",
5050
Long: `A gRPC agent, Connects to the proxy and then allows traffic to be forwarded to it.`,
51-
RunE: func(cmd *cobra.Command, args []string) error {
51+
RunE: func(_ *cobra.Command, _ []string) error {
5252
stopCh := make(chan struct{})
5353
return a.Run(o, stopCh)
5454
},
@@ -113,7 +113,7 @@ func (a *Agent) runProxyConnection(o *options.GrpcProxyAgentOptions, stopCh <-ch
113113
}
114114

115115
func (a *Agent) runHealthServer(o *options.GrpcProxyAgentOptions, cs agent.ReadinessManager) error {
116-
livenessHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
116+
livenessHandler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
117117
fmt.Fprintf(w, "ok")
118118
})
119119

cmd/server/app/options/options.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type ProxyRunOptions struct {
7474
// ID of this proxy server.
7575
ServerID string
7676
// Number of proxy server instances, should be 1 unless it is a HA proxy server.
77-
ServerCount uint
77+
ServerCount int
7878
// Agent pod's namespace for token-based agent authentication
7979
AgentNamespace string
8080
// Agent pod's service account for token-based agent authentication
@@ -128,7 +128,7 @@ func (o *ProxyRunOptions) Flags() *pflag.FlagSet {
128128
flags.BoolVar(&o.EnableProfiling, "enable-profiling", o.EnableProfiling, "enable pprof at host:admin-port/debug/pprof")
129129
flags.BoolVar(&o.EnableContentionProfiling, "enable-contention-profiling", o.EnableContentionProfiling, "enable contention profiling at host:admin-port/debug/pprof/block. \"--enable-profiling\" must also be set.")
130130
flags.StringVar(&o.ServerID, "server-id", o.ServerID, "The unique ID of this server. Can also be set by the 'PROXY_SERVER_ID' environment variable.")
131-
flags.UintVar(&o.ServerCount, "server-count", o.ServerCount, "The number of proxy server instances, should be 1 unless it is an HA server.")
131+
flags.IntVar(&o.ServerCount, "server-count", o.ServerCount, "The number of proxy server instances, should be 1 unless it is an HA server.")
132132
flags.StringVar(&o.AgentNamespace, "agent-namespace", o.AgentNamespace, "Expected agent's namespace during agent authentication (used with agent-service-account, authentication-audience, kubeconfig).")
133133
flags.StringVar(&o.AgentServiceAccount, "agent-service-account", o.AgentServiceAccount, "Expected agent's service account during agent authentication (used with agent-namespace, authentication-audience, kubeconfig).")
134134
flags.StringVar(&o.KubeconfigPath, "kubeconfig", o.KubeconfigPath, "absolute path to the kubeconfig file (used with agent-namespace, agent-service-account, authentication-audience).")

cmd/server/app/options/options_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestDefaultServerOptions(t *testing.T) {
5252
assertDefaultValue(t, "FrontendKeepaliveTime", defaultServerOptions.FrontendKeepaliveTime, 1*time.Hour)
5353
assertDefaultValue(t, "EnableProfiling", defaultServerOptions.EnableProfiling, false)
5454
assertDefaultValue(t, "EnableContentionProfiling", defaultServerOptions.EnableContentionProfiling, false)
55-
assertDefaultValue(t, "ServerCount", defaultServerOptions.ServerCount, uint(1))
55+
assertDefaultValue(t, "ServerCount", defaultServerOptions.ServerCount, 1)
5656
assertDefaultValue(t, "AgentNamespace", defaultServerOptions.AgentNamespace, "")
5757
assertDefaultValue(t, "AgentServiceAccount", defaultServerOptions.AgentServiceAccount, "")
5858
assertDefaultValue(t, "KubeconfigPath", defaultServerOptions.KubeconfigPath, "")

0 commit comments

Comments
 (0)