Skip to content

Commit

Permalink
Enable Lint Rule: redefines-builtin-id (jaegertracing#5791)
Browse files Browse the repository at this point in the history
<!--
!! Please DELETE this comment before posting.
We appreciate your contribution to the Jaeger project! πŸ‘‹πŸŽ‰
-->

## Which problem is this PR solving?
- Partial Fix for jaegertracing#5506

## Description of the changes
- Enabled redefines-builtin-id in revive linter. Replaced function name
which redefinition of the built-in function

## How was this change tested?
- make lint make test

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: ZXYxc <reisaruxxii@gmail.com>
  • Loading branch information
ZXYxc committed Aug 16, 2024
1 parent 57479c1 commit 8921d0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ linters-settings:
# this is idiocy, promotes less readable code. Don't enable.
- name: var-declaration
disabled: true
# enable after cleanup
- name: redefines-builtin-id
disabled: true
# "no nested structs are allowed" - don't enable, doesn't make sense
- name: nested-structs
disabled: true
Expand Down
9 changes: 2 additions & 7 deletions cmd/agent/app/configmanager/grpc/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package grpc

import (
"context"
"io"
"net"
"testing"

Expand All @@ -18,16 +17,12 @@ import (
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)

func close(t *testing.T, c io.Closer) {
require.NoError(t, c.Close())
}

func TestSamplingManager_GetSamplingStrategy(t *testing.T) {
s, addr := initializeGRPCTestServer(t, func(s *grpc.Server) {
api_v2.RegisterSamplingManagerServer(s, &mockSamplingHandler{})
})
conn, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
defer close(t, conn)
t.Cleanup(func() { require.NoError(t, conn.Close()) })
require.NoError(t, err)
defer s.GracefulStop()
manager := NewConfigManager(conn)
Expand All @@ -38,7 +33,7 @@ func TestSamplingManager_GetSamplingStrategy(t *testing.T) {

func TestSamplingManager_GetSamplingStrategy_error(t *testing.T) {
conn, err := grpc.NewClient("foo", grpc.WithTransportCredentials(insecure.NewCredentials()))
defer close(t, conn)
t.Cleanup(func() { require.NoError(t, conn.Close()) })
require.NoError(t, err)
manager := NewConfigManager(conn)
resp, err := manager.GetSamplingStrategy(context.Background(), "any")
Expand Down
6 changes: 3 additions & 3 deletions plugin/sampling/strategyprovider/static/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func deepCopy(s *api_v2.SamplingStrategyResponse) *api_v2.SamplingStrategyRespon
enc := gob.NewEncoder(&buf)
dec := gob.NewDecoder(&buf)
enc.Encode(*s)
var copy api_v2.SamplingStrategyResponse
dec.Decode(&copy)
return &copy
var copyValue api_v2.SamplingStrategyResponse
dec.Decode(&copyValue)
return &copyValue
}

0 comments on commit 8921d0b

Please sign in to comment.