Browse code

Merge pull request #40249 from thaJeztah/os_seek_deprecated

remove use of deprecated os.SEEK_END

Akihiro Suda authored on 2019/11/26 12:06:29
Showing 2 changed files
... ...
@@ -116,7 +116,7 @@ func NewLogFile(logPath string, capacity int64, maxFiles int, compress bool, mar
116 116
 		return nil, err
117 117
 	}
118 118
 
119
-	size, err := log.Seek(0, os.SEEK_END)
119
+	size, err := log.Seek(0, io.SeekEnd)
120 120
 	if err != nil {
121 121
 		return nil, err
122 122
 	}
... ...
@@ -472,7 +472,7 @@ func decompressfile(fileName, destFileName string, since time.Time) (*os.File, e
472 472
 func newSectionReader(f *os.File) (*io.SectionReader, error) {
473 473
 	// seek to the end to get the size
474 474
 	// we'll leave this at the end of the file since section reader does not advance the reader
475
-	size, err := f.Seek(0, os.SEEK_END)
475
+	size, err := f.Seek(0, io.SeekEnd)
476 476
 	if err != nil {
477 477
 		return nil, errors.Wrap(err, "error getting current file size")
478 478
 	}
... ...
@@ -174,7 +174,7 @@ func (ld *v2LayerDescriptor) Download(ctx context.Context, progressOutput progre
174 174
 			return nil, 0, xfer.DoNotRetry{Err: err}
175 175
 		}
176 176
 	} else {
177
-		offset, err = ld.tmpFile.Seek(0, os.SEEK_END)
177
+		offset, err = ld.tmpFile.Seek(0, io.SeekEnd)
178 178
 		if err != nil {
179 179
 			logrus.Debugf("error seeking to end of download file: %v", err)
180 180
 			offset = 0
... ...
@@ -209,7 +209,7 @@ func (ld *v2LayerDescriptor) Download(ctx context.Context, progressOutput progre
209 209
 			return nil, 0, err
210 210
 		}
211 211
 	}
212
-	size, err := layerDownload.Seek(0, os.SEEK_END)
212
+	size, err := layerDownload.Seek(0, io.SeekEnd)
213 213
 	if err != nil {
214 214
 		// Seek failed, perhaps because there was no Content-Length
215 215
 		// header. This shouldn't fail the download, because we can