1
0
mirror of https://github.com/moby/buildkit.git synced 2025-07-29 04:01:13 +03:00

lint: unusedparams fixes for windows

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2024-04-08 17:30:18 -07:00
parent 1f9988911f
commit a07a92e157
15 changed files with 26 additions and 19 deletions

View File

@ -12,6 +12,6 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (sr *immutableRef) tryComputeOverlayBlob(ctx context.Context, lower, upper []mount.Mount, mediaType string, ref string, compressorFunc compression.Compressor) (_ ocispecs.Descriptor, ok bool, err error) { func (sr *immutableRef) tryComputeOverlayBlob(_ context.Context, _, _ []mount.Mount, _ string, _ string, _ compression.Compressor) (_ ocispecs.Descriptor, ok bool, err error) {
return ocispecs.Descriptor{}, true, errors.Errorf("overlayfs-based diff computing is unsupported") return ocispecs.Descriptor{}, true, errors.Errorf("overlayfs-based diff computing is unsupported")
} }

View File

@ -9,6 +9,6 @@ import (
fstypes "github.com/tonistiigi/fsutil/types" fstypes "github.com/tonistiigi/fsutil/types"
) )
func setUnixOpt(path string, fi os.FileInfo, stat *fstypes.Stat) error { func setUnixOpt(_ string, _ os.FileInfo, _ *fstypes.Stat) error {
return nil return nil
} }

View File

@ -10,13 +10,13 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func mkfifo(path string, mode os.FileMode) fstest.Applier { func mkfifo(_ string, _ os.FileMode) fstest.Applier {
return applyFn(func(string) error { return applyFn(func(string) error {
return errors.New("mkfifo applier not implemented yet on this platform") return errors.New("mkfifo applier not implemented yet on this platform")
}) })
} }
func mkchardev(path string, mode os.FileMode, maj, min uint32) fstest.Applier { func mkchardev(_ string, _ os.FileMode, _, _ uint32) fstest.Applier {
return applyFn(func(string) error { return applyFn(func(string) error {
return errors.New("mkchardev applier not implemented yet on this platform") return errors.New("mkchardev applier not implemented yet on this platform")
}) })

View File

@ -15,7 +15,7 @@ import (
const socketScheme = "npipe://" const socketScheme = "npipe://"
func listenFD(addr string, tlsConfig *tls.Config) (net.Listener, error) { func listenFD(_ string, _ *tls.Config) (net.Listener, error) {
return nil, errors.New("listening server on fd not supported on windows") return nil, errors.New("listening server on fd not supported on windows")
} }

View File

@ -19,13 +19,13 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func getUserSpec(user, rootfsPath string) (specs.User, error) { func getUserSpec(user, _ string) (specs.User, error) {
return specs.User{ return specs.User{
Username: user, Username: user,
}, nil }, nil
} }
func (w *containerdExecutor) prepareExecutionEnv(ctx context.Context, rootMount executor.Mount, mounts []executor.Mount, meta executor.Meta, details *containerState, netMode pb.NetMode) (string, string, func(), error) { func (w *containerdExecutor) prepareExecutionEnv(ctx context.Context, rootMount executor.Mount, _ []executor.Mount, _ executor.Meta, details *containerState, _ pb.NetMode) (string, string, func(), error) {
var releasers []func() error var releasers []func() error
releaseAll := func() { releaseAll := func() {
for _, release := range releasers { for _, release := range releasers {
@ -75,7 +75,7 @@ func (w *containerdExecutor) ensureCWD(ctx context.Context, details *containerSt
return nil return nil
} }
func (w *containerdExecutor) createOCISpec(ctx context.Context, id, resolvConf, hostsFile string, namespace network.Namespace, mounts []executor.Mount, meta executor.Meta, details *containerState) (*specs.Spec, func(), error) { func (w *containerdExecutor) createOCISpec(ctx context.Context, id, _, _ string, namespace network.Namespace, mounts []executor.Mount, meta executor.Meta, _ *containerState) (*specs.Spec, func(), error) {
var releasers []func() var releasers []func()
releaseAll := func() { releaseAll := func() {
for _, release := range releasers { for _, release := range releasers {

View File

@ -51,14 +51,14 @@ func withGetUserInfoMount() oci.SpecOpts {
} }
} }
func generateMountOpts(resolvConf, hostsFile string) ([]oci.SpecOpts, error) { func generateMountOpts(_, _ string) ([]oci.SpecOpts, error) {
return []oci.SpecOpts{ return []oci.SpecOpts{
withGetUserInfoMount(), withGetUserInfoMount(),
}, nil }, nil
} }
// generateSecurityOpts may affect mounts, so must be called after generateMountOpts // generateSecurityOpts may affect mounts, so must be called after generateMountOpts
func generateSecurityOpts(mode pb.SecurityMode, apparmorProfile string, selinuxB bool) ([]oci.SpecOpts, error) { func generateSecurityOpts(mode pb.SecurityMode, _ string, _ bool) ([]oci.SpecOpts, error) {
if mode == pb.SecurityMode_INSECURE { if mode == pb.SecurityMode_INSECURE {
return nil, errors.New("no support for running in insecure mode on Windows") return nil, errors.New("no support for running in insecure mode on Windows")
} }

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
package runcexecutor package runcexecutor
import ( import (

View File

@ -0,0 +1 @@
package runcexecutor

View File

@ -11,10 +11,10 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (sn *mergeSnapshotter) diffApply(ctx context.Context, dest Mountable, diffs ...Diff) (_ snapshots.Usage, rerr error) { func (sn *mergeSnapshotter) diffApply(_ context.Context, _ Mountable, _ ...Diff) (_ snapshots.Usage, rerr error) {
return snapshots.Usage{}, errors.New("diffApply not yet supported on windows") return snapshots.Usage{}, errors.New("diffApply not yet supported on windows")
} }
func needsUserXAttr(ctx context.Context, sn Snapshotter, lm leases.Manager) (bool, error) { func needsUserXAttr(_ context.Context, _ Snapshotter, _ leases.Manager) (bool, error) {
return false, errors.New("needs userxattr not supported on windows") return false, errors.New("needs userxattr not supported on windows")
} }

View File

@ -18,7 +18,7 @@ func getReadUserFn(worker worker.Worker) func(chopt *pb.ChownOpt, mu, mg snapsho
} }
} }
func readUser(chopt *pb.ChownOpt, mu, mg snapshot.Mountable, worker worker.Worker) (*copy.User, error) { func readUser(chopt *pb.ChownOpt, mu, _ snapshot.Mountable, worker worker.Worker) (*copy.User, error) {
if chopt == nil { if chopt == nil {
return nil, nil return nil, nil
} }

View File

@ -7,6 +7,6 @@ import (
"errors" "errors"
) )
func check(arch, bin string) (string, error) { func check(_, _ string) (string, error) {
return "", errors.New("binfmt is not supported on Windows") return "", errors.New("binfmt is not supported on Windows")
} }

View File

@ -9,7 +9,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func createNetNS(_ *cniProvider, id string) (string, error) { func createNetNS(_ *cniProvider, _ string) (string, error) {
nsTemplate := hcn.NewNamespace(hcn.NamespaceTypeGuest) nsTemplate := hcn.NewNamespace(hcn.NamespaceTypeGuest)
ns, err := nsTemplate.Create() ns, err := nsTemplate.Create()
if err != nil { if err != nil {
@ -34,7 +34,7 @@ func setNetNS(s *specs.Spec, nativeID string) error {
return nil return nil
} }
func unmountNetNS(nativeID string) error { func unmountNetNS(_ string) error {
// We don't need to unmount the NS. // We don't need to unmount the NS.
return nil return nil
} }

View File

@ -11,6 +11,6 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func getBridgeProvider(opt cniprovider.Opt) (network.Provider, error) { func getBridgeProvider(_ cniprovider.Opt) (network.Provider, error) {
return nil, errors.Errorf("bridge network is not supported on %s yet", runtime.GOOS) return nil, errors.Errorf("bridge network is not supported on %s yet", runtime.GOOS)
} }

View File

@ -35,11 +35,11 @@ func getContainerdDebugSock(tmpdir string) string {
} }
// no-op for parity with unix // no-op for parity with unix
func mountInfo(tmpdir string) error { func mountInfo(_ string) error {
return nil return nil
} }
func chown(name string, uid, gid int) error { func chown(_ string, _, _ int) error {
// Chown not supported on Windows // Chown not supported on Windows
return nil return nil
} }

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
package runc package runc
import ( import (