Skip to content

Commit

Permalink
[SECENG] Update depenencies and config
Browse files Browse the repository at this point in the history
* updated linter, test tool version
* updated linter configuration
* replace slices.Sort with sort.Slice
* updated go deps
  • Loading branch information
vallieres committed Sep 26, 2024
1 parent 84f6ea9 commit 070ffdc
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 225 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
executor: go
steps:
- checkout
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3
- run: golangci-lint run -c .golangci.yml
- run:
name: check go.mod
Expand All @@ -25,7 +25,7 @@ jobs:
executor: go
steps:
- checkout
- run: go install gotest.tools/gotestsum@v1.8.1
- run: go install gotest.tools/gotestsum@v1.12.0
- run: mkdir -p /tmp/test-results
- run: CGO_ENABLED=1 gotestsum --junitfile="{{.RESULTS_DIR}}"/results.xml ./... -race -count=1
- run:
Expand Down
19 changes: 0 additions & 19 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@ linters-settings:
min-complexity: 15
maligned:
suggest-new: true
depguard:
list-type: blacklist
include-go-root: true
packages:
- log
- github.com/davecgh/go-spew
packages-with-error-message:
- github.com/cenkalti/backof[f]: use github.com/cenkalti/backoff/v4 instead
- gotest.tools/assert: use gotest.tools/v3/assert instead
- gotest.tools/assert/cmp: use gotest.tools/v3/assert/cmp instead
- gotest.tools/env: use gotest.tools/v3/env instead
- gotest.tools/fs: use gotest.tools/v3/fs instead
- gotest.tools/golden: use gotest.tools/v3/golden instead
- gotest.tools/icmd: use gotest.tools/v3/icmd instead
- gotest.tools/poll: use gotest.tools/v3/poll instead
- gotest.tools/skip: use gotest.tools/v3/skip instead
dupl:
threshold: 100
goconst:
Expand Down Expand Up @@ -113,8 +97,6 @@ issues:
linters:
disable-all: true
enable:
- deadcode
- depguard
- errcheck
- goconst
- gofmt
Expand All @@ -126,4 +108,3 @@ linters:
- prealloc
- typecheck
- unconvert
- varcheck
4 changes: 2 additions & 2 deletions cpa/tester/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"os"
"path/filepath"
"regexp"
"sort"
"strings"
"time"

"github.com/CircleCI-Public/circle-policy-agent/cpa"
"github.com/CircleCI-Public/circle-policy-agent/internal"
"github.com/open-policy-agent/opa/tester"
"github.com/pmezard/go-difflib/difflib"
"golang.org/x/exp/slices"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -161,7 +161,7 @@ func (runner *Runner) runFolder(folder string, results chan<- Result) {
return
}

slices.SortFunc(namedTests, func(a, b NamedTest) bool { return a.Name < b.Name })
sort.Slice(namedTests, func(i, j int) bool { return namedTests[i].Name < namedTests[j].Name })

for _, t := range namedTests {
runner.runTest(policy, results, t, folder, ParentTestContext{})
Expand Down
5 changes: 3 additions & 2 deletions cpa/tester/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"io/fs"
"os"
"path/filepath"
"sort"
"strings"

"github.com/CircleCI-Public/circle-policy-agent/internal"
"golang.org/x/exp/slices"
"gopkg.in/yaml.v2"
)

Expand All @@ -25,7 +25,8 @@ func (t Test) NamedCases() []NamedTest {
for name, test := range t.Cases {
result = append(result, NamedTest{name, test})
}
slices.SortFunc(result, func(a, b NamedTest) bool { return a.Name < b.Name })
sort.Slice(result, func(i, j int) bool { return result[i].Name < result[j].Name })

return result
}

Expand Down
67 changes: 32 additions & 35 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,57 +1,54 @@
module github.com/CircleCI-Public/circle-policy-agent

go 1.20
go 1.23.1

require (
github.com/open-policy-agent/opa v0.54.0
github.com/pmezard/go-difflib v1.0.0
github.com/stretchr/testify v1.8.3
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
github.com/open-policy-agent/opa v0.68.0
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/agnivade/levenshtein v1.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgraph-io/ristretto v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/glog v1.1.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.0 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/klauspost/compress v1.17.10 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_golang v1.20.4 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/sdk v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230724170836-66ad5b6ff146 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230724170836-66ad5b6ff146 // indirect
google.golang.org/grpc v1.56.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/sdk v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
golang.org/x/sys v0.25.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240924160255-9d4c2d233b61 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect
google.golang.org/grpc v1.67.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit 070ffdc

Please sign in to comment.