Skip to content

Commit

Permalink
lint: silence "SA1019: tar.TypeRegA has been deprecated... (staticheck)"
Browse files Browse the repository at this point in the history
"SA1019: tar.TypeRegA has been deprecated since Go 1.11 and an alternative has been available since Go 1.1:
Use TypeReg instead. (staticcheck)"

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 9b510e9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
AkihiroSuda authored and thaJeztah committed Aug 28, 2023
1 parent 6648df1 commit fec784a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions archive/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ func createTarFile(ctx context.Context, path, extractDir string, hdr *tar.Header
}
}

//nolint:staticcheck // TypeRegA is deprecated but we may still receive an external tar with TypeRegA
case tar.TypeReg, tar.TypeRegA:
file, err := openFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, hdrInfo.Mode())
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions images/archive/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func ImportIndex(ctx context.Context, store content.Store, reader io.Reader, opt
symlinks[hdr.Name] = path.Join(path.Dir(hdr.Name), hdr.Linkname)
}

//nolint:staticcheck // TypeRegA is deprecated but we may still receive an external tar with TypeRegA
if hdr.Typeflag != tar.TypeReg && hdr.Typeflag != tar.TypeRegA {
if hdr.Typeflag != tar.TypeDir {
log.G(ctx).WithField("file", hdr.Name).Debug("file type ignored")
Expand Down

0 comments on commit fec784a

Please sign in to comment.