ci(golangci-lint): replace golint with revive linter (#2078)

Remove deprecated `golint` linter and replace with `revive` linter.

Also fix outstanding issues due to upgraded linters.
This commit is contained in:
Amir Zarrinkafsh 2021-06-11 10:30:53 +10:00 committed by GitHub
parent 91a2cc1caa
commit 8a171e6344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 18 deletions

View File

@ -22,11 +22,11 @@ linters:
- godot
- gofmt
- goimports
- golint
- gosec
- misspell
- nolintlint
- prealloc
- revive
- unconvert
- unparam
- whitespace

View File

@ -182,7 +182,7 @@ func runOnError(suite string) error {
func setupSuite(suiteName string) error {
log.Infof("Setup environment for suite %s...", suiteName)
signalChannel := make(chan os.Signal)
signalChannel := make(chan os.Signal, 1)
signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM)
interrupted := false

View File

@ -234,7 +234,8 @@ func (c *AutheliaCtx) GetOriginalURL() (*url.URL, error) {
var requestURI string
scheme := append(forwardedProto, protoHostSeparator...)
scheme := forwardedProto
scheme = append(scheme, protoHostSeparator...)
requestURI = string(append(scheme,
append(forwardedHost, forwardedURI...)...))

View File

@ -36,11 +36,9 @@ func (k Kind) CreateCluster() error {
// In that case /etc/resolv.conf use 127.0.0.11 as DNS and CoreDNS thinks it is talking to itself which is wrong.
// This IP is the docker internal DNS so it is safe to disable the loop check.
cmd = kindCommand("sh -c 'kubectl -n kube-system get configmap/coredns -o yaml | grep -v loop | kubectl replace -f -'")
if err := cmd.Run(); err != nil {
return err
}
err := cmd.Run()
return nil
return err
}
// DeleteCluster delete a Kubernetes cluster.
@ -90,11 +88,9 @@ func (k Kubectl) StartDashboard() error {
return err
}
if err := utils.Shell("docker-compose -p authelia -f internal/suites/docker-compose.yml -f internal/suites/example/compose/kind/docker-compose.yml up -d kube-dashboard").Run(); err != nil {
return err
}
err := utils.Shell("docker-compose -p authelia -f internal/suites/docker-compose.yml -f internal/suites/example/compose/kind/docker-compose.yml up -d kube-dashboard").Run()
return nil
return err
}
// StopDashboard stop kube dashboard.

View File

@ -12,7 +12,6 @@ import (
var kubernetesSuiteName = "Kubernetes"
//nolint:gocyclo // TODO: Consider refactoring/simplifying, time permitting.
func init() {
kind := Kind{}
kubectl := Kubectl{}
@ -85,11 +84,9 @@ func init() {
log.Debug("Starting proxy...")
if err := kubectl.StartProxy(); err != nil {
return err
}
err = kubectl.StartProxy()
return nil
return err
}
teardown := func(suitePath string) error {

View File

@ -48,7 +48,7 @@ func Shell(command string) *exec.Cmd {
func RunCommandUntilCtrlC(cmd *exec.Cmd) {
mutex := sync.Mutex{}
cond := sync.NewCond(&mutex)
signalChannel := make(chan os.Signal)
signalChannel := make(chan os.Signal, 1)
signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM)
mutex.Lock()
@ -84,7 +84,7 @@ func RunFuncUntilCtrlC(fn func() error) error {
mutex := sync.Mutex{}
cond := sync.NewCond(&mutex)
errorChannel := make(chan error)
signalChannel := make(chan os.Signal)
signalChannel := make(chan os.Signal, 1)
signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM)
mutex.Lock()