Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint errors/deprecated golangci opts #1902

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ issues:
# Disable the default exclude list so that all excludes are explicitly
# defined in this file.
exclude-use-default: false

exclude-rules:
- text: 'shadow: declaration of "(err|ctx)" shadows declaration at'
linters: [ govet ]

linters-settings:
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
- nilness
- shadow
- unusedwrite
forbidigo:
# Forbid the following identifiers (list of regexp).
Expand Down
4 changes: 2 additions & 2 deletions child/command-prep.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func CommandPrep(command []string) ([]string, bool, error) {
if _, err := exec.LookPath(shell); err != nil {
shell = ""
for _, sh := range []string{"/bin/sh", "/usr/bin/sh"} {
if sh, err := exec.LookPath(sh); err == nil {
shell = sh
if absPath, err := exec.LookPath(sh); err == nil {
shell = absPath
break
}
}
Expand Down
6 changes: 3 additions & 3 deletions config/nomad_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ func TestNomadConfig_Finalize(t *testing.T) {
// This test is envvar sensitive, so there are a whole lot of them that need
// to be backed up and reset after the test
nomadVars := make(map[string]string)
for _, v := range os.Environ() {
if strings.HasPrefix(v, "NOMAD_") {
k, v, found := strings.Cut(v, "=")
for _, envVar := range os.Environ() {
if strings.HasPrefix(envVar, "NOMAD_") {
k, v, found := strings.Cut(envVar, "=")
if found {
nomadVars[k] = v
os.Unsetenv(k)
Expand Down
4 changes: 2 additions & 2 deletions manager/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,9 @@ func (r *Runner) runTemplate(tmpl *template.Template, runCtx *templateRunCtx) (*
// in once mode, and we certainly do not want to re-run any commands.
if r.config.Once {
r.renderEventsLock.RLock()
event, ok := r.renderEvents[tmpl.ID()]
onceEvent, ok := r.renderEvents[tmpl.ID()]
r.renderEventsLock.RUnlock()
if ok && (event.WouldRender || event.DidRender) {
if ok && (onceEvent.WouldRender || onceEvent.DidRender) {
log.Printf("[DEBUG] (runner) once mode and already rendered")
return nil, nil
}
Expand Down
Loading