Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.
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
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
GOLANGCI_LINT_ARGS := --enable=gosec --enable=dupl
TESTREPORT := test-results.xml

# XXX BUG(mweber) "go env GOBIN" is empty?
Expand Down Expand Up @@ -34,17 +35,12 @@ test: build

.PHONY: lint
lint: dep
go list ./... | grep -v vendor | xargs go vet
go list ./... | grep -v vendor | xargs golint
ineffassign .
gosec -quiet ./...
golangci-lint run $(GOLANGCI_LINT_ARGS)

.PHONY: prereq
prereq:
go get github.com/golang/dep/cmd/dep
go get golang.org/x/lint/golint
go get github.com/gordonklaus/ineffassign
go get github.com/securego/gosec/cmd/gosec/...
go get github.com/golangci/golangci-lint/cmd/golangci-lint
go get gotest.tools/gotestsum

.PHONY: clean
Expand Down
5 changes: 1 addition & 4 deletions clients/splunk/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ func (e APIError) Error() string {
// Empty returns true if empty. Otherwise, at least 1 error message is
// present and false is returned.
func (e APIError) Empty() bool {
if len(e.Messages) == 0 {
return true
}
return false
return len(e.Messages) == 0
}

// relevantError returns any non-nil http-related error (creating the request,
Expand Down
1 change: 1 addition & 0 deletions clients/splunk/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ func NewTestSplunkServiceWithTempAdmin() (cleanup func(), conn *API, err error)
clConn := conn
clCleanup := cleanup
cleanup = func() {
// nolint:errcheck
// #nosec G104
clConn.AccessControl.Authentication.Users.Delete(testUser)
clCleanup()
Expand Down
6 changes: 5 additions & 1 deletion clients/splunk/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestUserService_Create(t *testing.T) {

user, _, err := userSvc.Create(params)
assert.NilError(t, err)
// nolint:errcheck
defer userSvc.Delete(user.Name)
assert.Equal(t, user.Name, params.Name)
assert.Equal(t, user.Content.Email, params.Email)
Expand All @@ -53,6 +54,7 @@ func TestUserService_Update_Email(t *testing.T) {

user, _, err := userSvc.Create(params)
assert.NilError(t, err)
// nolint:errcheck
defer userSvc.Delete(user.Name)
assert.Equal(t, user.Name, params.Name)

Expand All @@ -69,11 +71,12 @@ func TestUserService_Update_Password(t *testing.T) {

user, _, err := userSvc.Create(params)
assert.NilError(t, err)
// nolint:errcheck
defer userSvc.Delete(user.Name)
assert.NilError(t, err)
assert.Equal(t, user.Name, params.Name)

user, _, err = userSvc.Update(user.Name, &UpdateUserOptions{
_, _, err = userSvc.Update(user.Name, &UpdateUserOptions{
Password: "changed1234",
})
assert.NilError(t, err)
Expand All @@ -95,6 +98,7 @@ func TestUserService_Update_OwnPassword(t *testing.T) {
params := testUserParams("")
user, _, err := userSvc.Create(params)
assert.NilError(t, err)
// nolint:errcheck
defer userSvc.Delete(user.Name)

_, _, err = userSvc.Update(user.Name, &UpdateUserOptions{
Expand Down
1 change: 1 addition & 0 deletions cmd/vault-plugin-splunk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func main() {

// all plugins ignore Parse errors
// #nosec G104
// nolint:errcheck
flags.Parse(os.Args[1:])

printField := func(field, value string) {
Expand Down
1 change: 1 addition & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (config *splunkConfig) store(ctx context.Context, s logical.Storage, name s
if err != nil {
// config was not stored => cancel cleanup
// #nosec G104
// nolint:errcheck
framework.DeleteWAL(ctx, s, walID)
}
}()
Expand Down
1 change: 1 addition & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func getValue(data *framework.FieldData, op logical.Operation, key string) (inte
return nil, false
}

// nolint:deadcode,unused
func decodeValue(data *framework.FieldData, op logical.Operation, key string, v interface{}) error {
raw, ok := getValue(data, op, key)
if ok {
Expand Down