diff --git a/distribution/pull_v2.go b/distribution/pull_v2.go index 9efe477cc0..c81af5e6e7 100644 --- a/distribution/pull_v2.go +++ b/distribution/pull_v2.go @@ -200,7 +200,7 @@ func (ld *v2LayerDescriptor) Download(ctx context.Context, progressOutput progre } if offset != 0 { - _, err := layerDownload.Seek(offset, os.SEEK_SET) + _, err := layerDownload.Seek(offset, io.SeekStart) if err != nil { if err := ld.truncateDownloadFile(); err != nil { return nil, 0, xfer.DoNotRetry{Err: err} @@ -226,7 +226,7 @@ func (ld *v2LayerDescriptor) Download(ctx context.Context, progressOutput progre // Restore the seek offset either at the beginning of the // stream, or just after the last byte we have from previous // attempts. - _, err = layerDownload.Seek(offset, os.SEEK_SET) + _, err = layerDownload.Seek(offset, io.SeekStart) if err != nil { return nil, 0, err } @@ -272,7 +272,7 @@ func (ld *v2LayerDescriptor) Download(ctx context.Context, progressOutput progre logrus.Debugf("Downloaded %s to tempfile %s", ld.ID(), tmpFile.Name()) - _, err = tmpFile.Seek(0, os.SEEK_SET) + _, err = tmpFile.Seek(0, io.SeekStart) if err != nil { tmpFile.Close() if err := os.Remove(tmpFile.Name()); err != nil { @@ -310,7 +310,7 @@ func (ld *v2LayerDescriptor) truncateDownloadFile() error { // Need a new hash context since we will be redoing the download ld.verifier = nil - if _, err := ld.tmpFile.Seek(0, os.SEEK_SET); err != nil { + if _, err := ld.tmpFile.Seek(0, io.SeekStart); err != nil { logrus.Errorf("error seeking to beginning of download file: %v", err) return err } diff --git a/distribution/pull_v2_windows.go b/distribution/pull_v2_windows.go index 1162e9a8bb..52ab890745 100644 --- a/distribution/pull_v2_windows.go +++ b/distribution/pull_v2_windows.go @@ -4,8 +4,8 @@ import ( "context" "errors" "fmt" + "io" "net/http" - "os" "runtime" "sort" "strconv" @@ -41,7 +41,7 @@ func (ld *v2LayerDescriptor) open(ctx context.Context) (distribution.ReadSeekClo // We're done if the registry has this blob. if err == nil { // Seek does an HTTP GET. If it succeeds, the blob really is accessible. - if _, err = rsc.Seek(0, os.SEEK_SET); err == nil { + if _, err = rsc.Seek(0, io.SeekStart); err == nil { return rsc, nil } rsc.Close() @@ -53,7 +53,7 @@ func (ld *v2LayerDescriptor) open(ctx context.Context) (distribution.ReadSeekClo rsc = transport.NewHTTPReadSeeker(http.DefaultClient, url, nil) // Seek does an HTTP GET. If it succeeds, the blob really is accessible. - _, err = rsc.Seek(0, os.SEEK_SET) + _, err = rsc.Seek(0, io.SeekStart) if err == nil { break } diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 37af272257..6a874eb981 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -2217,7 +2217,7 @@ func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T) err = configFile.Truncate(0) assert.NilError(c, err) - _, err = configFile.Seek(0, os.SEEK_SET) + _, err = configFile.Seek(0, io.SeekStart) assert.NilError(c, err) _, err = configFile.Write([]byte(daemonConfig))