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.
pull/2079/head
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 - godot
- gofmt - gofmt
- goimports - goimports
- golint
- gosec - gosec
- misspell - misspell
- nolintlint - nolintlint
- prealloc - prealloc
- revive
- unconvert - unconvert
- unparam - unparam
- whitespace - whitespace

View File

@ -182,7 +182,7 @@ func runOnError(suite string) error {
func setupSuite(suiteName string) error { func setupSuite(suiteName string) error {
log.Infof("Setup environment for suite %s...", suiteName) 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) signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM)
interrupted := false interrupted := false

View File

@ -234,7 +234,8 @@ func (c *AutheliaCtx) GetOriginalURL() (*url.URL, error) {
var requestURI string var requestURI string
scheme := append(forwardedProto, protoHostSeparator...) scheme := forwardedProto
scheme = append(scheme, protoHostSeparator...)
requestURI = string(append(scheme, requestURI = string(append(scheme,
append(forwardedHost, forwardedURI...)...)) 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. // 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. // 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 -'") 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 { err := cmd.Run()
return err
}
return nil return err
} }
// DeleteCluster delete a Kubernetes cluster. // DeleteCluster delete a Kubernetes cluster.
@ -90,11 +88,9 @@ func (k Kubectl) StartDashboard() error {
return err 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 { 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 err
}
return nil return err
} }
// StopDashboard stop kube dashboard. // StopDashboard stop kube dashboard.

View File

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

View File

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