Skip to content

Commit

Permalink
Fix issues for golanci-lint, update go version. (#3)
Browse files Browse the repository at this point in the history
Co-authored-by: Michal Ližičiar <[email protected]>
  • Loading branch information
luborco and Michal Ližičiar authored Aug 2, 2024
1 parent 550c9ee commit 5916791
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
21 changes: 10 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ linters:
- gocyclo
- gofmt
- goimports
- gomnd
- mnd
- gomodguard #
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- megacheck #
- gosimple
- staticcheck
- unused
- misspell
- nakedret
- noctx
Expand All @@ -99,14 +101,11 @@ linters:
- gocognit
- godot
- godox
- goerr113 #
- interfacer
- maligned #
- nestif #
- prealloc #
- scopelint
- testpackage #
- wsl #
- err113
- nestif
- prealloc
- testpackage
- wsl
presets:
- bugs
- unused
Expand Down Expand Up @@ -148,7 +147,7 @@ linters-settings:
local-prefixes: github.com/eset/grpc-rest-proxy
golint:
min-confidence: 0
gomnd:
mnd:
settings:
mnd:
# don't include the "operation" and "assign"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/eset/grpc-rest-proxy

go 1.21.8
go 1.22.5

require (
github.com/go-chi/chi/v5 v5.0.8
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/transformer/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func GetRPCResponse(responseDesc protoreflect.MessageDescriptor) *dynamicpb.Mess

// https://chromium.googlesource.com/external/github.com/grpc/grpc/+/refs/tags/v1.21.4-pre1/doc/statuscodes.md
//
//nolint:gocyclo,gomnd
//nolint:gocyclo,mnd
func GetHTTPStatusCode(code codes.Code) int {
switch code {
case codes.OK:
Expand Down
3 changes: 2 additions & 1 deletion pkg/transport/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package http
import (
"context"
"errors"
"fmt"
"net"
"net/http"

Expand Down Expand Up @@ -39,7 +40,7 @@ func (server *Server) Close() {

err := server.httpServer.Shutdown(ctx)
if err != nil {
server.logger.With(err).Error("shutdown http server")
server.logger.Error(fmt.Sprintf("shutdown http server error: %s", err))
return
}
server.logger.Info("graceful shutdown successful")
Expand Down
2 changes: 1 addition & 1 deletion pkg/transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ func statusJSON(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, err := io.WriteString(w, `{"status":"OK"}`)
if err != nil {
logging.Error("write http response body error for /status: %s", err)
logging.Error(fmt.Sprintf("write http response body error for /status: %s", err))
}
}

0 comments on commit 5916791

Please sign in to comment.