Skip to content

Commit 78b6b04

Browse files
committed
fix: golangci-lint issues
1 parent 469dd1f commit 78b6b04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+169
-174
lines changed

agent/cache-types/catalog_list_services.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ func (c *CatalogListServices) Fetch(opts cache.FetchOptions, req cache.Request)
3535
reqReal = &dup
3636

3737
// Set the minimum query index to our current index so we block
38-
reqReal.QueryOptions.MinQueryIndex = opts.MinIndex
39-
reqReal.QueryOptions.MaxQueryTime = opts.Timeout
38+
reqReal.MinQueryIndex = opts.MinIndex
39+
reqReal.MaxQueryTime = opts.Timeout
4040

4141
// Always allow stale - there's no point in hitting leader if the request is
4242
// going to be served from cache and end up arbitrarily stale anyway. This
4343
// allows cached service-discover to automatically read scale across all
4444
// servers too.
45-
reqReal.QueryOptions.AllowStale = true
45+
reqReal.AllowStale = true
4646

4747
if opts.LastResult != nil {
48-
reqReal.QueryOptions.AllowNotModifiedResponse = true
48+
reqReal.AllowNotModifiedResponse = true
4949
}
5050

5151
var reply structs.IndexedServices
@@ -54,7 +54,7 @@ func (c *CatalogListServices) Fetch(opts cache.FetchOptions, req cache.Request)
5454
}
5555

5656
result.Value = &reply
57-
result.Index = reply.QueryMeta.Index
58-
result.NotModified = reply.QueryMeta.NotModified
57+
result.Index = reply.Index
58+
result.NotModified = reply.NotModified
5959
return result, nil
6060
}

agent/cache-types/catalog_list_services_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ func TestCatalogListServices(t *testing.T) {
2525
rpc.On("RPC", mock.Anything, "Catalog.ListServices", mock.Anything, mock.Anything).Return(nil).
2626
Run(func(args mock.Arguments) {
2727
req := args.Get(2).(*structs.DCSpecificRequest)
28-
require.Equal(t, uint64(24), req.QueryOptions.MinQueryIndex)
29-
require.Equal(t, 1*time.Second, req.QueryOptions.MaxQueryTime)
28+
require.Equal(t, uint64(24), req.MinQueryIndex)
29+
require.Equal(t, 1*time.Second, req.MaxQueryTime)
3030
require.True(t, req.AllowStale)
3131

3232
reply := args.Get(3).(*structs.IndexedServices)
3333
reply.Services = map[string][]string{
3434
"foo": {"prod", "linux"},
3535
"bar": {"qa", "windows"},
3636
}
37-
reply.QueryMeta.Index = 48
37+
reply.Index = 48
3838
resp = reply
3939
})
4040

@@ -86,7 +86,7 @@ func TestCatalogListServices_IntegrationWithCache_NotModifiedResponse(t *testing
8686
require.True(t, req.AllowNotModifiedResponse)
8787

8888
reply := args.Get(3).(*structs.IndexedServices)
89-
reply.QueryMeta.Index = 44
89+
reply.Index = 44
9090
reply.NotModified = true
9191
})
9292

agent/cache-types/catalog_service_list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func (c *CatalogServiceList) Fetch(opts cache.FetchOptions, req cache.Request) (
3535
reqReal = &dup
3636

3737
// Set the minimum query index to our current index so we block
38-
reqReal.QueryOptions.MinQueryIndex = opts.MinIndex
39-
reqReal.QueryOptions.MaxQueryTime = opts.Timeout
38+
reqReal.MinQueryIndex = opts.MinIndex
39+
reqReal.MaxQueryTime = opts.Timeout
4040

4141
// Always allow stale - there's no point in hitting leader if the request is
4242
// going to be served from cache and end up arbitrarily stale anyway. This
@@ -51,6 +51,6 @@ func (c *CatalogServiceList) Fetch(opts cache.FetchOptions, req cache.Request) (
5151
}
5252

5353
result.Value = &reply
54-
result.Index = reply.QueryMeta.Index
54+
result.Index = reply.Index
5555
return result, nil
5656
}

agent/cache-types/catalog_service_list_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ func TestCatalogServiceList(t *testing.T) {
2424
rpc.On("RPC", mock.Anything, "Catalog.ServiceList", mock.Anything, mock.Anything).Return(nil).
2525
Run(func(args mock.Arguments) {
2626
req := args.Get(2).(*structs.DCSpecificRequest)
27-
require.Equal(t, uint64(24), req.QueryOptions.MinQueryIndex)
28-
require.Equal(t, 1*time.Second, req.QueryOptions.MaxQueryTime)
27+
require.Equal(t, uint64(24), req.MinQueryIndex)
28+
require.Equal(t, 1*time.Second, req.MaxQueryTime)
2929
require.True(t, req.AllowStale)
3030

3131
reply := args.Get(3).(*structs.IndexedServiceList)
@@ -37,7 +37,7 @@ func TestCatalogServiceList(t *testing.T) {
3737
Name: "bar",
3838
},
3939
}
40-
reply.QueryMeta.Index = 48
40+
reply.Index = 48
4141
resp = reply
4242
})
4343

agent/cache-types/catalog_services.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func (c *CatalogServices) Fetch(opts cache.FetchOptions, req cache.Request) (cac
3636
reqReal = &dup
3737

3838
// Set the minimum query index to our current index so we block
39-
reqReal.QueryOptions.MinQueryIndex = opts.MinIndex
40-
reqReal.QueryOptions.MaxQueryTime = opts.Timeout
39+
reqReal.MinQueryIndex = opts.MinIndex
40+
reqReal.MaxQueryTime = opts.Timeout
4141

4242
// Always allow stale - there's no point in hitting leader if the request is
4343
// going to be served from cache and end up arbitrarily stale anyway. This
@@ -52,6 +52,6 @@ func (c *CatalogServices) Fetch(opts cache.FetchOptions, req cache.Request) (cac
5252
}
5353

5454
result.Value = &reply
55-
result.Index = reply.QueryMeta.Index
55+
result.Index = reply.Index
5656
return result, nil
5757
}

agent/cache-types/catalog_services_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ func TestCatalogServices(t *testing.T) {
2525
rpc.On("RPC", mock.Anything, "Catalog.ServiceNodes", mock.Anything, mock.Anything).Return(nil).
2626
Run(func(args mock.Arguments) {
2727
req := args.Get(2).(*structs.ServiceSpecificRequest)
28-
require.Equal(t, uint64(24), req.QueryOptions.MinQueryIndex)
29-
require.Equal(t, 1*time.Second, req.QueryOptions.MaxQueryTime)
28+
require.Equal(t, uint64(24), req.MinQueryIndex)
29+
require.Equal(t, 1*time.Second, req.MaxQueryTime)
3030
require.Equal(t, "web", req.ServiceName)
3131
require.True(t, req.AllowStale)
3232

3333
reply := args.Get(3).(*structs.IndexedServiceNodes)
3434
reply.ServiceNodes = []*structs.ServiceNode{
3535
{ServiceTags: req.ServiceTags},
3636
}
37-
reply.QueryMeta.Index = 48
37+
reply.Index = 48
3838
resp = reply
3939
})
4040

agent/cache-types/config_entry.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func (c *ConfigEntryList) Fetch(opts cache.FetchOptions, req cache.Request) (cac
3838
reqReal = &dup
3939

4040
// Set the minimum query index to our current index so we block
41-
reqReal.QueryOptions.MinQueryIndex = opts.MinIndex
42-
reqReal.QueryOptions.MaxQueryTime = opts.Timeout
41+
reqReal.MinQueryIndex = opts.MinIndex
42+
reqReal.MaxQueryTime = opts.Timeout
4343

4444
// Always allow stale - there's no point in hitting leader if the request is
4545
// going to be served from cache and endup arbitrarily stale anyway. This
@@ -54,7 +54,7 @@ func (c *ConfigEntryList) Fetch(opts cache.FetchOptions, req cache.Request) (cac
5454
}
5555

5656
result.Value = &reply
57-
result.Index = reply.QueryMeta.Index
57+
result.Index = reply.Index
5858
return result, nil
5959
}
6060

@@ -79,8 +79,8 @@ func (c *ConfigEntry) Fetch(opts cache.FetchOptions, req cache.Request) (cache.F
7979
reqReal = &dup
8080

8181
// Set the minimum query index to our current index so we block
82-
reqReal.QueryOptions.MinQueryIndex = opts.MinIndex
83-
reqReal.QueryOptions.MaxQueryTime = opts.Timeout
82+
reqReal.MinQueryIndex = opts.MinIndex
83+
reqReal.MaxQueryTime = opts.Timeout
8484

8585
// Always allow stale - there's no point in hitting leader if the request is
8686
// going to be served from cache and endup arbitrarily stale anyway. This
@@ -95,6 +95,6 @@ func (c *ConfigEntry) Fetch(opts cache.FetchOptions, req cache.Request) (cache.F
9595
}
9696

9797
result.Value = &reply
98-
result.Index = reply.QueryMeta.Index
98+
result.Index = reply.Index
9999
return result, nil
100100
}

agent/cache-types/config_entry_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ func TestConfigEntries(t *testing.T) {
2424
rpc.On("RPC", mock.Anything, "ConfigEntry.List", mock.Anything, mock.Anything).Return(nil).
2525
Run(func(args mock.Arguments) {
2626
req := args.Get(2).(*structs.ConfigEntryQuery)
27-
require.Equal(t, uint64(24), req.QueryOptions.MinQueryIndex)
28-
require.Equal(t, 1*time.Second, req.QueryOptions.MaxQueryTime)
27+
require.Equal(t, uint64(24), req.MinQueryIndex)
28+
require.Equal(t, 1*time.Second, req.MaxQueryTime)
2929
require.True(t, req.AllowStale)
3030
require.Equal(t, structs.ServiceResolver, req.Kind)
3131
require.Equal(t, "", req.Name)
@@ -36,7 +36,7 @@ func TestConfigEntries(t *testing.T) {
3636
&structs.ServiceResolverConfigEntry{Kind: structs.ServiceResolver, Name: "foo"},
3737
&structs.ServiceResolverConfigEntry{Kind: structs.ServiceResolver, Name: "bar"},
3838
}
39-
reply.QueryMeta.Index = 48
39+
reply.Index = 48
4040
resp = reply
4141
})
4242

@@ -67,8 +67,8 @@ func TestConfigEntry(t *testing.T) {
6767
rpc.On("RPC", mock.Anything, "ConfigEntry.Get", mock.Anything, mock.Anything).Return(nil).
6868
Run(func(args mock.Arguments) {
6969
req := args.Get(2).(*structs.ConfigEntryQuery)
70-
require.Equal(t, uint64(24), req.QueryOptions.MinQueryIndex)
71-
require.Equal(t, 1*time.Second, req.QueryOptions.MaxQueryTime)
70+
require.Equal(t, uint64(24), req.MinQueryIndex)
71+
require.Equal(t, 1*time.Second, req.MaxQueryTime)
7272
require.True(t, req.AllowStale)
7373
require.Equal(t, structs.ServiceResolver, req.Kind)
7474
require.Equal(t, "foo", req.Name)
@@ -79,7 +79,7 @@ func TestConfigEntry(t *testing.T) {
7979
}
8080
reply := args.Get(3).(*structs.ConfigEntryResponse)
8181
reply.Entry = entry
82-
reply.QueryMeta.Index = 48
82+
reply.Index = 48
8383
resp = reply
8484
})
8585

agent/cache-types/connect_ca_root.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func (c *ConnectCARoot) Fetch(opts cache.FetchOptions, req cache.Request) (cache
3838
reqReal = &dup
3939

4040
// Set the minimum query index to our current index so we block
41-
reqReal.QueryOptions.MinQueryIndex = opts.MinIndex
42-
reqReal.QueryOptions.MaxQueryTime = opts.Timeout
41+
reqReal.MinQueryIndex = opts.MinIndex
42+
reqReal.MaxQueryTime = opts.Timeout
4343

4444
// Fetch
4545
var reply structs.IndexedCARoots
@@ -48,6 +48,6 @@ func (c *ConnectCARoot) Fetch(opts cache.FetchOptions, req cache.Request) (cache
4848
}
4949

5050
result.Value = &reply
51-
result.Index = reply.QueryMeta.Index
51+
result.Index = reply.Index
5252
return result, nil
5353
}

agent/cache-types/connect_ca_root_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ func TestConnectCARoot(t *testing.T) {
2525
rpc.On("RPC", mock.Anything, "ConnectCA.Roots", mock.Anything, mock.Anything).Return(nil).
2626
Run(func(args mock.Arguments) {
2727
req := args.Get(2).(*structs.DCSpecificRequest)
28-
require.Equal(t, uint64(24), req.QueryOptions.MinQueryIndex)
29-
require.Equal(t, 1*time.Second, req.QueryOptions.MaxQueryTime)
28+
require.Equal(t, uint64(24), req.MinQueryIndex)
29+
require.Equal(t, 1*time.Second, req.MaxQueryTime)
3030

3131
reply := args.Get(3).(*structs.IndexedCARoots)
32-
reply.QueryMeta.Index = 48
32+
reply.Index = 48
3333
resp = reply
3434
})
3535

0 commit comments

Comments
 (0)