mirror of
https://github.com/containers/buildah.git
synced 2025-04-18 07:04:05 +03:00
linters: unused arguments shouldn't have names
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
6224e9a44e
commit
fdf1c75cd3
2
add.go
2
add.go
@ -567,7 +567,7 @@ func (b *Builder) Add(destination string, extract bool, options AddAndCopyOption
|
||||
return false, false, nil
|
||||
})
|
||||
}
|
||||
writer = newTarFilterer(writer, func(hdr *tar.Header) (bool, bool, io.Reader) {
|
||||
writer = newTarFilterer(writer, func(_ *tar.Header) (bool, bool, io.Reader) {
|
||||
itemsCopied++
|
||||
return false, false, nil
|
||||
})
|
||||
|
@ -225,7 +225,7 @@ func makeRlimit(limit specs.POSIXRlimit) unix.Rlimit {
|
||||
return unix.Rlimit{Cur: limit.Soft, Max: limit.Hard}
|
||||
}
|
||||
|
||||
func createPlatformContainer(options runUsingChrootExecSubprocOptions) error {
|
||||
func createPlatformContainer(_ runUsingChrootExecSubprocOptions) error {
|
||||
return errors.New("unsupported createPlatformContainer")
|
||||
}
|
||||
|
||||
|
@ -127,9 +127,9 @@ func TestMinimalSkeleton(t *testing.T) {
|
||||
t.Skip("tests need to be run as root")
|
||||
}
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(_ *generate.Generator, _, _ string) {
|
||||
},
|
||||
func(t *testing.T, report *types.TestReport) {
|
||||
func(_ *testing.T, _ *types.TestReport) {
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -140,7 +140,7 @@ func TestProcessTerminal(t *testing.T) {
|
||||
}
|
||||
for _, terminal := range []bool{false, true} {
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.SetProcessTerminal(terminal)
|
||||
},
|
||||
func(t *testing.T, report *types.TestReport) {
|
||||
@ -158,7 +158,7 @@ func TestProcessConsoleSize(t *testing.T) {
|
||||
}
|
||||
for _, size := range [][2]uint{{80, 25}, {132, 50}} {
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.SetProcessTerminal(true)
|
||||
g.SetProcessConsoleSize(size[0], size[1])
|
||||
},
|
||||
@ -180,7 +180,7 @@ func TestProcessUser(t *testing.T) {
|
||||
}
|
||||
for _, id := range []uint32{0, 1000} {
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.SetProcessUID(id)
|
||||
g.SetProcessGID(id + 1)
|
||||
g.AddProcessAdditionalGid(id + 2)
|
||||
@ -203,7 +203,7 @@ func TestProcessEnv(t *testing.T) {
|
||||
}
|
||||
e := fmt.Sprintf("PARENT_TEST_PID=%d", unix.Getpid())
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.ClearProcessEnv()
|
||||
g.AddProcessEnv("PARENT_TEST_PID", strconv.Itoa(unix.Getpid()))
|
||||
},
|
||||
@ -223,7 +223,7 @@ func TestProcessCwd(t *testing.T) {
|
||||
t.Skip("tests need to be run as root")
|
||||
}
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, rootDir, _ string) {
|
||||
if err := os.Mkdir(filepath.Join(rootDir, "/no-such-directory"), 0700); err != nil {
|
||||
t.Fatalf("mkdir(%q): %v", filepath.Join(rootDir, "/no-such-directory"), err)
|
||||
}
|
||||
@ -242,7 +242,7 @@ func TestProcessCapabilities(t *testing.T) {
|
||||
t.Skip("tests need to be run as root")
|
||||
}
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.ClearProcessCapabilities()
|
||||
},
|
||||
func(t *testing.T, report *types.TestReport) {
|
||||
@ -252,7 +252,7 @@ func TestProcessCapabilities(t *testing.T) {
|
||||
},
|
||||
)
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.ClearProcessCapabilities()
|
||||
if err := g.AddProcessCapabilityEffective("CAP_IPC_LOCK"); err != nil {
|
||||
t.Fatalf("%v", err)
|
||||
@ -287,7 +287,7 @@ func TestProcessRlimits(t *testing.T) {
|
||||
}
|
||||
for _, limit := range []uint64{100 * 1024 * 1024 * 1024, 200 * 1024 * 1024 * 1024, unix.RLIM_INFINITY} {
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.ClearProcessRlimits()
|
||||
if limit != unix.RLIM_INFINITY {
|
||||
g.AddProcessRlimits("rlimit_as", limit, limit)
|
||||
@ -328,7 +328,7 @@ func TestProcessNoNewPrivileges(t *testing.T) {
|
||||
}
|
||||
for _, nope := range []bool{false, true} {
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.SetProcessNoNewPrivileges(nope)
|
||||
},
|
||||
func(t *testing.T, report *types.TestReport) {
|
||||
@ -346,7 +346,7 @@ func TestProcessOOMScoreAdj(t *testing.T) {
|
||||
}
|
||||
for _, adj := range []int{0, 1, 2, 3} {
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.SetProcessOOMScoreAdj(adj)
|
||||
},
|
||||
func(t *testing.T, report *types.TestReport) {
|
||||
@ -368,7 +368,7 @@ func TestHostname(t *testing.T) {
|
||||
}
|
||||
hostname := fmt.Sprintf("host%d", unix.Getpid())
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.SetHostname(hostname)
|
||||
},
|
||||
func(t *testing.T, report *types.TestReport) {
|
||||
@ -385,7 +385,7 @@ func TestMounts(t *testing.T) {
|
||||
}
|
||||
t.Run("tmpfs", func(t *testing.T) {
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.AddMount(specs.Mount{
|
||||
Source: "tmpfs",
|
||||
Destination: "/was-not-there-before",
|
||||
@ -485,7 +485,7 @@ func TestMounts(t *testing.T) {
|
||||
tmpfsFlags, tmpfsOptions := mount.ParseOptions(tmpfsOptions)
|
||||
require.NoErrorf(t, unix.Mount("none", tmpfsMount, "tmpfs", uintptr(tmpfsFlags), tmpfsOptions), "error mounting a tmpfs with flags=%#x,options=%q at %s", tmpfsFlags, tmpfsOptions, tmpfsMount)
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
fsType := bind.fsType
|
||||
if fsType == "" {
|
||||
fsType = "bind"
|
||||
@ -543,7 +543,7 @@ func TestLinuxIDMapping(t *testing.T) {
|
||||
t.Skip("tests need to be run as root")
|
||||
}
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.ClearLinuxUIDMappings()
|
||||
g.ClearLinuxGIDMappings()
|
||||
g.AddLinuxUIDMapping(uint32(unix.Getuid()), 0, 1)
|
||||
@ -580,7 +580,7 @@ func TestLinuxIDMappingShift(t *testing.T) {
|
||||
t.Skip("tests need to be run as root")
|
||||
}
|
||||
testMinimal(t,
|
||||
func(g *generate.Generator, rootDir, bundleDir string) {
|
||||
func(g *generate.Generator, _, _ string) {
|
||||
g.ClearLinuxUIDMappings()
|
||||
g.ClearLinuxGIDMappings()
|
||||
g.AddLinuxUIDMapping(uint32(unix.Getuid())+1, 0, 1)
|
||||
|
@ -49,7 +49,7 @@ func TestGetStore(t *testing.T) {
|
||||
failTestIfNotRoot(t)
|
||||
testCmd := &cobra.Command{
|
||||
Use: "test",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
_, err := getStore(cmd)
|
||||
return err
|
||||
},
|
||||
|
@ -21,7 +21,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func dumpBoltCmd(c *cobra.Command, args []string) error {
|
||||
func dumpBoltCmd(_ *cobra.Command, args []string) error {
|
||||
db, err := bolt.Open(args[0], 0600, &bolt.Options{ReadOnly: true})
|
||||
if err != nil {
|
||||
return fmt.Errorf("opening database %q: %w", args[0], err)
|
||||
|
@ -28,7 +28,7 @@ func init() {
|
||||
Use: "info",
|
||||
Short: "Display Buildah system information",
|
||||
Long: infoDescription,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
return infoCmd(cmd, opts)
|
||||
},
|
||||
Args: cobra.NoArgs,
|
||||
|
@ -45,13 +45,13 @@ type globalFlags struct {
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "buildah",
|
||||
Long: "A tool that facilitates building OCI images",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
return cmd.Help()
|
||||
},
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
|
||||
return before(cmd)
|
||||
},
|
||||
PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
|
||||
PersistentPostRunE: func(cmd *cobra.Command, _ []string) error {
|
||||
return after(cmd)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
|
@ -623,7 +623,7 @@ func manifestAddCmd(c *cobra.Command, args []string, opts manifestAddOpts) error
|
||||
return err
|
||||
}
|
||||
|
||||
func manifestRemoveCmd(c *cobra.Command, args []string, opts manifestRemoveOpts) error {
|
||||
func manifestRemoveCmd(c *cobra.Command, args []string, _ manifestRemoveOpts) error {
|
||||
listImageSpec := ""
|
||||
var instanceDigest digest.Digest
|
||||
var instanceSpec string
|
||||
|
@ -20,7 +20,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func passwdCmd(c *cobra.Command, args []string) error {
|
||||
func passwdCmd(_ *cobra.Command, args []string) error {
|
||||
passwd, err := bcrypt.GenerateFromPassword([]byte(args[0]), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -17,7 +17,7 @@ var (
|
||||
Use: "source",
|
||||
Short: "Manage source containers",
|
||||
Long: sourceDescription,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@ -34,7 +34,7 @@ var (
|
||||
Short: "Create a source image",
|
||||
Long: sourceCreateDescription,
|
||||
Example: "buildah source create /tmp/fedora:latest-source",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
return source.Create(context.Background(), args[0], sourceCreateOptions)
|
||||
},
|
||||
}
|
||||
@ -51,7 +51,7 @@ var (
|
||||
Short: "Add a source artifact to a source image",
|
||||
Long: sourceAddDescription,
|
||||
Example: "buildah source add /tmp/fedora sources.tar.gz",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
return source.Add(context.Background(), args[0], args[1], sourceAddOptions)
|
||||
},
|
||||
}
|
||||
@ -68,7 +68,7 @@ var (
|
||||
Short: "Pull a source image from a registry to a specified path",
|
||||
Long: sourcePullDescription,
|
||||
Example: "buildah source pull quay.io/sourceimage/example:latest /tmp/sourceimage:latest",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
return source.Pull(context.Background(), args[0], args[1], sourcePullOptions)
|
||||
},
|
||||
}
|
||||
@ -85,7 +85,7 @@ var (
|
||||
Short: "Push a source image from a specified path to a registry",
|
||||
Long: sourcePushDescription,
|
||||
Example: "buildah source push /tmp/sourceimage:latest quay.io/sourceimage/example:latest",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
return source.Push(context.Background(), args[0], args[1], sourcePushOptions)
|
||||
},
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func init() {
|
||||
Use: "version",
|
||||
Short: "Display the Buildah version information",
|
||||
Long: "Displays Buildah version information.",
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return versionCmd(opts)
|
||||
},
|
||||
Args: cobra.NoArgs,
|
||||
|
@ -222,7 +222,7 @@ type EvalOptions struct {
|
||||
// If the directory is specified as an absolute path, it should either be the
|
||||
// root directory or a subdirectory of the root directory. Otherwise, the
|
||||
// directory is treated as a path relative to the root directory.
|
||||
func Eval(root string, directory string, options EvalOptions) (string, error) {
|
||||
func Eval(root string, directory string, _ EvalOptions) (string, error) {
|
||||
req := request{
|
||||
Request: requestEval,
|
||||
Root: root,
|
||||
|
@ -505,7 +505,7 @@ func testPut(t *testing.T) {
|
||||
require.NoErrorf(t, err, "error extracting archive %q to directory %q", testArchives[i].name, tmp)
|
||||
|
||||
var found []string
|
||||
err = filepath.WalkDir(tmp, func(path string, d fs.DirEntry, err error) error {
|
||||
err = filepath.WalkDir(tmp, func(path string, _ fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1607,7 +1607,7 @@ func testMkdir(t *testing.T) {
|
||||
root := dir
|
||||
options := MkdirOptions{ChownNew: &idtools.IDPair{UID: os.Getuid(), GID: os.Getgid()}}
|
||||
var beforeNames, afterNames []string
|
||||
err = filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
|
||||
err = filepath.WalkDir(dir, func(path string, _ fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1621,7 +1621,7 @@ func testMkdir(t *testing.T) {
|
||||
require.NoErrorf(t, err, "error walking directory to catalog pre-Mkdir contents: %v", err)
|
||||
err = Mkdir(root, testCase.create, options)
|
||||
require.NoErrorf(t, err, "error creating directory %q under %q with Mkdir: %v", testCase.create, root, err)
|
||||
err = filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
|
||||
err = filepath.WalkDir(dir, func(path string, _ fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1822,7 +1822,7 @@ func testRemove(t *testing.T) {
|
||||
root := dir
|
||||
options := RemoveOptions{All: testCase.all}
|
||||
beforeNames := make(map[string]struct{})
|
||||
err = filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
|
||||
err = filepath.WalkDir(dir, func(path string, _ fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1841,7 +1841,7 @@ func testRemove(t *testing.T) {
|
||||
}
|
||||
require.NoErrorf(t, err, "error removing item %q under %q with Remove: %v", testCase.remove, root, err)
|
||||
afterNames := make(map[string]struct{})
|
||||
err = filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
|
||||
err = filepath.WalkDir(dir, func(path string, _ fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ func lchown(path string, uid, gid int) error {
|
||||
return os.Lchown(path, uid, gid)
|
||||
}
|
||||
|
||||
func lutimes(isSymlink bool, path string, atime, mtime time.Time) error {
|
||||
func lutimes(_ bool, path string, atime, mtime time.Time) error {
|
||||
if atime.IsZero() || mtime.IsZero() {
|
||||
now := time.Now()
|
||||
if atime.IsZero() {
|
||||
|
12
image.go
12
image.go
@ -409,7 +409,7 @@ func (i *containerImageRef) createConfigsAndManifests() (v1.Image, v1.Manifest,
|
||||
return oimage, omanifest, dimage, dmanifest, nil
|
||||
}
|
||||
|
||||
func (i *containerImageRef) NewImageSource(ctx context.Context, sc *types.SystemContext) (src types.ImageSource, err error) {
|
||||
func (i *containerImageRef) NewImageSource(_ context.Context, _ *types.SystemContext) (src types.ImageSource, err error) {
|
||||
// Decide which type of manifest and configuration output we're going to provide.
|
||||
manifestType := i.preferredManifestType
|
||||
// If it's not a format we support, return an error.
|
||||
@ -922,7 +922,7 @@ func (i *containerImageRef) NewImageSource(ctx context.Context, sc *types.System
|
||||
return src, nil
|
||||
}
|
||||
|
||||
func (i *containerImageRef) NewImageDestination(ctx context.Context, sc *types.SystemContext) (types.ImageDestination, error) {
|
||||
func (i *containerImageRef) NewImageDestination(_ context.Context, _ *types.SystemContext) (types.ImageDestination, error) {
|
||||
return nil, errors.New("can't write to a container")
|
||||
}
|
||||
|
||||
@ -966,15 +966,15 @@ func (i *containerImageSource) Reference() types.ImageReference {
|
||||
return i.ref
|
||||
}
|
||||
|
||||
func (i *containerImageSource) GetSignatures(ctx context.Context, instanceDigest *digest.Digest) ([][]byte, error) {
|
||||
func (i *containerImageSource) GetSignatures(_ context.Context, _ *digest.Digest) ([][]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (i *containerImageSource) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) {
|
||||
func (i *containerImageSource) GetManifest(_ context.Context, _ *digest.Digest) ([]byte, string, error) {
|
||||
return i.manifest, i.manifestType, nil
|
||||
}
|
||||
|
||||
func (i *containerImageSource) LayerInfosForCopy(ctx context.Context, instanceDigest *digest.Digest) ([]types.BlobInfo, error) {
|
||||
func (i *containerImageSource) LayerInfosForCopy(_ context.Context, _ *digest.Digest) ([]types.BlobInfo, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@ -982,7 +982,7 @@ func (i *containerImageSource) HasThreadSafeGetBlob() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (i *containerImageSource) GetBlob(ctx context.Context, blob types.BlobInfo, cache types.BlobInfoCache) (reader io.ReadCloser, size int64, err error) {
|
||||
func (i *containerImageSource) GetBlob(_ context.Context, blob types.BlobInfo, _ types.BlobInfoCache) (reader io.ReadCloser, size int64, err error) {
|
||||
if blob.Digest == i.configDigest {
|
||||
logrus.Debugf("start reading config")
|
||||
reader := bytes.NewReader(i.config)
|
||||
|
@ -17,26 +17,26 @@ import (
|
||||
// from a Dockerfile. Try anything more than that and it'll return an error.
|
||||
type configOnlyExecutor struct{}
|
||||
|
||||
func (g *configOnlyExecutor) Preserve(path string) error {
|
||||
func (g *configOnlyExecutor) Preserve(_ string) error {
|
||||
return errors.New("ADD/COPY/RUN not supported as changes")
|
||||
}
|
||||
|
||||
func (g *configOnlyExecutor) EnsureContainerPath(path string) error {
|
||||
func (g *configOnlyExecutor) EnsureContainerPath(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *configOnlyExecutor) EnsureContainerPathAs(path, user string, mode *os.FileMode) error {
|
||||
func (g *configOnlyExecutor) EnsureContainerPathAs(_, _ string, _ *os.FileMode) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *configOnlyExecutor) Copy(excludes []string, copies ...imagebuilder.Copy) error {
|
||||
func (g *configOnlyExecutor) Copy(_ []string, copies ...imagebuilder.Copy) error {
|
||||
if len(copies) == 0 {
|
||||
return nil
|
||||
}
|
||||
return errors.New("ADD/COPY not supported as changes")
|
||||
}
|
||||
|
||||
func (g *configOnlyExecutor) Run(run imagebuilder.Run, config dockerclient.Config) error {
|
||||
func (g *configOnlyExecutor) Run(_ imagebuilder.Run, _ dockerclient.Config) error {
|
||||
return errors.New("RUN not supported as changes")
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ func Archive(rootfsPath string, ociConfig *v1.Image, options ArchiveOptions) (io
|
||||
imageSize := slop(options.ImageSize, options.Slop)
|
||||
if imageSize == 0 {
|
||||
var sourceSize int64
|
||||
if err := filepath.WalkDir(rootfsPath, func(path string, d fs.DirEntry, err error) error {
|
||||
if err := filepath.WalkDir(rootfsPath, func(_ string, d fs.DirEntry, err error) error {
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) && !errors.Is(err, os.ErrPermission) {
|
||||
return err
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ func TestMergeSlicesWithoutDuplicatesFixed(t *testing.T) {
|
||||
map[string]any{"first": 1},
|
||||
},
|
||||
}
|
||||
err := mergeSlicesWithoutDuplicates(base, merge, "array", func(record any) (string, error) {
|
||||
err := mergeSlicesWithoutDuplicates(base, merge, "array", func(_ any) (string, error) {
|
||||
return "fixed", nil
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
@ -224,7 +224,7 @@ func GetBindMount(ctx *types.SystemContext, args []string, contextDir string, st
|
||||
// GetCacheMount parses a single cache mount entry from the --mount flag.
|
||||
//
|
||||
// If this function succeeds and returns a non-nil *lockfile.LockFile, the caller must unlock it (when??).
|
||||
func GetCacheMount(args []string, store storage.Store, imageMountLabel string, additionalMountPoints map[string]internal.StageMountDetails, workDir string) (specs.Mount, *lockfile.LockFile, error) {
|
||||
func GetCacheMount(args []string, _ storage.Store, _ string, additionalMountPoints map[string]internal.StageMountDetails, workDir string) (specs.Mount, *lockfile.LockFile, error) {
|
||||
var err error
|
||||
var mode uint64
|
||||
var buildahLockFilesDir string
|
||||
|
@ -516,7 +516,7 @@ func VerifyFlagsArgsOrder(args []string) error {
|
||||
}
|
||||
|
||||
// AliasFlags is a function to handle backwards compatibility with old flags
|
||||
func AliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
func AliasFlags(_ *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
switch name {
|
||||
case "net":
|
||||
name = "network"
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
// AutocompleteNamespaceFlag - Autocomplete the userns flag.
|
||||
// -> host, private, container, ns:[path], [path]
|
||||
func AutocompleteNamespaceFlag(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNamespaceFlag(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
var completions []string
|
||||
// If we don't filter on "toComplete", zsh and fish will not do file completion
|
||||
// even if the prefix typed by the user does not match the returned completions
|
||||
|
@ -4,5 +4,5 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDummy(t *testing.T) {
|
||||
func TestDummy(_ *testing.T) {
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ var headerFunctions = template.FuncMap{
|
||||
"upper": func(v string) string {
|
||||
return v
|
||||
},
|
||||
"truncate": func(v string, l int) string {
|
||||
"truncate": func(v string, _ int) string {
|
||||
return v
|
||||
},
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ func SBOMScanOptions(c *cobra.Command) (*define.SBOMScanOptions, error) {
|
||||
}
|
||||
|
||||
// SBOMScanOptionsFromFlagSet parses scan settings from the cli
|
||||
func SBOMScanOptionsFromFlagSet(flags *pflag.FlagSet, findFlagFunc func(name string) *pflag.Flag) (*define.SBOMScanOptions, error) {
|
||||
func SBOMScanOptionsFromFlagSet(flags *pflag.FlagSet, _ func(name string) *pflag.Flag) (*define.SBOMScanOptions, error) {
|
||||
preset, err := flags.GetString("sbom")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid value for --sbom: %w", err)
|
||||
@ -866,7 +866,7 @@ func SBOMScanOptionsFromFlagSet(flags *pflag.FlagSet, findFlagFunc func(name str
|
||||
}
|
||||
|
||||
// IDMappingOptions parses the build options related to user namespaces and ID mapping.
|
||||
func IDMappingOptions(c *cobra.Command, isolation define.Isolation) (usernsOptions define.NamespaceOptions, idmapOptions *define.IDMappingOptions, err error) {
|
||||
func IDMappingOptions(c *cobra.Command, _ define.Isolation) (usernsOptions define.NamespaceOptions, idmapOptions *define.IDMappingOptions, err error) {
|
||||
return IDMappingOptionsFromFlagSet(c.Flags(), c.PersistentFlags(), c.Flag)
|
||||
}
|
||||
|
||||
|
2
pull.go
2
pull.go
@ -62,7 +62,7 @@ type PullOptions struct {
|
||||
|
||||
// Pull copies the contents of the image from somewhere else to local storage. Returns the
|
||||
// ID of the local image or an error.
|
||||
func Pull(ctx context.Context, imageName string, options PullOptions) (imageID string, err error) {
|
||||
func Pull(_ context.Context, imageName string, options PullOptions) (imageID string, err error) {
|
||||
libimageOptions := &libimage.PullOptions{}
|
||||
libimageOptions.SignaturePolicyPath = options.SignaturePolicyPath
|
||||
libimageOptions.Writer = options.ReportWriter
|
||||
|
@ -786,7 +786,7 @@ func runMakeStdioPipe(uid, gid int) ([][]int, error) {
|
||||
return stdioPipe, nil
|
||||
}
|
||||
|
||||
func setupNamespaces(logger *logrus.Logger, g *generate.Generator, namespaceOptions define.NamespaceOptions, idmapOptions define.IDMappingOptions, policy define.NetworkConfigurationPolicy) (configureNetwork bool, networkString string, configureUTS bool, err error) {
|
||||
func setupNamespaces(_ *logrus.Logger, g *generate.Generator, namespaceOptions define.NamespaceOptions, idmapOptions define.IDMappingOptions, policy define.NetworkConfigurationPolicy) (configureNetwork bool, networkString string, configureUTS bool, err error) {
|
||||
defaultContainerConfig, err := config.Default()
|
||||
if err != nil {
|
||||
return false, "", false, fmt.Errorf("failed to get container config: %w", err)
|
||||
|
@ -18,14 +18,14 @@ func TestAddRlimits(t *testing.T) {
|
||||
{
|
||||
name: "empty ulimit",
|
||||
ulimit: []string{},
|
||||
test: func(e error, g *generate.Generator) error {
|
||||
test: func(e error, _ *generate.Generator) error {
|
||||
return e
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "invalid ulimit argument",
|
||||
ulimit: []string{"bla"},
|
||||
test: func(e error, g *generate.Generator) error {
|
||||
test: func(e error, _ *generate.Generator) error {
|
||||
if e == nil {
|
||||
return errors.New("expected to receive an error but got nil")
|
||||
}
|
||||
@ -39,7 +39,7 @@ func TestAddRlimits(t *testing.T) {
|
||||
{
|
||||
name: "invalid ulimit type",
|
||||
ulimit: []string{"bla=hard"},
|
||||
test: func(e error, g *generate.Generator) error {
|
||||
test: func(e error, _ *generate.Generator) error {
|
||||
if e == nil {
|
||||
return errors.New("expected to receive an error but got nil")
|
||||
}
|
||||
|
@ -1702,7 +1702,7 @@ var internalTestCases = []testCase{
|
||||
"ADD archive.tar subdir1/",
|
||||
"ADD archive/ subdir2/",
|
||||
}, "\n"),
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
content := []byte("test content")
|
||||
|
||||
if err := os.Mkdir(filepath.Join(contextDir, "archive"), 0755); err != nil {
|
||||
@ -1788,7 +1788,7 @@ var internalTestCases = []testCase{
|
||||
"COPY subdir/ subdir/",
|
||||
"COPY --chown=99:99 subdir/ subdir/",
|
||||
}, "\n"),
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
content := []byte("test content")
|
||||
|
||||
if err := os.Mkdir(filepath.Join(contextDir, "subdir"), 0755); err != nil {
|
||||
@ -1827,7 +1827,7 @@ var internalTestCases = []testCase{
|
||||
"COPY --chown=99:99 subdir/ subdir/",
|
||||
"COPY subdir/ subdir/",
|
||||
}, "\n"),
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
content := []byte("test content")
|
||||
|
||||
if err := os.Mkdir(filepath.Join(contextDir, "subdir"), 0755); err != nil {
|
||||
@ -1889,7 +1889,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir1",
|
||||
"ADD . subdir2",
|
||||
}, "\n"),
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
filename := filepath.Join(contextDir, "should-be-setuid-file")
|
||||
if err = os.WriteFile(filename, []byte("test content"), 0644); err != nil {
|
||||
return fmt.Errorf("creating setuid test file in temporary context directory: %w", err)
|
||||
@ -1976,7 +1976,7 @@ var internalTestCases = []testCase{
|
||||
fmt.Sprintf("# Do the setuid/setgid/sticky files in this archive end up setuid(0%o)/setgid(0%o)/sticky(0%o)?", syscall.S_ISUID, syscall.S_ISGID, syscall.S_ISVTX),
|
||||
"ADD archive.tar .",
|
||||
}, "\n"),
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
filename := filepath.Join(contextDir, "archive.tar")
|
||||
f, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
@ -2312,7 +2312,7 @@ var internalTestCases = []testCase{
|
||||
{
|
||||
name: "dockerignore-irrelevant",
|
||||
contextDir: "dockerignore/empty",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"**/*-a", "!**/*-c"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0600); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2332,7 +2332,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"**/*-a", "!**/*-c"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0644); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2352,7 +2352,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"**/*-a", "!**/*-c"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0600); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2372,7 +2372,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"!**/*-c"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0640); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2392,7 +2392,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("!**/*-c\n")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0100); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2412,7 +2412,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("subdir-c")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0200); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2432,7 +2432,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("subdir-c")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0400); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2452,7 +2452,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-c")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0200); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2472,7 +2472,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-c")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0400); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2492,7 +2492,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("subdir-*")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0000); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2512,7 +2512,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("subdir-*")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0660); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2532,7 +2532,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-*")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0000); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2552,7 +2552,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-*")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0660); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2572,7 +2572,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-f")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0666); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2592,7 +2592,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-f")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0640); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2612,7 +2612,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-b")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0705); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2632,7 +2632,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte("**/subdir-b")
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0750); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2652,7 +2652,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"**/subdir-e", "!**/subdir-f"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0750); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2672,7 +2672,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"**/subdir-e", "!**/subdir-f"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0750); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2692,7 +2692,7 @@ var internalTestCases = []testCase{
|
||||
"COPY . subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"**/subdir-f", "!**/subdir-g"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0750); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
@ -2712,7 +2712,7 @@ var internalTestCases = []testCase{
|
||||
"COPY * subdir/",
|
||||
}, "\n"),
|
||||
contextDir: "dockerignore/populated",
|
||||
tweakContextDir: func(t *testing.T, contextDir, storageDriver, storageRoot string) (err error) {
|
||||
tweakContextDir: func(_ *testing.T, contextDir, _, _ string) (err error) {
|
||||
dockerignore := []byte(strings.Join([]string{"**/subdir-f", "!**/subdir-g"}, "\n"))
|
||||
if err := os.WriteFile(filepath.Join(contextDir, ".dockerignore"), dockerignore, 0750); err != nil {
|
||||
return fmt.Errorf("writing .dockerignore file: %w", err)
|
||||
|
@ -173,7 +173,7 @@ func getProcessNoNewPrivileges(r *types.TestReport) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getProcessAppArmorProfile(r *types.TestReport) error {
|
||||
func getProcessAppArmorProfile(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
@ -198,7 +198,7 @@ func getProcessOOMScoreAdjust(r *types.TestReport) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getProcessSeLinuxLabel(r *types.TestReport) error {
|
||||
func getProcessSeLinuxLabel(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
@ -336,47 +336,47 @@ func getLinuxSysctl(r *types.TestReport) error {
|
||||
return filepath.Walk("/proc/sys", walk)
|
||||
}
|
||||
|
||||
func getLinuxResources(r *types.TestReport) error {
|
||||
func getLinuxResources(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxCgroupsPath(r *types.TestReport) error {
|
||||
func getLinuxCgroupsPath(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxNamespaces(r *types.TestReport) error {
|
||||
func getLinuxNamespaces(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxDevices(r *types.TestReport) error {
|
||||
func getLinuxDevices(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxRootfsPropagation(r *types.TestReport) error {
|
||||
func getLinuxRootfsPropagation(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxMaskedPaths(r *types.TestReport) error {
|
||||
func getLinuxMaskedPaths(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxReadOnlyPaths(r *types.TestReport) error {
|
||||
func getLinuxReadOnlyPaths(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxMountLabel(r *types.TestReport) error {
|
||||
func getLinuxMountLabel(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLinuxIntelRdt(r *types.TestReport) error {
|
||||
func getLinuxIntelRdt(_ *types.TestReport) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
11
util/util.go
11
util/util.go
@ -138,10 +138,10 @@ func ExpandNames(names []string, systemContext *types.SystemContext, store stora
|
||||
return expanded, nil
|
||||
}
|
||||
|
||||
// FindImage locates the locally-stored image which corresponds to a given name.
|
||||
// Please note that the `firstRegistry` argument has been deprecated and has no
|
||||
// FindImage locates the locally-stored image which corresponds to a given
|
||||
// name. Please note that the second argument has been deprecated and has no
|
||||
// effect anymore.
|
||||
func FindImage(store storage.Store, firstRegistry string, systemContext *types.SystemContext, image string) (types.ImageReference, *storage.Image, error) {
|
||||
func FindImage(store storage.Store, _ string, systemContext *types.SystemContext, image string) (types.ImageReference, *storage.Image, error) {
|
||||
runtime, err := libimage.RuntimeFromStore(store, &libimage.RuntimeOptions{SystemContext: systemContext})
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -190,9 +190,8 @@ func ResolveNameToReferences(
|
||||
}
|
||||
|
||||
// AddImageNames adds the specified names to the specified image. Please note
|
||||
// that the `firstRegistry` argument has been deprecated and has no effect
|
||||
// anymore.
|
||||
func AddImageNames(store storage.Store, firstRegistry string, systemContext *types.SystemContext, image *storage.Image, addNames []string) error {
|
||||
// that the second argument has been deprecated and has no effect anymore.
|
||||
func AddImageNames(store storage.Store, _ string, systemContext *types.SystemContext, image *storage.Image, addNames []string) error {
|
||||
runtime, err := libimage.RuntimeFromStore(store, &libimage.RuntimeOptions{SystemContext: systemContext})
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user