Skip to content

Commit

Permalink
Enable errcheck and stylecheck linters (#82)
Browse files Browse the repository at this point in the history
It seems that errcheck actually runs through fine, so reenable this
linter. Also enable the stylecheck linter and fix a few findings.
  • Loading branch information
agners authored Nov 26, 2024
1 parent 0ae2cca commit 2fcfc52
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ jobs:
uses: golangci/[email protected]
with:
version: latest
args: -D errcheck
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- stylecheck
12 changes: 6 additions & 6 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (
)

func TestTemplatesJoin(t *testing.T) {
dataJson := []byte(`{"list": ["hallo", "welt", "bla"]}`)
dataJSON := []byte(`{"list": ["hallo", "welt", "bla"]}`)
dataTemplate := []byte(`{{ join ";" .list }}`)

test_config := readConfigBuffer(dataJson)
rendered := renderTemplateBuffer(test_config, dataTemplate)
testConfig := readConfigBuffer(dataJSON)
rendered := renderTemplateBuffer(testConfig, dataTemplate)

assert.Equal(t, string(rendered), "hallo;welt;bla")
}

func TestTemplatesCalc(t *testing.T) {
dataJson := []byte(`{"num": 3}`)
dataJSON := []byte(`{"num": 3}`)
dataTemplate := []byte(`{{ add .num 3 }}-{{ mul .num 3 }}`)

test_config := readConfigBuffer(dataJson)
rendered := renderTemplateBuffer(test_config, dataTemplate)
testConfig := readConfigBuffer(dataJSON)
rendered := renderTemplateBuffer(testConfig, dataTemplate)

assert.Equal(t, string(rendered), "6-9")
}

0 comments on commit 2fcfc52

Please sign in to comment.