Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions common/pkg/secrets/secretsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ func (s *SecretsManager) loadDB() error {
return err
}
defer file.Close()
if err != nil {
return err
}

byteValue, err := io.ReadAll(file)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion image/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ func TestNamespaces(t *testing.T) {
for _, namespace := range namespaces {
t.Logf("namespace: %q", namespace)
err = Transport.ValidatePolicyConfigurationScope(namespace)
if ref == nil {
if err != nil {
t.Fatalf("ValidatePolicyConfigurationScope(%q) returned error: %v", namespace, err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/drivers/chown_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ func newLChowner() *platformChowner {
}

func (c *platformChowner) LChown(path string, info os.FileInfo, toHost, toContainer *idtools.IDMappings) error {
return &os.PathError{"lchown", path, syscall.EWINDOWS}
return &os.PathError{Op: "lchown", Path: path, Err: syscall.EWINDOWS}
}
1 change: 0 additions & 1 deletion storage/drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ var untar = chrootarchive.UntarUncompressed

const (
defaultPerms = os.FileMode(0o555)
selinuxLabelTest = "system_u:object_r:container_file_t:s0"
mountProgramFlagFile = ".has-mount-program"
)

Expand Down
4 changes: 1 addition & 3 deletions storage/pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ const PaxSchilyXattr = "SCHILY.xattr."

const (
tarExt = "tar"
solaris = "solaris"
windows = "windows"
darwin = "darwin"
freebsd = "freebsd"
)

var xattrsToIgnore = map[string]any{
Expand Down Expand Up @@ -417,7 +415,7 @@ func FileInfoHeader(name string, fi os.FileInfo, link string) (*tar.Header, erro
return nil, fmt.Errorf("tar: cannot canonicalize path: %w", err)
}
hdr.Name = name
setHeaderForSpecialDevice(hdr, name, fi.Sys())
setHeaderForSpecialDevice(hdr, fi.Sys())
return hdr, nil
}

Expand Down
2 changes: 1 addition & 1 deletion storage/pkg/archive/archive_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"golang.org/x/sys/unix"
)

func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo, forceMask *os.FileMode) error {
func handleLChmod(_ *tar.Header, path string, hdrInfo os.FileInfo, forceMask *os.FileMode) error {
permissionsMask := hdrInfo.Mode()
if forceMask != nil {
permissionsMask = *forceMask
Expand Down
2 changes: 1 addition & 1 deletion storage/pkg/archive/archive_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package archive

func GetWhiteoutConverter(format WhiteoutFormat, data any) TarWhiteoutConverter {
func GetWhiteoutConverter(_ WhiteoutFormat, _ any) TarWhiteoutConverter {
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions storage/pkg/archive/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import (
"go.podman.io/storage/pkg/idtools"
)

const (
solaris = "solaris"
)

var defaultArchiver = NewDefaultArchiver()

func defaultTarUntar(src, dst string) error {
Expand Down
2 changes: 1 addition & 1 deletion storage/pkg/archive/archive_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func chmodTarEntry(perm os.FileMode) os.FileMode {
return perm // noop for unix as golang APIs provide perm bits correctly
}

func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat any) {
func setHeaderForSpecialDevice(hdr *tar.Header, stat any) {
s, ok := stat.(*syscall.Stat_t)

if ok {
Expand Down
4 changes: 4 additions & 0 deletions storage/pkg/archive/archive_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import (
"golang.org/x/sys/unix"
)

const (
freebsd = "freebsd"
)

func TestCanonicalTarNameForPath(t *testing.T) {
cases := []struct{ in, expected string }{
{"foo", "foo"},
Expand Down
12 changes: 6 additions & 6 deletions storage/pkg/archive/archive_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,28 @@ func chmodTarEntry(perm os.FileMode) os.FileMode {
return noPermPart | permPart
}

func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) {
func setHeaderForSpecialDevice(hdr *tar.Header, stat any) {
// do nothing. no notion of Rdev, Nlink in stat on Windows
}

func getInodeFromStat(stat interface{}) uint64 {
func getInodeFromStat(_ any) uint64 {
// do nothing. no notion of Inode in stat on Windows
return 0
}

// handleTarTypeBlockCharFifo is an OS-specific helper function used by
// createTarFile to handle the following types of header: Block; Char; Fifo
func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error {
func handleTarTypeBlockCharFifo(_ *tar.Header, _ string) error {
return nil
}

func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo, forceMask *os.FileMode) error {
func handleLChmod(_ *tar.Header, _ string, _ os.FileInfo, _ *os.FileMode) error {
return nil
}

func getFileUIDGID(stat interface{}) (idtools.IDPair, error) {
func getFileUIDGID(_ any) (idtools.IDPair, error) {
// no notion of file ownership mapping yet on Windows
return idtools.IDPair{0, 0}, nil
return idtools.IDPair{UID: 0, GID: 0}, nil
}

// Hardlink without following symlinks
Expand Down
6 changes: 3 additions & 3 deletions storage/pkg/archive/changes_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"go.podman.io/storage/pkg/system"
)

func statDifferent(oldStat *system.StatT, oldInfo *FileInfo, newStat *system.StatT, newInfo *FileInfo) bool {
func statDifferent(oldStat *system.StatT, _ *FileInfo, newStat *system.StatT, _ *FileInfo) bool {
// Don't look at size for dirs, its not a good measure of change
if oldStat.Mtim() != newStat.Mtim() ||
oldStat.Mode() != newStat.Mode() ||
Expand All @@ -20,10 +20,10 @@ func (info *FileInfo) isDir() bool {
return info.parent == nil || info.stat.Mode().IsDir()
}

func getIno(fi os.FileInfo) uint64 {
func getIno(_ os.FileInfo) uint64 {
return 0
}

func hasHardlinks(fi os.FileInfo) bool {
func hasHardlinks(_ os.FileInfo) bool {
return false
}
2 changes: 1 addition & 1 deletion storage/pkg/archive/changes_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package archive

func resetSymlinkTimes(path string) error {
func resetSymlinkTimes(_ string) error {
return nil
}
2 changes: 1 addition & 1 deletion storage/pkg/archive/fflags_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ func WriteFileFlagsFromTarHeader(path string, hdr *tar.Header) error {
return nil
}

func resetImmutable(path string, fi *os.FileInfo) error {
func resetImmutable(_ string, _ *os.FileInfo) error {
return nil
}
2 changes: 1 addition & 1 deletion storage/pkg/system/chtimes_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import (
// setCTime will set the create time on a file. On Unix, the create
// time is updated as a side effect of setting the modified time, so
// no action is required.
func setCTime(path string, ctime time.Time) error {
func setCTime(_ string, _ time.Time) error {
return nil
}
2 changes: 1 addition & 1 deletion storage/pkg/system/path_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "testing"
func TestCheckSystemDriveAndRemoveDriveLetter(t *testing.T) {
// Fails if not C drive.
path, err := CheckSystemDriveAndRemoveDriveLetter(`d:\`)
if err == nil || (err != nil && err.Error() != "The specified path is not on the system drive (C:)") {
if err == nil || err.Error() != "The specified path is not on the system drive (C:)" {
t.Fatalf("Expected error for d:")
}

Expand Down
2 changes: 1 addition & 1 deletion storage/pkg/system/rm_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ package system

// Reset file flags in a directory tree. This allows EnsureRemoveAll
// to delete trees which have the immutable flag set.
func resetFileFlags(dir string) error {
func resetFileFlags(_ string) error {
return nil
}