diff --git a/.golangci.yml b/.golangci.yml index 50c8dfc..160a0dd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,10 +2,8 @@ linters-settings: dupl: threshold: 100 funlen: - lines: 50 - statements: 30 - gci: - local-prefixes: github.com/golangci/golangci-lint + lines: 60 + statements: 45 goconst: min-len: 4 min-occurrences: 2 @@ -19,16 +17,13 @@ linters-settings: disabled-checks: - whyNoLint gocyclo: - min-complexity: 15 - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: + min-complexity: 20 + mnd: settings: mnd: - # don't include the "operation" and "assign" + # do not include the "operation" and "assign" checks: argument,case,condition,return govet: - check-shadowing: true settings: printf: funcs: @@ -43,18 +38,17 @@ linters-settings: nolintlint: allow-leading-space: false # disallow leading spaces. A space means the //nolint comment shows in `godoc` output. allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives + require-explanation: false # do not require an explanation for nolint directives require-specific: true # require nolint directives to be specific about which linter is being skipped + exhaustive: + default-signifies-exhaustive: true linters: # please, do not use `enable-all`: it's deprecated and will be removed soon. # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint disable-all: true enable: - bodyclose - - deadcode - - depguard - dogsled - - dupl - errcheck - exhaustive - exportloopref @@ -64,7 +58,7 @@ linters: - gocyclo - gofmt - goimports - - gomnd + - mnd - goprintffuncname - gosec - gosimple @@ -72,10 +66,7 @@ linters: - ineffassign - lll - misspell - - nakedret - - noctx - nolintlint - - revive - rowserrcheck - staticcheck - stylecheck @@ -83,10 +74,11 @@ linters: - unconvert - unparam - unused - - varcheck - whitespace - # don't enable: + # do not enable: # - asciicheck + # - depguard + # - dupl # - gochecknoglobals # - gochecknoinits # - gocognit @@ -94,8 +86,11 @@ linters: # - godox # - goerr113 # - maligned + # - nakedret # - nestif + # - noctx # - prealloc + # - revive # - exportloopref # - structcheck # - testpackage @@ -103,12 +98,25 @@ linters: issues: # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - # Ignore magic numbers and inline strings in tests. + # Ignore magic numbers, inline strings and function length in tests. - path: _test\.go linters: - - gomnd + - mnd - goconst - # Ignore line length for string assignments (don't try and wrap regex definitions) + - funlen + - path: config/config.go + linters: + - mnd + - path: _scaling.go + linters: + - gocritic + - path: hugepages.go + linters: + - mnd + - path: scheduling.go + linters: + - mnd + # Ignore line length for string assignments (do not try and wrap regex definitions) - linters: - lll source: "^(.*= (\".*\"|`.*`))$" @@ -122,6 +130,6 @@ issues: # golangci.com configuration # https://github.com/golangci/golangci/wiki/Configuration service: - golangci-lint-version: 1.51.x # use the fixed version to not introduce new linters unexpectedly + golangci-lint-version: 1.59.x # use the fixed version to not introduce new linters unexpectedly prepare: - echo "here I can run custom commands, but no preparation needed for this repo" diff --git a/go.mod b/go.mod index fb9b8a3..51b8e1e 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,13 @@ -module github.com/test-network-function/graphsolver-lib +module github.com/redhat-best-practices-for-k8s/graphsolver-lib -go 1.21.4 +go 1.22.5 + +toolchain go1.22.6 require ( + github.com/redhat-best-practices-for-k8s/graphsolver-exports v0.0.2 + github.com/redhat-best-practices-for-k8s/l2discovery-exports v0.0.4 github.com/sirupsen/logrus v1.9.3 - github.com/test-network-function/graphsolver-exports v0.0.1 - github.com/test-network-function/l2discovery-exports v0.0.3 ) require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect diff --git a/go.sum b/go.sum index 8beccd2..1088d35 100644 --- a/go.sum +++ b/go.sum @@ -3,15 +3,15 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/redhat-best-practices-for-k8s/graphsolver-exports v0.0.2 h1:SJnXD40jEFBCWT8ZjmJOFJdIzMwWPbrIUCAQu1oXfYQ= +github.com/redhat-best-practices-for-k8s/graphsolver-exports v0.0.2/go.mod h1:Vl268nAHQKEnIw7GIYehp3Lx4qYP8+rOlwGsWxD/aO4= +github.com/redhat-best-practices-for-k8s/l2discovery-exports v0.0.4 h1:66qE0Vj/8vWvt8yaVq1yJK5+OOELGZdlCwzHkXRxFr4= +github.com/redhat-best-practices-for-k8s/l2discovery-exports v0.0.4/go.mod h1:NO9mpaj5neVKarRGcsL5SHVFb+uYUoCC8uVbuT419xs= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/test-network-function/graphsolver-exports v0.0.1 h1:27zhW/1fiKf3+NJsevl+jvuJu9t/MqOs1wmAkcmp8ng= -github.com/test-network-function/graphsolver-exports v0.0.1/go.mod h1:Zo5bUPq3s1KWfz6MtMHzHQh1mSiW4DOpBbZ03TG2zIw= -github.com/test-network-function/l2discovery-exports v0.0.3 h1:kuzpWu5UQL3VIG+8AkjmsghkjZN1X3k3dQ8M36DsJc4= -github.com/test-network-function/l2discovery-exports v0.0.3/go.mod h1:38JgpFHXB9PQ+4bPZQ+STsUKK9BrTe+5uDq47OeMV50= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/lib.go b/lib.go index b636609..ba68d3d 100644 --- a/lib.go +++ b/lib.go @@ -1,9 +1,9 @@ package lib import ( + export "github.com/redhat-best-practices-for-k8s/graphsolver-exports" + l2lib "github.com/redhat-best-practices-for-k8s/l2discovery-exports" "github.com/sirupsen/logrus" - export "github.com/test-network-function/graphsolver-exports" - l2lib "github.com/test-network-function/l2discovery-exports" ) var GlobalConfig = configObject{}