Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
linter suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
norling committed Mar 21, 2023
1 parent 7b0443f commit b2f7b74
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
12 changes: 4 additions & 8 deletions helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,9 @@ func TLSkeyToFile(filename string, key *ecdsa.PrivateKey) error {
if err != nil {
return err
}
if err := pem.Encode(keyFile, &pem.Block{Type: "EC PRIVATE KEY", Bytes: pk}); err != nil {
return err
}
err = pem.Encode(keyFile, &pem.Block{Type: "EC PRIVATE KEY", Bytes: pk})

return nil
return err
}

func TLScertToFile(filename string, derBytes []byte) error {
Expand All @@ -361,9 +359,7 @@ func TLScertToFile(filename string, derBytes []byte) error {
return err
}
defer certFile.Close()
if err := pem.Encode(certFile, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil {
return err
}
err = pem.Encode(certFile, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes})

return nil
return err
}
4 changes: 2 additions & 2 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func (p *Proxy) internalServerError(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(500)
}

func (p *Proxy) notAllowedResponse(w http.ResponseWriter, r *http.Request) {
func (p *Proxy) notAllowedResponse(w http.ResponseWriter, _ *http.Request) {
log.Debug("not allowed response")
w.WriteHeader(403)
}

func (p *Proxy) notAuthorized(w http.ResponseWriter, r *http.Request) {
func (p *Proxy) notAuthorized(w http.ResponseWriter, _ *http.Request) {
log.Debug("not authorized")
w.WriteHeader(401) // Actually correct!
}
Expand Down
2 changes: 1 addition & 1 deletion proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (m *MockMessenger) SendMessage(uuid string, body []byte) error {
type AlwaysDeny struct{}

// Authenticate does not authenticate anyone.
func (u *AlwaysDeny) Authenticate(r *http.Request) (jwt.MapClaims, error) {
func (u *AlwaysDeny) Authenticate(_ *http.Request) (jwt.MapClaims, error) {
return nil, fmt.Errorf("denied")
}

Expand Down
2 changes: 1 addition & 1 deletion userauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewAlwaysAllow() *AlwaysAllow {
}

// Authenticate authenticates everyone.
func (u *AlwaysAllow) Authenticate(r *http.Request) (jwt.MapClaims, error) {
func (u *AlwaysAllow) Authenticate(_ *http.Request) (jwt.MapClaims, error) {
return nil, nil
}

Expand Down

0 comments on commit b2f7b74

Please sign in to comment.