Skip to content

Commit

Permalink
break build on ineffassign, and fixed a few cases
Browse files Browse the repository at this point in the history
  • Loading branch information
deckarep committed Jan 12, 2024
1 parent 984b7b2 commit 283b65a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ linters:
disable-all: true
enable:
- bidichk
- ineffassign
- unused
- goconst
- gofmt
Expand Down
4 changes: 2 additions & 2 deletions cmd/utility_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ func TestPackageCfg(t *testing.T) {
// Test error cases first.
args := []string{"@"}

cfg, err := packageCfg(args)
_, err := packageCfg(args)
assert.Error(t, err, "it has an api_key_error")

// Test non-error case.
args = []string{"@", "echo 'hello world'", "&& sleep 0.5", "&& ps aux | grep foo"}

viper.Set("tips_api_key", "foo")
viper.Set("tailnet", "bar")
cfg, err = packageCfg(args)
cfg, err := packageCfg(args)

assert.NoError(t, err)
assert.NotNil(t, cfg)
Expand Down
8 changes: 4 additions & 4 deletions pkg/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ func TestParseFilter(t *testing.T) {
// Note: much more robust testing of the parser occurs in the filtercomp package.
// It makes this testing somewhat redundant.

// An filter expression with imbalanced parenthesis should return an error.
ast, err := ParseFilter("(hello, world")
// A filter expression with imbalanced parenthesis should return an error.
_, err := ParseFilter("(hello, world")
assert.Error(t, err, "imbalanced parenthesis detected")

// An empty filter should return no error with a nil ast.
ast, err = ParseFilter("")
ast, err := ParseFilter("")
assert.NoError(t, err)
assert.Nil(t, ast)

// An empty filter should return no error with a nil ast.
ast, err = ParseFilter("how are you doing?")
_, err = ParseFilter("how are you doing?")
assert.Error(t, err, "parser did not run to completion, tokens were not fully consumed")
}

0 comments on commit 283b65a

Please sign in to comment.