diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_api.go | 6 | ||||
-rw-r--r-- | libpod/container_copy_linux.go | 13 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 32 | ||||
-rw-r--r-- | libpod/container_internal_linux_test.go | 8 | ||||
-rw-r--r-- | libpod/container_stat_linux.go | 13 | ||||
-rw-r--r-- | libpod/networking_linux.go | 40 | ||||
-rw-r--r-- | libpod/networking_linux_test.go | 11 | ||||
-rw-r--r-- | libpod/oci_conmon_exec_linux.go | 2 | ||||
-rw-r--r-- | libpod/oci_conmon_linux.go | 4 | ||||
-rw-r--r-- | libpod/runtime.go | 12 | ||||
-rw-r--r-- | libpod/runtime_ctr.go | 2 | ||||
-rw-r--r-- | libpod/runtime_migrate.go | 3 | ||||
-rw-r--r-- | libpod/runtime_volume_linux.go | 4 |
13 files changed, 60 insertions, 90 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index ebefed600..fe41998c0 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -889,7 +889,7 @@ func (c *Container) CopyFromArchive(ctx context.Context, containerPath string, c } } - return c.copyFromArchive(ctx, containerPath, chown, rename, tarStream) + return c.copyFromArchive(containerPath, chown, rename, tarStream) } // CopyToArchive copies the contents from the specified path *inside* the @@ -904,7 +904,7 @@ func (c *Container) CopyToArchive(ctx context.Context, containerPath string, tar } } - return c.copyToArchive(ctx, containerPath, tarStream) + return c.copyToArchive(containerPath, tarStream) } // Stat the specified path *inside* the container and return a file info. @@ -934,6 +934,6 @@ func (c *Container) Stat(ctx context.Context, containerPath string) (*define.Fil }() } - info, _, _, err := c.stat(ctx, mountPoint, containerPath) + info, _, _, err := c.stat(mountPoint, containerPath) return info, err } diff --git a/libpod/container_copy_linux.go b/libpod/container_copy_linux.go index 38927d691..91e712c74 100644 --- a/libpod/container_copy_linux.go +++ b/libpod/container_copy_linux.go @@ -4,7 +4,6 @@ package libpod import ( - "context" "io" "os" "path/filepath" @@ -24,7 +23,7 @@ import ( "golang.org/x/sys/unix" ) -func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool, rename map[string]string, reader io.Reader) (func() error, error) { +func (c *Container) copyFromArchive(path string, chown bool, rename map[string]string, reader io.Reader) (func() error, error) { var ( mountPoint string resolvedRoot string @@ -93,7 +92,7 @@ func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool Rename: rename, } - return c.joinMountAndExec(ctx, + return c.joinMountAndExec( func() error { return buildahCopiah.Put(resolvedRoot, resolvedPath, putOptions, decompressed) }, @@ -101,7 +100,7 @@ func (c *Container) copyFromArchive(ctx context.Context, path string, chown bool }, nil } -func (c *Container) copyToArchive(ctx context.Context, path string, writer io.Writer) (func() error, error) { +func (c *Container) copyToArchive(path string, writer io.Writer) (func() error, error) { var ( mountPoint string unmount func() @@ -121,7 +120,7 @@ func (c *Container) copyToArchive(ctx context.Context, path string, writer io.Wr unmount = func() { c.unmount(false) } } - statInfo, resolvedRoot, resolvedPath, err := c.stat(ctx, mountPoint, path) + statInfo, resolvedRoot, resolvedPath, err := c.stat(mountPoint, path) if err != nil { unmount() return nil, err @@ -165,7 +164,7 @@ func (c *Container) copyToArchive(ctx context.Context, path string, writer io.Wr // container's user namespace. IgnoreUnreadable: rootless.IsRootless() && c.state.State == define.ContainerStateRunning, } - return c.joinMountAndExec(ctx, + return c.joinMountAndExec( func() error { return buildahCopiah.Get(resolvedRoot, "", getOptions, []string{resolvedPath}, writer) }, @@ -216,7 +215,7 @@ func idtoolsToRuntimeSpec(idMaps []idtools.IDMap) (convertedIDMap []specs.LinuxI // container's file system. // // Note, if the container is not running `f()` will be executed as is. -func (c *Container) joinMountAndExec(ctx context.Context, f func() error) error { +func (c *Container) joinMountAndExec(f func() error) error { if c.state.State != define.ContainerStateRunning { return f() } diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index ead58b373..9f8b7c686 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -2632,7 +2632,7 @@ func (c *Container) generateGroupEntry() (string, error) { addedGID = gid } if c.config.User != "" { - entry, _, err := c.generateUserGroupEntry(addedGID) + entry, err := c.generateUserGroupEntry(addedGID) if err != nil { return "", err } @@ -2685,9 +2685,9 @@ func (c *Container) generateCurrentUserGroupEntry() (string, int, error) { // Make an entry in /etc/group for the group the container was specified to run // as. -func (c *Container) generateUserGroupEntry(addedGID int) (string, int, error) { +func (c *Container) generateUserGroupEntry(addedGID int) (string, error) { if c.config.User == "" { - return "", 0, nil + return "", nil } splitUser := strings.SplitN(c.config.User, ":", 2) @@ -2698,20 +2698,20 @@ func (c *Container) generateUserGroupEntry(addedGID int) (string, int, error) { gid, err := strconv.ParseUint(group, 10, 32) if err != nil { - return "", 0, nil // nolint: nilerr + return "", nil // nolint: nilerr } if addedGID != 0 && addedGID == int(gid) { - return "", 0, nil + return "", nil } // Check if the group already exists _, err = lookup.GetGroup(c.state.Mountpoint, group) if err != runcuser.ErrNoGroupEntries { - return "", 0, err + return "", err } - return fmt.Sprintf("%d:x:%d:%s\n", gid, gid, splitUser[0]), int(gid), nil + return fmt.Sprintf("%d:x:%d:%s\n", gid, gid, splitUser[0]), nil } // generatePasswdEntry generates an entry or entries into /etc/passwd as @@ -2751,7 +2751,7 @@ func (c *Container) generatePasswdEntry() (string, error) { addedUID = uid } if c.config.User != "" { - entry, _, _, err := c.generateUserPasswdEntry(addedUID) + entry, err := c.generateUserPasswdEntry(addedUID) if err != nil { return "", err } @@ -2838,13 +2838,13 @@ func (c *Container) userPasswdEntry(u *user.User) (string, error) { // Accepts one argument, that being any UID that has already been added to the // passwd file by other functions; if it matches the UID we were given, we don't // need to do anything. -func (c *Container) generateUserPasswdEntry(addedUID int) (string, int, int, error) { +func (c *Container) generateUserPasswdEntry(addedUID int) (string, error) { var ( groupspec string gid int ) if c.config.User == "" { - return "", 0, 0, nil + return "", nil } splitSpec := strings.SplitN(c.config.User, ":", 2) userspec := splitSpec[0] @@ -2854,17 +2854,17 @@ func (c *Container) generateUserPasswdEntry(addedUID int) (string, int, int, err // If a non numeric User, then don't generate passwd uid, err := strconv.ParseUint(userspec, 10, 32) if err != nil { - return "", 0, 0, nil // nolint: nilerr + return "", nil // nolint: nilerr } if addedUID != 0 && int(uid) == addedUID { - return "", 0, 0, nil + return "", nil } // Lookup the user to see if it exists in the container image _, err = lookup.GetUser(c.state.Mountpoint, userspec) if err != runcuser.ErrNoPasswdEntries { - return "", 0, 0, err + return "", err } if groupspec != "" { @@ -2874,7 +2874,7 @@ func (c *Container) generateUserPasswdEntry(addedUID int) (string, int, int, err } else { group, err := lookup.GetGroup(c.state.Mountpoint, groupspec) if err != nil { - return "", 0, 0, errors.Wrapf(err, "unable to get gid %s from group file", groupspec) + return "", errors.Wrapf(err, "unable to get gid %s from group file", groupspec) } gid = group.Gid } @@ -2882,10 +2882,10 @@ func (c *Container) generateUserPasswdEntry(addedUID int) (string, int, int, err if c.config.PasswdEntry != "" { entry := c.passwdEntry(fmt.Sprintf("%d", uid), fmt.Sprintf("%d", uid), fmt.Sprintf("%d", gid), "container user", c.WorkingDir()) - return entry, int(uid), gid, nil + return entry, nil } - return fmt.Sprintf("%d:*:%d:%d:container user:%s:/bin/sh\n", uid, uid, gid, c.WorkingDir()), int(uid), gid, nil + return fmt.Sprintf("%d:*:%d:%d:container user:%s:/bin/sh\n", uid, uid, gid, c.WorkingDir()), nil } func (c *Container) passwdEntry(username string, uid, gid, name, homeDir string) string { diff --git a/libpod/container_internal_linux_test.go b/libpod/container_internal_linux_test.go index 2c1193445..03095aa58 100644 --- a/libpod/container_internal_linux_test.go +++ b/libpod/container_internal_linux_test.go @@ -30,14 +30,14 @@ func TestGenerateUserPasswdEntry(t *testing.T) { Mountpoint: "/does/not/exist/tmp/", }, } - user, _, _, err := c.generateUserPasswdEntry(0) + user, err := c.generateUserPasswdEntry(0) if err != nil { t.Fatal(err) } assert.Equal(t, user, "123:*:123:456:container user:/:/bin/sh\n") c.config.User = "567" - user, _, _, err = c.generateUserPasswdEntry(0) + user, err = c.generateUserPasswdEntry(0) if err != nil { t.Fatal(err) } @@ -56,14 +56,14 @@ func TestGenerateUserGroupEntry(t *testing.T) { Mountpoint: "/does/not/exist/tmp/", }, } - group, _, err := c.generateUserGroupEntry(0) + group, err := c.generateUserGroupEntry(0) if err != nil { t.Fatal(err) } assert.Equal(t, group, "456:x:456:123\n") c.config.User = "567" - group, _, err = c.generateUserGroupEntry(0) + group, err = c.generateUserGroupEntry(0) if err != nil { t.Fatal(err) } diff --git a/libpod/container_stat_linux.go b/libpod/container_stat_linux.go index 84ab984e0..9e225de2e 100644 --- a/libpod/container_stat_linux.go +++ b/libpod/container_stat_linux.go @@ -4,7 +4,6 @@ package libpod import ( - "context" "os" "path/filepath" "strings" @@ -18,12 +17,12 @@ import ( // statInsideMount stats the specified path *inside* the container's mount and PID // namespace. It returns the file info along with the resolved root ("/") and // the resolved path (relative to the root). -func (c *Container) statInsideMount(ctx context.Context, containerPath string) (*copier.StatForItem, string, string, error) { +func (c *Container) statInsideMount(containerPath string) (*copier.StatForItem, string, string, error) { resolvedRoot := "/" resolvedPath := c.pathAbs(containerPath) var statInfo *copier.StatForItem - err := c.joinMountAndExec(ctx, + err := c.joinMountAndExec( func() error { var statErr error statInfo, statErr = secureStat(resolvedRoot, resolvedPath) @@ -38,7 +37,7 @@ func (c *Container) statInsideMount(ctx context.Context, containerPath string) ( // along with the resolved root and the resolved path. Both paths are absolute // to the host's root. Note that the paths may resolved outside the // container's mount point (e.g., to a volume or bind mount). -func (c *Container) statOnHost(ctx context.Context, mountPoint string, containerPath string) (*copier.StatForItem, string, string, error) { +func (c *Container) statOnHost(mountPoint string, containerPath string) (*copier.StatForItem, string, string, error) { // Now resolve the container's path. It may hit a volume, it may hit a // bind mount, it may be relative. resolvedRoot, resolvedPath, err := c.resolvePath(mountPoint, containerPath) @@ -50,7 +49,7 @@ func (c *Container) statOnHost(ctx context.Context, mountPoint string, container return statInfo, resolvedRoot, resolvedPath, err } -func (c *Container) stat(ctx context.Context, containerMountPoint string, containerPath string) (*define.FileInfo, string, string, error) { +func (c *Container) stat(containerMountPoint string, containerPath string) (*define.FileInfo, string, string, error) { var ( resolvedRoot string resolvedPath string @@ -75,11 +74,11 @@ func (c *Container) stat(ctx context.Context, containerMountPoint string, contai if c.state.State == define.ContainerStateRunning { // If the container is running, we need to join it's mount namespace // and stat there. - statInfo, resolvedRoot, resolvedPath, statErr = c.statInsideMount(ctx, containerPath) + statInfo, resolvedRoot, resolvedPath, statErr = c.statInsideMount(containerPath) } else { // If the container is NOT running, we need to resolve the path // on the host. - statInfo, resolvedRoot, resolvedPath, statErr = c.statOnHost(ctx, containerMountPoint, containerPath) + statInfo, resolvedRoot, resolvedPath, statErr = c.statOnHost(containerMountPoint, containerPath) } if statErr != nil { diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go index 0db0896cf..3cfe19517 100644 --- a/libpod/networking_linux.go +++ b/libpod/networking_linux.go @@ -74,7 +74,7 @@ func (c *Container) convertPortMappings() []types.PortMapping { return newPorts } -func (c *Container) getNetworkOptions(networkOpts map[string]types.PerNetworkOptions) (types.NetworkOptions, error) { +func (c *Container) getNetworkOptions(networkOpts map[string]types.PerNetworkOptions) types.NetworkOptions { opts := types.NetworkOptions{ ContainerID: c.config.ID, ContainerName: getCNIPodName(c), @@ -88,7 +88,7 @@ func (c *Container) getNetworkOptions(networkOpts map[string]types.PerNetworkOpt } else { opts.Networks = networkOpts } - return opts, nil + return opts } type RootlessNetNS struct { @@ -653,10 +653,7 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) (status map[str return nil, nil } - netOpts, err := ctr.getNetworkOptions(networks) - if err != nil { - return nil, err - } + netOpts := ctr.getNetworkOptions(networks) netStatus, err := r.setUpNetwork(ctrNS.Path(), netOpts) if err != nil { return nil, err @@ -814,10 +811,7 @@ func (r *Runtime) teardownCNI(ctr *Container) error { } if !ctr.config.NetMode.IsSlirp4netns() && len(networks) > 0 { - netOpts, err := ctr.getNetworkOptions(networks) - if err != nil { - return err - } + netOpts := ctr.getNetworkOptions(networks) return r.teardownNetwork(ctr.state.NetNS.Path(), netOpts) } return nil @@ -1000,11 +994,9 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e if c.state.NetNS == nil { if networkNSPath := c.joinedNetworkNSPath(); networkNSPath != "" { if result, err := c.inspectJoinedNetworkNS(networkNSPath); err == nil { - if basicConfig, err := resultToBasicNetworkConfig(result); err == nil { - // fallback to dummy configuration - settings.InspectBasicNetworkConfig = basicConfig - return settings, nil - } + // fallback to dummy configuration + settings.InspectBasicNetworkConfig = resultToBasicNetworkConfig(result) + return settings, nil } // do not propagate error inspecting a joined network ns logrus.Errorf("Inspecting network namespace: %s of container %s: %v", networkNSPath, c.ID(), err) @@ -1047,14 +1039,8 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e result := netStatus[name] addedNet := new(define.InspectAdditionalNetwork) addedNet.NetworkID = name - - basicConfig, err := resultToBasicNetworkConfig(result) - if err != nil { - return nil, err - } addedNet.Aliases = opts.Aliases - - addedNet.InspectBasicNetworkConfig = basicConfig + addedNet.InspectBasicNetworkConfig = resultToBasicNetworkConfig(result) settings.Networks[name] = addedNet } @@ -1074,11 +1060,7 @@ func (c *Container) getContainerNetworkInfo() (*define.InspectNetworkSettings, e if len(netStatus) == 1 { for _, status := range netStatus { - basicConfig, err := resultToBasicNetworkConfig(status) - if err != nil { - return nil, err - } - settings.InspectBasicNetworkConfig = basicConfig + settings.InspectBasicNetworkConfig = resultToBasicNetworkConfig(status) } } return settings, nil @@ -1152,7 +1134,7 @@ func (c *Container) inspectJoinedNetworkNS(networkns string) (q types.StatusBloc // resultToBasicNetworkConfig produces an InspectBasicNetworkConfig from a CNI // result -func resultToBasicNetworkConfig(result types.StatusBlock) (define.InspectBasicNetworkConfig, error) { +func resultToBasicNetworkConfig(result types.StatusBlock) define.InspectBasicNetworkConfig { config := define.InspectBasicNetworkConfig{} interfaceNames := make([]string, 0, len(result.Interfaces)) for interfaceName := range result.Interfaces { @@ -1190,7 +1172,7 @@ func resultToBasicNetworkConfig(result types.StatusBlock) (define.InspectBasicNe config.AdditionalMacAddresses = append(config.AdditionalMacAddresses, netInt.MacAddress.String()) } } - return config, nil + return config } type logrusDebugWriter struct { diff --git a/libpod/networking_linux_test.go b/libpod/networking_linux_test.go index a21494824..2aeb1a02c 100644 --- a/libpod/networking_linux_test.go +++ b/libpod/networking_linux_test.go @@ -241,7 +241,6 @@ func Test_ocicniPortsToNetTypesPorts(t *testing.T) { func Test_resultToBasicNetworkConfig(t *testing.T) { testCases := []struct { description string - expectError bool inputResult types.StatusBlock expectedNetworkConfig define.InspectBasicNetworkConfig }{ @@ -431,15 +430,7 @@ func Test_resultToBasicNetworkConfig(t *testing.T) { tc := tcl t.Run(tc.description, func(t *testing.T) { t.Parallel() - actualNetworkConfig, err := resultToBasicNetworkConfig(tc.inputResult) - - if tc.expectError && err == nil { - t.Fatalf("Expected error didn't happen") - } - - if !tc.expectError && err != nil { - t.Fatalf("Unexpected error happened: %v", err) - } + actualNetworkConfig := resultToBasicNetworkConfig(tc.inputResult) if !reflect.DeepEqual(tc.expectedNetworkConfig, actualNetworkConfig) { t.Fatalf( diff --git a/libpod/oci_conmon_exec_linux.go b/libpod/oci_conmon_exec_linux.go index 1005d18da..b8fd82591 100644 --- a/libpod/oci_conmon_exec_linux.go +++ b/libpod/oci_conmon_exec_linux.go @@ -439,7 +439,7 @@ func (r *ConmonOCIRuntime) startExec(c *Container, sessionID string, options *Ex // } // } - conmonEnv := r.configureConmonEnv(c, runtimeDir) + conmonEnv := r.configureConmonEnv(runtimeDir) var filesToClose []*os.File if options.PreserveFDs > 0 { diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index 06ba8a03f..dc1c75cea 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -1181,7 +1181,7 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co } // 0, 1 and 2 are stdin, stdout and stderr - conmonEnv := r.configureConmonEnv(ctr, runtimeDir) + conmonEnv := r.configureConmonEnv(runtimeDir) var filesToClose []*os.File if preserveFDs > 0 { @@ -1312,7 +1312,7 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co // configureConmonEnv gets the environment values to add to conmon's exec struct // TODO this may want to be less hardcoded/more configurable in the future -func (r *ConmonOCIRuntime) configureConmonEnv(ctr *Container, runtimeDir string) []string { +func (r *ConmonOCIRuntime) configureConmonEnv(runtimeDir string) []string { var env []string for _, e := range os.Environ() { if strings.HasPrefix(e, "LC_") { diff --git a/libpod/runtime.go b/libpod/runtime.go index 07653217a..877e151a9 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -167,7 +167,7 @@ func NewRuntime(ctx context.Context, options ...RuntimeOption) (*Runtime, error) if err != nil { return nil, err } - return newRuntimeFromConfig(ctx, conf, options...) + return newRuntimeFromConfig(conf, options...) } // NewRuntimeFromConfig creates a new container runtime using the given @@ -176,10 +176,10 @@ func NewRuntime(ctx context.Context, options ...RuntimeOption) (*Runtime, error) // An error will be returned if the configuration file at the given path does // not exist or cannot be loaded func NewRuntimeFromConfig(ctx context.Context, userConfig *config.Config, options ...RuntimeOption) (*Runtime, error) { - return newRuntimeFromConfig(ctx, userConfig, options...) + return newRuntimeFromConfig(userConfig, options...) } -func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...RuntimeOption) (*Runtime, error) { +func newRuntimeFromConfig(conf *config.Config, options ...RuntimeOption) (*Runtime, error) { runtime := new(Runtime) if conf.Engine.OCIRuntime == "" { @@ -224,7 +224,7 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R return nil, errors.Wrapf(err, "error starting shutdown signal handler") } - if err := makeRuntime(ctx, runtime); err != nil { + if err := makeRuntime(runtime); err != nil { return nil, err } @@ -292,7 +292,7 @@ func getLockManager(runtime *Runtime) (lock.Manager, error) { // Make a new runtime based on the given configuration // Sets up containers/storage, state store, OCI runtime -func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) { +func makeRuntime(runtime *Runtime) (retErr error) { // Find a working conmon binary cPath, err := findConmon(runtime.config.Engine.ConmonPath) if err != nil { @@ -598,7 +598,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) { runtime.valid = true if runtime.doMigrate { - if err := runtime.migrate(ctx); err != nil { + if err := runtime.migrate(); err != nil { return err } } diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index a62c2b607..fd3ffd199 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -501,7 +501,7 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai volOptions = append(volOptions, parsedOptions...) } } - newVol, err := r.newVolume(ctx, volOptions...) + newVol, err := r.newVolume(volOptions...) if err != nil { return nil, errors.Wrapf(err, "error creating named volume %q", vol.Name) } diff --git a/libpod/runtime_migrate.go b/libpod/runtime_migrate.go index fccd5bdee..f56cb83a4 100644 --- a/libpod/runtime_migrate.go +++ b/libpod/runtime_migrate.go @@ -4,7 +4,6 @@ package libpod import ( - "context" "fmt" "io/ioutil" "os" @@ -46,7 +45,7 @@ func (r *Runtime) stopPauseProcess() error { return nil } -func (r *Runtime) migrate(ctx context.Context) error { +func (r *Runtime) migrate() error { runningContainers, err := r.GetRunningContainers() if err != nil { return err diff --git a/libpod/runtime_volume_linux.go b/libpod/runtime_volume_linux.go index 3d585fa7a..241f6e2f2 100644 --- a/libpod/runtime_volume_linux.go +++ b/libpod/runtime_volume_linux.go @@ -25,11 +25,11 @@ func (r *Runtime) NewVolume(ctx context.Context, options ...VolumeCreateOption) if !r.valid { return nil, define.ErrRuntimeStopped } - return r.newVolume(ctx, options...) + return r.newVolume(options...) } // newVolume creates a new empty volume -func (r *Runtime) newVolume(ctx context.Context, options ...VolumeCreateOption) (_ *Volume, deferredErr error) { +func (r *Runtime) newVolume(options ...VolumeCreateOption) (_ *Volume, deferredErr error) { volume := newVolume(r) for _, option := range options { if err := option(volume); err != nil { |