core/lint: upgrade golangci-lint, replace interface{} with any (#5099)

* core/lint: upgrade golangci-lint, replace interface{} with any

* regen proto
This commit is contained in:
Caleb Doxsey 2024-05-02 14:33:52 -06:00 committed by GitHub
parent 614048ae9c
commit 1a5b8b606f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
135 changed files with 341 additions and 340 deletions

View file

@ -61,7 +61,7 @@ func NewGRPCClientConn(ctx context.Context, opts *Options, other ...grpc.DialOpt
// grpcTimeoutInterceptor enforces per-RPC request timeouts
func grpcTimeoutInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor {
return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
if timeout <= 0 {
return invoker(ctx, method, req, reply, cc, opts...)
}

View file

@ -10,7 +10,7 @@ import (
func Test_grpcTimeoutInterceptor(t *testing.T) {
mockInvoker := func(sleepTime time.Duration, wantFail bool) grpc.UnaryInvoker {
return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, opts ...grpc.CallOption) error {
return func(ctx context.Context, _ string, _, _ any, _ *grpc.ClientConn, _ ...grpc.CallOption) error {
time.Sleep(sleepTime)
deadline, ok := ctx.Deadline()
if !ok {

View file

@ -69,7 +69,7 @@ func TestInitialSync(t *testing.T) {
r2 := new(Record)
m := &mockServer{
syncLatest: func(req *SyncLatestRequest, stream DataBrokerService_SyncLatestServer) error {
syncLatest: func(_ *SyncLatestRequest, stream DataBrokerService_SyncLatestServer) error {
stream.Send(&SyncLatestResponse{
Response: &SyncLatestResponse_Record{
Record: r1,

View file

@ -126,7 +126,7 @@ func TestLeaser(t *testing.T) {
AnyTimes()
handler.EXPECT().
RunLeased(gomock.Any()).
DoAndReturn(func(ctx context.Context) error {
DoAndReturn(func(_ context.Context) error {
time.Sleep(time.Millisecond * 20)
return exitErr
}).
@ -162,7 +162,7 @@ func TestLeasers(t *testing.T) {
Times(1)
var counter int64
fn1 := func(ctx context.Context) error {
fn1 := func(_ context.Context) error {
atomic.AddInt64(&counter, 1)
return exitErr
}

View file

@ -87,7 +87,7 @@ func TestSyncer(t *testing.T) {
}
return nil
},
syncLatest: func(req *SyncLatestRequest, server DataBrokerService_SyncLatestServer) error {
syncLatest: func(_ *SyncLatestRequest, server DataBrokerService_SyncLatestServer) error {
syncLatestCount++
switch syncLatestCount {
case 1:
@ -161,10 +161,10 @@ func TestSyncer(t *testing.T) {
getDataBrokerServiceClient: func() DataBrokerServiceClient {
return NewDataBrokerServiceClient(gc)
},
clearRecords: func(ctx context.Context) {
clearRecords: func(_ context.Context) {
clearCh <- struct{}{}
},
updateRecords: func(ctx context.Context, serverVersion uint64, records []*Record) {
updateRecords: func(_ context.Context, _ uint64, records []*Record) {
updateCh <- records
},
})

View file

@ -61,8 +61,8 @@ func (x *User) AddClaims(claims identity.FlattenedClaims) {
// GetClaim returns a claim.
//
// This method is used by the dashboard template HTML to display claim data.
func (x *User) GetClaim(claim string) []interface{} {
var vs []interface{}
func (x *User) GetClaim(claim string) []any {
var vs []any
for _, sv := range x.GetClaims()[claim].GetValues() {
vs = append(vs, sv.AsInterface())
}