Skip to content

Commit

Permalink
Update agent to golang 1.22 (#344)
Browse files Browse the repository at this point in the history
* Update agent to golang 1.22

* golangci-lint fixes
  • Loading branch information
CDimonaco authored Oct 1, 2024
1 parent 5208bcb commit e4f9187
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 41 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: 1.22
- uses: actions/[email protected]
id: go-cache
with:
Expand All @@ -49,7 +49,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.48.0
version: v1.59.1
skip-cache: true
args: "--timeout=3m"

Expand All @@ -71,7 +71,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: 1.22
- uses: actions/[email protected]
id: go-cache
with:
Expand All @@ -94,7 +94,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: 1.22
- uses: actions/[email protected]
id: go-cache
with:
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: 1.22
- uses: actions/[email protected]
id: go-cache
with:
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
osc checkout $OBS_PROJECT trento-agent -o $OSC_CHECKOUT_DIR
cp $FOLDER/_service $OSC_CHECKOUT_DIR
rm -v $OSC_CHECKOUT_DIR/*.tar.gz
pushd $OSC_CHECKOUT_DIR
pushd $OSC_CHECKOUT_DIR
osc service manualrun
cp /__w/agent/agent/vendor.tar.gz .
- name: prepare trento-agent.changes file
Expand Down
6 changes: 0 additions & 6 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
linters:
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
# - asasalint
- containedctx
# - cyclop
- depguard
- dogsled
- dupl
- durationcheck
Expand All @@ -31,14 +27,12 @@ linters:
- gomoddirectives
- gomodguard
- gosec
- ifshort
- importas
- lll
- misspell
- nilerr
- nilnil
- nonamedreturns
- nosnakecase
- prealloc
- predeclared
- revive
Expand Down
5 changes: 3 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
golang 1.18.1
mockery 2.32.3
golang 1.22.5
mockery 2.32.3
golangci-lint 1.59.1
2 changes: 1 addition & 1 deletion cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (suite *AgentCmdTestSuite) SetupTest() {
cmd := cmd.NewRootCmd()

for _, command := range cmd.Commands() {
command.Run = func(cmd *cobra.Command, args []string) {
command.Run = func(_ *cobra.Command, _ []string) {
// do nothing
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func NewAgentIDCmd() *cobra.Command {
idCmd := &cobra.Command{ //nolint
Use: "id",
Short: "Print the agent identifier",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
agentID, err := agent.GetAgentID(afero.NewOsFs())
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func NewVersionCmd() *cobra.Command {
Use: "version",
Short: "Print the version number of Trento",
Long: `All software has versions. This is Trento's`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
fmt.Printf("Trento installed from %s version %s\nbuilt with %s %s/%s\n", version.InstallationSource, version.Version, runtime.Version(), runtime.GOOS, runtime.GOARCH) //nolint
},
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/trento-project/agent

go 1.18
go 1.22

require (
github.com/clbanning/mxj/v2 v2.5.7
Expand Down
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/Showmax/go-fqdn v1.0.0 h1:0rG5IbmVliNT5O19Mfuvna9LL7zlHyRfsSvBPZmF9tM=
github.com/Showmax/go-fqdn v1.0.0/go.mod h1:SfrFBzmDCtCGrnHhoDjuvFnKsWjEQX/Q9ARZvOrJAko=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chigopher/pathlib v1.0.0 h1:SbsCrFX4vDf4M2d8mT/RTzuVlKOjTKoPHK0HidsQFak=
github.com/chigopher/pathlib v1.0.0/go.mod h1:3+YPPV21mU9vyw8Mjp+F33CyCfE6iOzinpiqBcccv7I=
Expand Down Expand Up @@ -71,6 +72,7 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
Expand Down Expand Up @@ -121,6 +123,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand Down Expand Up @@ -164,6 +167,7 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo=
github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
Expand All @@ -172,9 +176,11 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand All @@ -195,6 +201,7 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
Expand All @@ -211,6 +218,7 @@ github.com/rabbitmq/amqp091-go v1.3.4 h1:tXuIslN1nhDqs2t6Jrz3BAoqvt4qIZzxvdbdcxW
github.com/rabbitmq/amqp091-go v1.3.4/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w=
github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
Expand Down Expand Up @@ -584,6 +592,7 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
Expand Down
14 changes: 7 additions & 7 deletions internal/factsengine/factscache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ func (suite *FactsCacheTestSuite) SetupTest() {
// nolint:errcheck
func (suite *FactsCacheTestSuite) TestEntries() {
cache := factscache.NewFactsCache()
cache.GetOrUpdate("entry1", func(args ...interface{}) (interface{}, error) {
cache.GetOrUpdate("entry1", func(_ ...interface{}) (interface{}, error) {
return "", nil
})
cache.GetOrUpdate("entry2", func(args ...interface{}) (interface{}, error) {
cache.GetOrUpdate("entry2", func(_ ...interface{}) (interface{}, error) {
return "", nil
})
entries := cache.Entries()
Expand All @@ -45,7 +45,7 @@ func (suite *FactsCacheTestSuite) TestEntries() {
func (suite *FactsCacheTestSuite) TestGetOrUpdate() {
cache := factscache.NewFactsCache()

updateFunc := func(args ...interface{}) (interface{}, error) {
updateFunc := func(_ ...interface{}) (interface{}, error) {
return suite.returnValue, nil
}

Expand All @@ -59,7 +59,7 @@ func (suite *FactsCacheTestSuite) TestGetOrUpdateWithError() {
cache := factscache.NewFactsCache()
someError := "some error"

updateFunc := func(args ...interface{}) (interface{}, error) {
updateFunc := func(_ ...interface{}) (interface{}, error) {
return nil, fmt.Errorf(someError)
}

Expand All @@ -71,7 +71,7 @@ func (suite *FactsCacheTestSuite) TestGetOrUpdateWithError() {
func (suite *FactsCacheTestSuite) TestGetOrUpdateCacheHit() {
cache := factscache.NewFactsCache()

updateFunc := func(args ...interface{}) (interface{}, error) {
updateFunc := func(_ ...interface{}) (interface{}, error) {
suite.count++
return suite.returnValue, nil
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func (suite *FactsCacheTestSuite) TestGetOrUpdateCacheConcurrent() {
}

func (suite *FactsCacheTestSuite) TestPureGetOrUpdate() {
updateFunc := func(args ...interface{}) (interface{}, error) {
updateFunc := func(_ ...interface{}) (interface{}, error) {
suite.count++
return suite.returnValue, nil
}
Expand All @@ -158,7 +158,7 @@ func (suite *FactsCacheTestSuite) TestPureGetOrUpdate() {
func (suite *FactsCacheTestSuite) TestPureGetOrUpdateCacheHit() {
cache := factscache.NewFactsCache()

updateFunc := func(args ...interface{}) (interface{}, error) {
updateFunc := func(_ ...interface{}) (interface{}, error) {
suite.count++
return suite.returnValue, nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/factsengine/gatherers/ascsers_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (suite *AscsErsClusterTestSuite) TestAscsErsClusterGatherCmdNotFound() {

func (suite *AscsErsClusterTestSuite) TestAscsErsClusterGatherCacheCastingError() {
cache := factscache.NewFactsCache()
_, err := cache.GetOrUpdate("cibadmin", func(args ...interface{}) (interface{}, error) {
_, err := cache.GetOrUpdate("cibadmin", func(_ ...interface{}) (interface{}, error) {
return 1, nil
})
suite.NoError(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/factsengine/gatherers/cibadmin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (suite *CibAdminTestSuite) TestCibAdminGatherWithCache() {

func (suite *CibAdminTestSuite) TestCibAdminGatherCacheCastingError() {
cache := factscache.NewFactsCache()
_, err := cache.GetOrUpdate("cibadmin", func(args ...interface{}) (interface{}, error) {
_, err := cache.GetOrUpdate("cibadmin", func(_ ...interface{}) (interface{}, error) {
return 1, nil
})
suite.NoError(err)
Expand Down
4 changes: 2 additions & 2 deletions internal/factsengine/gatherers/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ func TestPluginTestSuite(t *testing.T) {

type testPluginLoader struct{}

func (l *testPluginLoader) Load(pluginPath string) (gatherers.FactGatherer, error) {
func (l *testPluginLoader) Load(_ string) (gatherers.FactGatherer, error) {
return &mocks.FactGatherer{}, nil
}

type errorPluginLoader struct{}

func (l *errorPluginLoader) Load(pluginPath string) (gatherers.FactGatherer, error) {
func (l *errorPluginLoader) Load(_ string) (gatherers.FactGatherer, error) {
return nil, errors.New("kaboom")
}

Expand Down
8 changes: 4 additions & 4 deletions internal/factsengine/gatherers/sbddump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package gatherers_test

import (
"errors"
"io/ioutil"
"io"
"os"
"testing"

Expand Down Expand Up @@ -49,7 +49,7 @@ func (suite *SBDDumpTestSuite) TestSBDDumpUnableToDumpDevice() {
mockExecutor := new(utilsMocks.CommandExecutor)

mockOutputFile, _ := os.Open(helpers.GetFixturePath("gatherers/dev.vdc.sbddump.output"))
mockOutput, _ := ioutil.ReadAll(mockOutputFile)
mockOutput, _ := io.ReadAll(mockOutputFile)
mockExecutor.On("Exec", "sbd", "-d", "/dev/vdb", "dump").Return(nil, errors.New("a failure"))
mockExecutor.On("Exec", "sbd", "-d", "/dev/vdc", "dump").Return(mockOutput, nil)

Expand Down Expand Up @@ -99,10 +99,10 @@ func (suite *SBDDumpTestSuite) TestSBDDumpGatherer() {
mockExecutor := new(utilsMocks.CommandExecutor)

deviceVDBMockOutputFile, _ := os.Open(helpers.GetFixturePath("gatherers/dev.vdb.sbddump.output"))
deviceVDBMockOutput, _ := ioutil.ReadAll(deviceVDBMockOutputFile)
deviceVDBMockOutput, _ := io.ReadAll(deviceVDBMockOutputFile)

deviceVDCMockOutputFile, _ := os.Open(helpers.GetFixturePath("gatherers/dev.vdc.sbddump.output"))
deviceVDCMockOutput, _ := ioutil.ReadAll(deviceVDCMockOutputFile)
deviceVDCMockOutput, _ := io.ReadAll(deviceVDCMockOutputFile)

mockExecutor.On("Exec", "sbd", "-d", "/dev/vdb", "dump").Return(deviceVDBMockOutput, nil)
mockExecutor.On("Exec", "sbd", "-d", "/dev/vdc", "dump").Return(deviceVDCMockOutput, nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/factsengine/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
FactsGatheringRequested = "Trento.Checks.V1.FactsGatheringRequested"
)

func (c *FactsEngine) handleEvent(contentType string, request []byte) error {
func (c *FactsEngine) handleEvent(_ string, request []byte) error {
eventType, err := events.EventType(request)
if err != nil {
return errors.Wrap(err, "Error getting event type")
Expand Down
2 changes: 1 addition & 1 deletion packaging/suse/trento-agent.spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Source: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz
ExclusiveArch: aarch64 x86_64 ppc64le s390x
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: golang(API) = 1.18
BuildRequires: golang(API) = 1.22
Requires: golang-github-prometheus-node_exporter
Provides: %{name} = %{version}-%{release}
Provides: trento = %{version}-%{release}
Expand Down
8 changes: 4 additions & 4 deletions pkg/factsengine/entities/fact_value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (suite *FactValueTestSuite) TestNewFactValueWithStringConversion() {
}

for _, tt := range cases {
suite.T().Run(tt.description, func(t *testing.T) {
suite.T().Run(tt.description, func(_ *testing.T) {
factValue, err := entities.NewFactValue(tt.factValue, entities.WithStringConversion())

suite.Equal(tt.expected, factValue)
Expand Down Expand Up @@ -181,7 +181,7 @@ func (suite *FactValueTestSuite) TestFactValueAsInterface() {
}

for _, tt := range cases {
suite.T().Run(tt.description, func(t *testing.T) {
suite.T().Run(tt.description, func(_ *testing.T) {
i := tt.factValue.AsInterface()

suite.Equal(i, tt.expected)
Expand Down Expand Up @@ -324,7 +324,7 @@ func (suite *FactValueTestSuite) TestFactValueMapGetValue() {
}

for _, tt := range cases {
suite.T().Run(tt.description, func(t *testing.T) {
suite.T().Run(tt.description, func(_ *testing.T) {
factValue, err := mapValue.GetValue(tt.key)

suite.Equal(factValue, tt.expected)
Expand Down Expand Up @@ -368,7 +368,7 @@ func (suite *FactValueTestSuite) TestParseStringToFactValue() {
}

for _, tt := range cases {
suite.T().Run(tt.description, func(t *testing.T) {
suite.T().Run(tt.description, func(_ *testing.T) {
factValue := entities.ParseStringToFactValue(tt.str)

suite.Equal(factValue, tt.expected)
Expand Down
2 changes: 1 addition & 1 deletion pkg/factsengine/plugininterface/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ func (p *GathererPlugin) Server(*plugin.MuxBroker) (interface{}, error) {
return &GathererRPCServer{Impl: p.Impl}, nil
}

func (GathererPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) {
func (GathererPlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error) {
return &GathererRPC{client: c}, nil
}
2 changes: 1 addition & 1 deletion test/helpers/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
}

// ErroringRoundTripFunc implements the RoundTripper interface
func (f ErroringRoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) {
func (f ErroringRoundTripFunc) RoundTrip(_ *http.Request) (*http.Response, error) {
return nil, f()
}

0 comments on commit e4f9187

Please sign in to comment.