Skip to content

Commit e4e8082

Browse files
committed
fix failing lints
1 parent 406c915 commit e4e8082

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

internal/handler/csp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var invalidBlockedURIs = []string{
4242
func TestValidateViolationWithInvalidBlockedURIs(t *testing.T) {
4343
for _, blockedURI := range invalidBlockedURIs {
4444
// Makes the test name more readable for the output.
45-
testName := strings.Replace(blockedURI, "://", "", -1)
45+
testName := strings.ReplaceAll(blockedURI, "://", "")
4646

4747
t.Run(testName, func(t *testing.T) {
4848
rawReport := []byte(fmt.Sprintf(`{

main.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"github.com/gorilla/mux"
1515
"github.com/sirupsen/logrus"
16-
log "github.com/sirupsen/logrus"
1716
)
1817

1918
const (
@@ -28,18 +27,18 @@ var (
2827

2928
// Shared defaults for the logger output. This ensures that we are
3029
// using the same keys for the `FieldKey` values across both formatters.
31-
logFieldMapDefaults = log.FieldMap{
32-
log.FieldKeyTime: "timestamp",
33-
log.FieldKeyLevel: "level",
34-
log.FieldKeyMsg: "message",
30+
logFieldMapDefaults = logrus.FieldMap{
31+
logrus.FieldKeyTime: "timestamp",
32+
logrus.FieldKeyLevel: "level",
33+
logrus.FieldKeyMsg: "message",
3534
}
3635
)
3736

3837
var logger = logrus.New()
3938

4039
func init() {
4140
logger.SetOutput(os.Stdout)
42-
logger.SetLevel(log.InfoLevel)
41+
logger.SetLevel(logrus.InfoLevel)
4342
}
4443

4544
func main() {
@@ -64,15 +63,15 @@ func main() {
6463
}
6564

6665
if *debugFlag {
67-
logger.SetLevel(log.DebugLevel)
66+
logger.SetLevel(logrus.DebugLevel)
6867
}
6968

7069
if *outputFormat == "json" {
71-
logger.SetFormatter(&log.JSONFormatter{
70+
logger.SetFormatter(&logrus.JSONFormatter{
7271
FieldMap: logFieldMapDefaults,
7372
})
7473
} else {
75-
logger.SetFormatter(&log.TextFormatter{
74+
logger.SetFormatter(&logrus.TextFormatter{
7675
FullTimestamp: true,
7776
DisableLevelTruncation: true,
7877
QuoteEmptyFields: true,
@@ -88,7 +87,7 @@ func main() {
8887

8988
content, err := os.ReadFile(*blockedURIFile)
9089
if err != nil {
91-
log.Fatalf("error reading Blocked File list: %s", *blockedURIFile)
90+
logrus.Fatalf("error reading Blocked File list: %s", *blockedURIFile)
9291
}
9392
ignoredBlockedURIs = utils.TrimEmptyAndComments(strings.Split(string(content), "\n"))
9493
} else {

0 commit comments

Comments
 (0)