Merge pull request #46696 from corhere/backport-20.10/go1.20-enablement

[20.10 backport] Go 1.20 Enablement
This commit is contained in:
Cory Snider 2023-10-23 16:36:49 -04:00 committed by GitHub
commit cb47414f41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 12 additions and 5 deletions

View file

@ -356,6 +356,7 @@ func TestVerifyPlatformContainerResources(t *testing.T) {
},
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
warnings, err := verifyPlatformContainerResources(&tc.resources, &tc.sysInfo, tc.update)

View file

@ -1374,7 +1374,7 @@ func TestCollectBatchWithDuplicateTimestamps(t *testing.T) {
for i := 0; i < times; i++ {
line := fmt.Sprintf("%d", i)
if i%2 == 0 {
timestamp.Add(1 * time.Nanosecond)
timestamp = timestamp.Add(1 * time.Nanosecond)
}
stream.Log(&logger.Message{
Line: []byte(line),

View file

@ -382,7 +382,7 @@ func TestMaxDownloadAttempts(t *testing.T) {
name: "max-attempts=5, fail at 6th attempt",
simulateRetries: 6,
maxDownloadAttempts: 5,
expectedErr: "simulating download attempt 5/6",
expectedErr: "simulating download attempt 6/6",
},
{
name: "max-attempts=0, fail after 1 attempt",
@ -392,6 +392,7 @@ func TestMaxDownloadAttempts(t *testing.T) {
},
}
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
layerStore := &mockLayerStore{make(map[layer.ChainID]*mockLayer)}

View file

@ -1,6 +1,6 @@
#!/bin/sh
: "${GOLANGCI_LINT_VERSION=v1.49.0}"
: "${GOLANGCI_LINT_VERSION=v1.51.2}"
install_golangci_lint() {
set -e

View file

@ -90,6 +90,7 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
client := testEnv.APIClient()
ctx := context.Background()
for _, c := range cases {
c := c
t.Run(c.name, func(t *testing.T) {
t.Parallel()
dockerfile := []byte(c.dockerfile)

View file

@ -13,12 +13,12 @@ func TestContainerInvalidJSON(t *testing.T) {
defer setupTest(t)()
endpoints := []string{
"/containers/foobar/copy",
"/containers/foobar/exec",
"/exec/foobar/start",
}
for _, ep := range endpoints {
ep := ep
t.Run(ep, func(t *testing.T) {
t.Parallel()

View file

@ -72,6 +72,7 @@ func TestNetworkInvalidJSON(t *testing.T) {
}
for _, ep := range endpoints {
ep := ep
t.Run(ep, func(t *testing.T) {
t.Parallel()
@ -105,6 +106,7 @@ func TestNetworkList(t *testing.T) {
}
for _, ep := range endpoints {
ep := ep
t.Run(ep, func(t *testing.T) {
t.Parallel()

View file

@ -35,6 +35,7 @@ func TestPluginInvalidJSON(t *testing.T) {
endpoints := []string{"/plugins/foobar/set"}
for _, ep := range endpoints {
ep := ep
t.Run(ep, func(t *testing.T) {
t.Parallel()

View file

@ -110,6 +110,7 @@ func TestVolumesInvalidJSON(t *testing.T) {
endpoints := []string{"/volumes/create"}
for _, ep := range endpoints {
ep := ep
t.Run(ep, func(t *testing.T) {
t.Parallel()

View file

@ -648,7 +648,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
}
}
case tar.TypeReg, tar.TypeRegA:
case tar.TypeReg:
// Source is regular file. We use system.OpenFileSequential to use sequential
// file access to avoid depleting the standby list on Windows.
// On Linux, this equates to a regular os.OpenFile