Skip to content

Commit

Permalink
Fix lint: upgrade to first version that supports go1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
jkh52 committed Apr 2, 2024
1 parent 10bd6b9 commit 3ad8ed5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ endif
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
INSTALL_LOCATION:=$(shell go env GOPATH)/bin
GOLANGCI_LINT_VERSION ?= 1.51.2
GOLANGCI_LINT_VERSION ?= 1.54.0
GOSEC_VERSION ?= 2.13.1

REGISTRY ?= gcr.io/$(shell gcloud config get-value project)
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/default_route_backend_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewDefaultRouteBackendManager() *DefaultRouteBackendManager {
}

// Backend tries to get a backend that advertises default route, with random selection.
func (dibm *DefaultRouteBackendManager) Backend(ctx context.Context) (Backend, error) {
func (dibm *DefaultRouteBackendManager) Backend(_ context.Context) (Backend, error) {
return dibm.GetRandomBackend()
}

Expand Down
4 changes: 2 additions & 2 deletions tests/agent_disconnect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func clientRequest(c *http.Client, addr string) ([]byte, error) {
return data, nil
}

func createGrpcTunnelClient(ctx context.Context, proxyAddr, addr string) (*http.Client, error) {
func createGrpcTunnelClient(ctx context.Context, proxyAddr, _ string) (*http.Client, error) {
tunnel, err := createSingleUseGrpcTunnel(ctx, proxyAddr)
if err != nil {
return nil, err
Expand All @@ -189,7 +189,7 @@ func createGrpcTunnelClient(ctx context.Context, proxyAddr, addr string) (*http.
return c, nil
}

func createHTTPConnectClient(ctx context.Context, proxyAddr, addr string) (*http.Client, error) {
func createHTTPConnectClient(_ context.Context, proxyAddr, addr string) (*http.Client, error) {
conn, err := net.Dial("unix", proxyAddr)
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions tests/framework/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func (a *externalAgent) waitForLiveness() error {
}

func agentOptions(t testing.TB, opts AgentOpts) (*agentopts.GrpcProxyAgentOptions, error) {
t.Helper()
o := agentopts.NewGrpcProxyAgentOptions()

host, port, err := net.SplitHostPort(opts.ServerAddr)
Expand Down
1 change: 1 addition & 0 deletions tests/framework/proxy_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (ps *inProcessProxyServer) Metrics() metricstest.ServerTester {
}

func serverOptions(t testing.TB, opts ProxyServerOpts) (*serveropts.ProxyRunOptions, error) {
t.Helper()
o := serveropts.NewProxyRunOptions()

o.ServerCount = uint(opts.ServerCount)
Expand Down
6 changes: 3 additions & 3 deletions tests/ha_proxy_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type tcpLB struct {
backends []string
}

func copy(wc io.WriteCloser, r io.Reader) {
func ioCopy(wc io.WriteCloser, r io.Reader) {
defer wc.Close()
io.Copy(wc, r)
}
Expand All @@ -48,8 +48,8 @@ func (lb *tcpLB) handleConnection(in net.Conn, backend string) {
lb.t.Log(err)
return
}
go copy(out, in)
go copy(in, out)
go ioCopy(out, in)
go ioCopy(in, out)
}

func (lb *tcpLB) serve(stopCh chan struct{}) string {
Expand Down
6 changes: 3 additions & 3 deletions tests/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func newSizedServer(length, chunks int) *testServer {
}
}

func (s *testServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
func (s *testServer) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
for i := 0; i < s.chunks; i++ {
w.Write(s.echo)
}
Expand All @@ -94,7 +94,7 @@ func newWaitingServer() *waitingServer {
}
}

func (s *waitingServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (s *waitingServer) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
close(s.requestReceivedCh)
<-s.respondCh // Wait for permission to respond.
w.Write([]byte("hello"))
Expand All @@ -114,7 +114,7 @@ func newDelayedServer() *delayedServer {

var _ = newDelayedServer() // Suppress unused lint error.

func (s *delayedServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (s *delayedServer) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
delay := time.Duration(rand.Int63n(int64(s.maxWait-s.minWait))) + s.minWait /* #nosec G404 */
time.Sleep(delay)
w.Write([]byte("hello"))
Expand Down

0 comments on commit 3ad8ed5

Please sign in to comment.