mirror of
https://github.com/Luzifer/rconfig.git
synced 2024-11-08 07:50:07 +00:00
Lint: Update linter config, fix linter errors, update CI config
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
33ad929d55
commit
7a95069d66
6 changed files with 11 additions and 15 deletions
13
.github/workflows/test-and-build.yml
vendored
13
.github/workflows/test-and-build.yml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
|||
shell: bash
|
||||
|
||||
container:
|
||||
image: luzifer/archlinux
|
||||
image: luzifer/gh-arch-env
|
||||
env:
|
||||
CGO_ENABLED: 1
|
||||
GOPATH: /go
|
||||
|
@ -28,19 +28,12 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Enable custom AUR package repo
|
||||
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
|
||||
|
||||
- name: Install required packages
|
||||
run: |
|
||||
pacman -Syy --noconfirm \
|
||||
base-devel \
|
||||
git \
|
||||
go \
|
||||
golangci-lint-bin \
|
||||
trivy
|
||||
base-devel
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Marking workdir safe
|
||||
run: git config --global --add safe.directory /__w/rconfig/rconfig
|
||||
|
|
|
@ -46,12 +46,12 @@ linters:
|
|||
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
|
||||
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
|
||||
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
|
||||
- gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
|
||||
- gosec # Inspects source code for security problems [fast: true, auto-fix: false]
|
||||
- gosimple # Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false]
|
||||
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false]
|
||||
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
|
||||
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
|
||||
- mnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
|
||||
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
|
||||
- nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]
|
||||
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
|
||||
|
|
|
@ -50,7 +50,7 @@ func TestGeneralExecution(t *testing.T) {
|
|||
|
||||
cfg = test{}
|
||||
args = []string{}
|
||||
require.NoError(t, os.Setenv("shell", "test546"))
|
||||
t.Setenv("shell", "test546")
|
||||
exec("no arguments and set env", [][2]interface{}{
|
||||
{&cfg.Test, "test546"},
|
||||
})
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/Luzifer/rconfig/v2
|
||||
|
||||
go 1.20
|
||||
go 1.22
|
||||
|
||||
require (
|
||||
github.com/spf13/pflag v1.0.5
|
||||
|
|
3
go.sum
3
go.sum
|
@ -1,7 +1,9 @@
|
|||
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/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
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/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
|
@ -10,6 +12,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
|
|||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY=
|
||||
gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestPrecedence(t *testing.T) {
|
|||
|
||||
// Provided: Flag, Env, Default, VarDefault
|
||||
args = []string{"-a", "5"}
|
||||
require.NoError(t, os.Setenv("a", "8"))
|
||||
t.Setenv("a", "8")
|
||||
vardefaults = map[string]string{
|
||||
"a": "3",
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func TestPrecedence(t *testing.T) {
|
|||
|
||||
// Provided: Env, Default, VarDefault
|
||||
args = []string{}
|
||||
require.NoError(t, os.Setenv("a", "8"))
|
||||
t.Setenv("a", "8")
|
||||
vardefaults = map[string]string{
|
||||
"a": "3",
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue