Skip to content
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
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ linters:
# Which file paths to exclude: they will be analyzed, but issues from them won't be reported.
# "/" will be replaced by the current OS file path separator to properly work on Windows.
# Default: []
rules:
# Repeated fixture strings are clearer inline than as constants in tests.
- path: _test\.go
linters:
- goconst
paths:
- third_party$
- builtin$
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/dl/migration_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const nowStr = "2022-08-12T16:50:05Z"
func createSomeAgents(ctx context.Context, t *testing.T, n int, apiKey bulk.APIKey, index string, bulker bulk.Bulk) []string {
t.Helper()

var createdAgents []string
createdAgents := make([]string, 0, n)

for i := 0; i < n; i++ {
outputAPIKey := bulk.APIKey{
Expand Down Expand Up @@ -96,7 +96,7 @@ func TestMigrateOutputs_withDefaultAPIKeyHistory(t *testing.T) {
assert.Equal(t, len(agentIDs), migratedAgents)

for i, id := range agentIDs {
wantOutputType := "elasticsearch" //nolint:goconst // test cases have some duplication
wantOutputType := "elasticsearch"

res, err := SearchWithOneParam(ctx, bulker, QueryAgentByID, index, FieldID, id)
require.NoError(t, err)
Expand Down
1 change: 0 additions & 1 deletion internal/pkg/logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// or more contributor license agreements. Licensed under the Elastic License 2.0;
// you may not use this file except in compliance with the Elastic License 2.0.

//nolint:goconst // used in tests
package logger

import (
Expand Down
9 changes: 4 additions & 5 deletions internal/pkg/server/fleet_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//go:build integration

//nolint:dupl,goconst // don't care about repeating code
//nolint:dupl // don't care about repeating code
package server

import (
Expand Down Expand Up @@ -434,9 +434,8 @@ func TestServerUnauthorized(t *testing.T) {
srv.buildURL(agentID, "acks"),
}

allurls := []string{
srv.buildURL("", "enroll"),
}
allurls := make([]string, 0, 1+len(agenturls))
allurls = append(allurls, srv.buildURL("", "enroll"))
allurls = append(allurls, agenturls...)

// Expecting no authorization header error
Expand Down Expand Up @@ -558,7 +557,7 @@ func TestServerInstrumentation(t *testing.T) {
}
return
}
Err = err //nolint:ineffassign,staticcheck // ugly work around for error checking
Err = err //nolint:ineffassign // ugly work around for error checking
// retry after wait or cancel
select {
case <-ctx.Done():
Expand Down
Loading