Skip to content

Commit

Permalink
Update go version to 1.23 (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveromahony authored Oct 7, 2024
1 parent c1bbb25 commit e77ecbb
Show file tree
Hide file tree
Showing 21 changed files with 72 additions and 79 deletions.
25 changes: 2 additions & 23 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ linters:
enable:
- bodyclose
- cyclop
- copyloopvar
- contextcheck
- dupl
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- gocheckcompilerdirectives
- gocognit
Expand All @@ -28,7 +28,6 @@ linters:
- godox
- gofumpt
- goheader
- gomnd
- gomoddirectives
- gosec
- grouper
Expand All @@ -40,6 +39,7 @@ linters:
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
Expand Down Expand Up @@ -201,27 +201,6 @@ linters-settings:
This source code is licensed under the Apache License, Version 2.0 license found in the
LICENSE file in the root directory of this source tree.
gomnd:
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
checks:
- argument
- case
- condition
- operation
- return
- assign
# List of numbers to exclude from analysis. The numbers should be written as string.
# Values always ignored: "1", "1.0", "0" and "0.0". Default: []
ignored-numbers: []
# List of file patterns to exclude from analysis. Values always ignored: `.+_test.go`. Default: []
ignored-files: []
# List of function patterns to exclude from analysis.
# Following functions are always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions: []
gomoddirectives:
# Allow local `replace` directives. Default: false
replace-local: false
Expand Down
2 changes: 1 addition & 1 deletion Makefile.tools
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
OAPICODEGEN = github.com/deepmap/oapi-codegen/v2/cmd/[email protected]
LEFTHOOK = github.com/evilmartians/[email protected]
GOLANGCILINT = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
GOLANGCILINT = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
PROTOCGENGO = google.golang.org/protobuf/cmd/[email protected]
GOFUMPT = mvdan.cc/[email protected]
COUNTERFEITER = github.com/maxbrunsfeld/counterfeiter/[email protected]
Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/nginx/agent/v3

go 1.22.0
go 1.23

toolchain go1.22.5
toolchain go1.23.2

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.33.0-20240401165935-b983156c5e99.1
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
go.opentelemetry.io/otel v1.28.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
golang.org/x/mod v0.19.0
golang.org/x/mod v0.21.0
golang.org/x/sync v0.8.0
google.golang.org/protobuf v1.34.2
)
Expand Down Expand Up @@ -113,7 +113,7 @@ require (
github.com/elastic/go-grok v0.3.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/expr-lang/expr v1.16.9 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
Expand Down Expand Up @@ -224,7 +224,7 @@ require (
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
Expand Down Expand Up @@ -297,11 +297,11 @@ require (
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gonum.org/v1/gonum v0.15.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
Expand Down Expand Up @@ -335,7 +335,7 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.28.0
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/grpc v1.65.0
)
29 changes: 14 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ github.com/expr-lang/expr v1.16.9/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
Expand Down Expand Up @@ -715,8 +715,8 @@ github.com/ovh/go-ovh v1.6.0/go.mod h1:cTVDnl94z4tl8pP1uZ/8jlVxntjSIf09bNcQ5TJSC
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
Expand Down Expand Up @@ -822,7 +822,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
Expand Down Expand Up @@ -1041,8 +1040,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand All @@ -1066,8 +1065,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
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/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-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1179,8 +1178,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand All @@ -1203,8 +1202,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -1251,8 +1250,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
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=
Expand Down
2 changes: 1 addition & 1 deletion internal/bus/message_pipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func TestMessagePipe_DeRegister(t *testing.T) {
err = messagePipe.DeRegister(ctx, []string{plugin.Info().Name})

require.NoError(t, err)
assert.Empty(t, len(messagePipe.GetPlugins()))
assert.Empty(t, messagePipe.GetPlugins())
plugin.AssertExpectations(t)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package file

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -57,7 +56,6 @@ func TestGrok_Constructor(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(tt *testing.T) {
fmt.Printf(test.logFormat)
grok, err := NewCompiledGrok(test.logFormat, test.logger)
if test.shouldErr {
require.Error(tt, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ server accepts handled requests
16630948 16630946 31070465
Reading: 6 Writing: 179 Waiting: 106
`))
require.NoError(t, err)
// go-require: do not use require in http handlers (testifylint), using assert instead
assert.NoError(t, err)

return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func validateMessage(validator *protovalidate.Validator, message any) error {

validationErr := validator.Validate(protoMessage)
if validationErr != nil {
return status.Errorf(codes.InvalidArgument, validationErr.Error())
return status.Error(codes.InvalidArgument, validationErr.Error())
}

return nil
Expand Down
1 change: 1 addition & 0 deletions internal/grpc/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
type ClientStream struct{}

func (*ClientStream) Header() (metadata.MD, error) {
// nolint: nilnil
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/resource/nginx_instance_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestInstanceOperator_ReloadAndMonitor(t *testing.T) {
name: "Test 2: Failed reload - error in logs",
errorLogs: errorLogFile.Name(),
errorLogContent: errorLogLine,
expectedErr: errors.Join(fmt.Errorf(errorLogLine)),
expectedErr: errors.Join(fmt.Errorf("%s", errorLogLine)),
},
{
name: "Test 3: Successful reload - no error log",
Expand Down
2 changes: 1 addition & 1 deletion internal/resource/nginx_log_tailer_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (l *NginxLogTailerOperator) Tail(ctx context.Context, errorLog string, erro
select {
case d := <-data:
if l.doesLogLineContainError(d) {
errorChannel <- fmt.Errorf(d)
errorChannel <- fmt.Errorf("%s", d)
return
}
case <-ctxWithTimeout.Done():
Expand Down
4 changes: 2 additions & 2 deletions internal/resource/nginx_log_tailer_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ func TestLogOperator_Tail(t *testing.T) {
errorLogs: errorLogFile.Name(),
errorLogContents: errorLogLine,
err: nil,
expected: errors.Join(fmt.Errorf(errorLogLine)),
expected: errors.Join(fmt.Errorf("%s", errorLogLine)),
},
{
name: "Test 3: Warning in error logs",
out: bytes.NewBufferString(""),
errorLogs: errorLogFile.Name(),
errorLogContents: warningLogLine,
err: nil,
expected: errors.Join(fmt.Errorf(warningLogLine)),
expected: errors.Join(fmt.Errorf("%s", warningLogLine)),
},
}

Expand Down
21 changes: 15 additions & 6 deletions internal/watcher/instance/nginx_config_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,16 +540,19 @@ func TestNginxConfigParser_pingPlusAPIEndpoint(t *testing.T) {
if req.URL.String() == "/good_api" {
data := []byte("[1,2,3,4,5,6,7,8]")
_, err := rw.Write(data)
require.NoError(t, err)
// go-require: do not use require in http handlers (testifylint), using assert instead
assert.NoError(t, err)
} else if req.URL.String() == "/invalid_body_api" {
data := []byte("Invalid")
_, err := rw.Write(data)
require.NoError(t, err)
// go-require: do not use require in http handlers (testifylint), using assert instead
assert.NoError(t, err)
} else {
rw.WriteHeader(http.StatusInternalServerError)
data := []byte("")
_, err := rw.Write(data)
require.NoError(t, err)
// go-require: do not use require in http handlers (testifylint), using assert instead
assert.NoError(t, err)
}
})

Expand Down Expand Up @@ -601,16 +604,22 @@ server accepts handled requests
Reading: 0 Writing: 1 Waiting: 1
`)
_, err := rw.Write(data)
require.NoError(t, err)

// go-require: do not use require in http handlers (testifylint), using assert instead
assert.NoError(t, err)
} else if req.URL.String() == "/invalid_body_api" {
data := []byte("Invalid")
_, err := rw.Write(data)
require.NoError(t, err)

// go-require: do not use require in http handlers (testifylint), using assert instead
assert.NoError(t, err)
} else {
rw.WriteHeader(http.StatusInternalServerError)
data := []byte("")
_, err := rw.Write(data)
require.NoError(t, err)

// go-require: do not use require in http handlers (testifylint), using assert instead
assert.NoError(t, err)
}
})

Expand Down
7 changes: 4 additions & 3 deletions internal/watcher/instance/nginx_process_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
const (
withWithPrefix = "with-"
withModuleSuffix = "module"
keyValueLen = 2
flagLen = 1
)

type (
Expand Down Expand Up @@ -315,12 +317,11 @@ func getNginxConfPath(ctx context.Context, nginxInfo *Info) string {
}

func isFlag(vals []string) bool {
return len(vals) == 1 && vals[0] != ""
return len(vals) == flagLen && vals[0] != ""
}

// nolint: gomnd
func isKeyValueFlag(vals []string) bool {
return len(vals) == 2
return len(vals) == keyValueLen
}

func getLoadableModules(nginxInfo *Info) (modules []string) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/packages/packager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG package_type

FROM docker.io/golang:1.22-bullseye AS base
FROM docker.io/golang:1.23-bullseye AS base

ARG PKG_VER="1.17.5"
ARG PKG_DIR="/tmp/pkg"
Expand Down
2 changes: 1 addition & 1 deletion site/content/installation-upgrade/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Using your preferred method, clone the NGINX Agent repository into your developm

## Install Go

NGINX Agent and the Mock Control Plane are written in Go. Go 1.22.2 or higher is required to build and run either application from the source code directory. You can [download Go from the official website](https://go.dev/dl/).
NGINX Agent and the Mock Control Plane are written in Go. Go 1.23.0 or higher is required to build and run either application from the source code directory. You can [download Go from the official website](https://go.dev/dl/).

## Start the gRPC Mock Control Plane

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Using your preferred method, clone the NGINX Agent repository into your developm

## Install Go

NGINX Agent and the Mock Control Plane are written in Go. Go 1.22.2 or higher is required to build and run either application from the source code directory. You can [download Go from the official website](https://go.dev/dl/).
NGINX Agent and the Mock Control Plane are written in Go. Go 1.23.0 or higher is required to build and run either application from the source code directory. You can [download Go from the official website](https://go.dev/dl/).

## Start the gRPC Mock Control Plane

Expand Down
Loading

0 comments on commit e77ecbb

Please sign in to comment.