forked from TrueCloudLab/certificates
[#3] Add linters
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
This commit is contained in:
parent
b13ba41053
commit
722c904f4b
8 changed files with 55 additions and 7 deletions
20
.forgejo/workflows/linters.yml
Normal file
20
.forgejo/workflows/linters.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: Linters
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '1.19'
|
||||
cache: true
|
||||
|
||||
- name: golangci-lint
|
||||
uses: https://github.com/golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
29
.golangci.yml
Normal file
29
.golangci.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
# This file contains all available configuration options
|
||||
# with their default values.
|
||||
|
||||
# options for analysis running
|
||||
run:
|
||||
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||
timeout: 5m
|
||||
|
||||
# include test files or not, default is true
|
||||
tests: false
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
format: tab
|
||||
|
||||
# all available settings of specific linters
|
||||
linters-settings:
|
||||
govet:
|
||||
# report about shadowed variables
|
||||
check-shadowing: false
|
||||
|
||||
linters:
|
||||
enable:
|
||||
# mandatory linters
|
||||
- govet
|
||||
- revive
|
||||
disable-all: true
|
||||
fast: false
|
3
Makefile
3
Makefile
|
@ -177,3 +177,6 @@ run:
|
|||
|
||||
.PHONY: run
|
||||
|
||||
# Run linters. Override old command
|
||||
lint:
|
||||
@golangci-lint --timeout=5m run
|
||||
|
|
|
@ -65,7 +65,7 @@ func NewTLSRenewer(cert *tls.Certificate, fn RenewFunc, opts ...tlsRenewerOption
|
|||
// renewals due to the negative values in nextRenewDuration.
|
||||
period := cert.Leaf.NotAfter.Sub(time.Now().Truncate(time.Second))
|
||||
if period < minCertDuration {
|
||||
return nil, errors.Errorf("period must be greater than or equal to %s, but got %v.", minCertDuration, period)
|
||||
return nil, errors.Errorf("period must be greater than or equal to %s, but got %v", minCertDuration, period)
|
||||
}
|
||||
// By default we will try to renew the cert before 2/3 of the validity
|
||||
// period have expired.
|
||||
|
|
|
@ -34,7 +34,6 @@ import (
|
|||
_ "go.step.sm/crypto/kms/pkcs11"
|
||||
_ "go.step.sm/crypto/kms/softkms"
|
||||
_ "go.step.sm/crypto/kms/sshagentkms"
|
||||
_ "go.step.sm/crypto/kms/yubikey"
|
||||
|
||||
// Enabled cas interfaces.
|
||||
_ "github.com/smallstep/certificates/cas/cloudcas"
|
||||
|
|
1
go.mod
1
go.mod
|
@ -75,7 +75,6 @@ require (
|
|||
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
|
||||
github.com/go-kit/kit v0.10.0 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
||||
github.com/go-piv/piv-go v1.11.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang/glog v1.1.0 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -363,8 +363,6 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
|
|||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
|
||||
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/go-piv/piv-go v1.11.0 h1:5vAaCdRTFSIW4PeqMbnsDlUZ7odMYWnHBDGdmtU/Zhg=
|
||||
github.com/go-piv/piv-go v1.11.0/go.mod h1:NZ2zmjVkfFaL/CF8cVQ/pXdXtuj110zEKGdJM6fJZZM=
|
||||
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
|
||||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
||||
github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
|
|
|
@ -58,7 +58,7 @@ type DB interface {
|
|||
type dryRunDB struct{}
|
||||
|
||||
func (*dryRunDB) CreateTable([]byte) error { return nil }
|
||||
func (*dryRunDB) Set(bucket, key, value []byte) error { return nil }
|
||||
func (*dryRunDB) Set(_, _, _ []byte) error { return nil }
|
||||
|
||||
func usage(fs *flag.FlagSet) {
|
||||
name := filepath.Base(os.Args[0])
|
||||
|
|
Loading…
Reference in a new issue