Skip to content

Commit 3e4b71d

Browse files
committed
chore: lint fixes
1 parent 5129df7 commit 3e4b71d

File tree

7 files changed

+15
-50
lines changed

7 files changed

+15
-50
lines changed

context/properties.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,3 @@ func UpdateProperties(ctx Context, props map[string]string) error {
228228
defer ctx.ClearCache()
229229
return ctx.DB().Exec(query, args...).Error
230230
}
231-
232-
func getLogLevel(level string) int {
233-
if i, err := strconv.Atoi(level); err == nil {
234-
return i
235-
}
236-
switch level {
237-
case "debug":
238-
return 1
239-
case "trace":
240-
return 2
241-
case "warn":
242-
return -1
243-
case "error":
244-
return -2
245-
default:
246-
return 0
247-
}
248-
}

gorm/logger.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type Config struct {
6161
type SqlLogger struct {
6262
Config
6363
commons.Logger
64-
skipLevel int
6564
}
6665

6766
func (l *SqlLogger) WithLogLevel(level any) *SqlLogger {
@@ -162,23 +161,3 @@ func (l *SqlLogger) ParamsFilter(ctx context.Context, sql string, params ...inte
162161
}
163162
return sql, nil
164163
}
165-
166-
type traceRecorder struct {
167-
Logger
168-
BeginAt time.Time
169-
SQL string
170-
RowsAffected int64
171-
Err error
172-
}
173-
174-
// New trace recorder
175-
func (l *traceRecorder) New() *traceRecorder {
176-
return &traceRecorder{Logger: l.Logger, BeginAt: time.Now()}
177-
}
178-
179-
// Trace implement logger interface
180-
func (l *traceRecorder) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
181-
l.BeginAt = begin
182-
l.SQL, l.RowsAffected = fc()
183-
l.Err = err
184-
}

hack/migrate/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ package main
33
import (
44
"github.com/flanksource/commons/logger"
55
"github.com/flanksource/duty"
6+
"github.com/flanksource/duty/api"
7+
68
"github.com/spf13/cobra"
79
)
810

911
var migrate = &cobra.Command{
1012
Use: "migrate",
1113
Run: func(cmd *cobra.Command, args []string) {
12-
if err := duty.Migrate(connection, nil); err != nil {
14+
if err := duty.Migrate(api.Config{
15+
ConnectionString: connection,
16+
}); err != nil {
1317
logger.Fatalf(err.Error())
1418
}
1519
},

pkg/kube/labels/selector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
16+
// nolint
1717
package labels
1818

1919
import (

pkg/kube/labels/selector_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
Copyright 2014 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance wginkgo.Ith the License.
5+
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
88
http://www.apache.org/licenses/LICENSE-2.0
99
10-
Unless required by applicable law or agreed to in wrginkgo.Iting, software
10+
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
12-
Wginkgo.ItHOUT WARRANTIES OR CONDginkgo.ItIONS OF ANY KIND, eginkgo.Ither express or implied.
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
14-
limginkgo.Itations under the License.
14+
limitations under the License.
1515
*/
1616

17+
// nolint
1718
package labels
1819

1920
import (

telemetry/otel.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ func InitTracer(serviceName, collectorURL string, insecure bool, resourceAttrs .
6565
otel.SetTextMapPropagator(propagation.TraceContext{})
6666

6767
return func(ctx context.Context) error {
68-
logger.Infof("Shutting down exporter")
69-
exporter.Shutdown(ctx)
70-
logger.Infof("Shutdown exporter")
68+
logger.Debugf("Shutting down otel exporter")
69+
_ = exporter.Shutdown(ctx)
70+
logger.Debugf("Shutdown complete")
7171
return nil
7272
}
7373
}

tests/matcher/fixture.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func MatchMap(a map[string]string, jq ...string) gcustom.CustomGomegaMatcher {
3939
}
4040

4141
for _, _jq := range jq {
42-
4342
expectedJSONb, err = ParseJQ([]byte(expectedJSON), _jq)
4443
if err != nil {
4544
return false, err
@@ -50,7 +49,7 @@ func MatchMap(a map[string]string, jq ...string) gcustom.CustomGomegaMatcher {
5049
}
5150
}
5251

53-
diff, err := generateDiff(string(expectedJSON), string(actualJSON))
52+
diff, err := generateDiff(string(actualJSONb), string(expectedJSONb))
5453
if err != nil {
5554
return false, err
5655
}

0 commit comments

Comments
 (0)