Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoTarijon committed Feb 19, 2024
1 parent 0aac04d commit 143eb16
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,9 @@ linters-settings:
- name: unused-parameter
severity: warning
disabled: false

issues:
exclude-rules:
- path: '(.+)_test\.go'
text: "dot-imports: should not use dot imports"

2 changes: 1 addition & 1 deletion internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewLogger(level string, onError func(err error, args ...interface{})) Logge
}

func NewNopLogger() Logger {
noopErrorCallback := func(err error, args ...interface{}) {}
noopErrorCallback := func(_ error, _ ...interface{}) {}

return &loggerImpl{logger: gokitlog.NewNopLogger(), errorCallback: noopErrorCallback}
}
4 changes: 2 additions & 2 deletions pkg/controllers/logql_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestValidateLogQLOnServerWithHeadersFunc(t *testing.T) {
}

func TestValidateLogQLOnServerFuncHTTP500IsAnInvalidResponse(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
}))

Expand All @@ -84,7 +84,7 @@ func TestValidateLogQLOnServerFuncHTTP500IsAnInvalidResponse(t *testing.T) {
}

func TestValidateLogQLOnServerFuncInvalidRequest(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(500)
}))
isValid, err := ValidateLogQLOnServerFunc(http.DefaultClient, ts.URL, "{job=\"loki-test\"}")
Expand Down
6 changes: 5 additions & 1 deletion pkg/controllers/lokirule_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ = BeforeSuite(func() {
})
Expect(err).ToNot(HaveOccurred())

httpServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
httpServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
}))

Expand Down Expand Up @@ -113,6 +113,10 @@ var _ = BeforeSuite(func() {
}()
})

var _ = AfterSuite(func() {
defer httpServer.Close()
})

var _ = Describe("LokiRuleController", func() {
Describe("Reconcile", func() {
Context("When a LokiRule is created", func() {
Expand Down

0 comments on commit 143eb16

Please sign in to comment.