Skip to content

Commit

Permalink
chore: cleaned up linting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
docwhat committed Mar 15, 2022
1 parent d571dc6 commit 0280d09
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- run: ./script/bootstrap
- run: ./script/test

goreleaser:
snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
18 changes: 18 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
linters:
presets:
- bugs
- comment
- complexity
- error
- format
- import
- module
- style
- test
- unused
disable:
- golint
- interfacer
- scopelint
- exhaustivestruct
- maligned
9 changes: 4 additions & 5 deletions functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
textTemplate "text/template"

sprig "github.com/Masterminds/sprig/v3"

shellquote "github.com/kballard/go-shellquote"
)

Expand All @@ -34,7 +33,7 @@ func buildFuncMap(jsonDataFile string) FuncMap {
}

func dataFunc(jsonDataFileName string) func() map[string]interface{} {
var v map[string]interface{}
var dataFunctionMap map[string]interface{}

if jsonDataFileName != "" {
file := safeOpen(jsonDataFileName)
Expand All @@ -45,12 +44,12 @@ func dataFunc(jsonDataFileName string) func() map[string]interface{} {
}()

dec := json.NewDecoder(file)
if err := dec.Decode(&v); err != nil {
log.Fatalf("Unable to parse %s: %s", jsonDataFileName, err)
if err := dec.Decode(&dataFunctionMap); err != nil {
log.Printf("Unable to parse %s: %s", jsonDataFileName, err)
}
}

return func() map[string]interface{} { return v }
return func() map[string]interface{} { return dataFunctionMap }
}

func doTextTemplate(file string, funcMap FuncMap, emitter io.Writer) {
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
kingpin "gopkg.in/alecthomas/kingpin.v2"
)

// nolint: gochecknoglobals
var (
version = "dev"
commit = "none"
Expand Down
Empty file modified script/lint
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ func safeOpen(path string) *os.File {
if err != nil {
log.Fatalf("Unable to open %s: %s", path, err)
}

return file
}

0 comments on commit 0280d09

Please sign in to comment.