Skip to content

Commit bf5a2a1

Browse files
do not log random errors using Go logger
we need to make sure that we print in consistent format for the logs, remove the unnecessary logs everywhere used via `log.Print*`
1 parent 413870e commit bf5a2a1

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

.golangci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,19 @@ linters-settings:
1414
linters:
1515
disable-all: true
1616
enable:
17-
- typecheck
1817
- goimports
1918
- misspell
2019
- govet
2120
- revive
2221
- ineffassign
2322
- gosimple
24-
- deadcode
25-
- structcheck
2623
- gomodguard
2724
- gofmt
2825
- unused
29-
- structcheck
3026
- unconvert
3127
- varcheck
3228
- gocritic
3329
- gofumpt
34-
- tenv
3530
- durationcheck
3631

3732
service:
@@ -51,4 +46,4 @@ run:
5146
skip-dirs:
5247
- pkg/clientgen
5348
- pkg/apis/networking.gke.io
54-
- restapi/operations
49+
- restapi/operations

pkg/subnet/subnet.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"encoding/json"
2323
"errors"
2424
"fmt"
25-
"log"
2625

2726
"github.com/minio/console/pkg/http"
2827

@@ -150,7 +149,6 @@ func ParseLicense(client http.ClientI, license string) (*licverifier.LicenseInfo
150149

151150
subnetPubKey, err := downloadSubnetPublicKey(client)
152151
if err != nil {
153-
log.Print(err)
154152
// there was an issue getting the subnet public key
155153
// use hardcoded public keys instead
156154
publicKeys = OfflinePublicKeys

restapi/configure_console.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,23 @@ func handleSPA(w http.ResponseWriter, r *http.Request) {
372372
sf.ObjectBrowser = true
373373

374374
err := ValidateEncodedStyles(overridenStyles)
375-
376375
if err != nil {
377-
log.Println(err)
378-
} else {
379-
sf.CustomStyleOB = overridenStyles
376+
http.Error(w, err.Error(), http.StatusInternalServerError)
377+
return
380378
}
381379

380+
sf.CustomStyleOB = overridenStyles
381+
382382
sessionID, err := login(consoleCreds, sf)
383383
if err != nil {
384-
log.Println(err)
385-
} else {
386-
cookie := NewSessionCookieForConsole(*sessionID)
387-
http.SetCookie(w, &cookie)
384+
http.Error(w, err.Error(), http.StatusInternalServerError)
385+
return
388386
}
387+
388+
cookie := NewSessionCookieForConsole(*sessionID)
389+
390+
http.SetCookie(w, &cookie)
391+
389392
// Allow us to be iframed
390393
w.Header().Del("X-Frame-Options")
391394
}

0 commit comments

Comments
 (0)