Skip to content

Commit

Permalink
fix: golangci-lint (envoyproxy#993)
Browse files Browse the repository at this point in the history
* fix: golangci-lint

- exclude G115

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
  • Loading branch information
mmorel-35 authored and lukidzi committed Nov 4, 2024
1 parent 2a633d9 commit 5a86e80
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ linters-settings:
extra-rules: true
goimports:
local-prefixes: github.com/envoyproxy/go-control-plane
gosec:
excludes:
- G115
misspell:
locale: US
testifylint:
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/delta/v3/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (s *server) processDelta(str stream.DeltaStream, reqCh <-chan *discovery.De
process := func(resp cache.DeltaResponse) error {
typ := resp.GetDeltaRequest().GetTypeUrl()
if resp == deltaErrorResponse {
return status.Errorf(codes.Unavailable, typ+" watch failed")
return status.Errorf(codes.Unavailable, "%s watch failed", typ)
}

nonce, err := send(resp)
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/sotw/v3/ads.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (s *server) processADS(sw *streamWrapper, reqCh chan *discovery.DiscoveryRe
// We only watch the multiplexed channel since all values will come through from process.
case res := <-sw.watches.responders[resource.AnyType].response:
if err := process(res); err != nil {
return status.Errorf(codes.Unavailable, err.Error())
return status.Errorf(codes.Unavailable, "%v", err)
}
case req, ok := <-reqCh:
// Input stream ended or failed.
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/v3/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (h *HTTPGateway) ServeHTTP(req *http.Request) ([]byte, int, error) {
out := &discovery.DiscoveryRequest{}
err = protojson.Unmarshal(body, out)
if err != nil {
return nil, http.StatusBadRequest, fmt.Errorf("cannot parse JSON body: " + err.Error())
return nil, http.StatusBadRequest, fmt.Errorf("cannot parse JSON body: %w", err)
}
out.TypeUrl = typeURL

Expand All @@ -86,12 +86,12 @@ func (h *HTTPGateway) ServeHTTP(req *http.Request) ([]byte, int, error) {
if ok := errors.As(err, &skip); ok {
return nil, http.StatusNotModified, nil
}
return nil, http.StatusInternalServerError, fmt.Errorf("fetch error: " + err.Error())
return nil, http.StatusInternalServerError, fmt.Errorf("fetch error: %w", err)
}

b, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(res)
if err != nil {
return nil, http.StatusInternalServerError, fmt.Errorf("marshal error: " + err.Error())
return nil, http.StatusInternalServerError, fmt.Errorf("marshal error: %w", err)
}

return b, http.StatusOK, nil
Expand Down

0 comments on commit 5a86e80

Please sign in to comment.