api/types/network: remove redundant capturing of loop vars (copyloopvar)

api/types/network/endpoint_test.go:84:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^
    api/types/network/endpoint_test.go:166:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^
    api/types/network/ipam_test.go:127:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-11-12 13:15:09 +01:00
parent 0fc7b1c201
commit b5b077f2ea
2 changed files with 6 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ func (stub subnetStub) Contains(addr net.IP) bool {
}
func TestEndpointIPAMConfigWithOutOfRangeAddrs(t *testing.T) {
testcases := []struct {
tests := []struct {
name string
ipamConfig *EndpointIPAMConfig
v4Subnets []NetworkSubnet
@@ -80,8 +80,7 @@ func TestEndpointIPAMConfigWithOutOfRangeAddrs(t *testing.T) {
},
}
for _, tc := range testcases {
tc := tc
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
@@ -105,7 +104,7 @@ func TestEndpointIPAMConfigWithOutOfRangeAddrs(t *testing.T) {
}
func TestEndpointIPAMConfigWithInvalidConfig(t *testing.T) {
testcases := []struct {
tests := []struct {
name string
ipamConfig *EndpointIPAMConfig
expectedErrors []string
@@ -162,8 +161,7 @@ func TestEndpointIPAMConfigWithInvalidConfig(t *testing.T) {
},
}
for _, tc := range testcases {
tc := tc
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

View File

@@ -8,7 +8,7 @@ import (
)
func TestNetworkWithInvalidIPAM(t *testing.T) {
testcases := []struct {
tests := []struct {
name string
ipam IPAM
ipv6 bool
@@ -123,8 +123,7 @@ func TestNetworkWithInvalidIPAM(t *testing.T) {
},
}
for _, tc := range testcases {
tc := tc
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()