Skip to content

Commit ee57690

Browse files
committed
Address comments from Daniel and solve the lint error.
1 parent 57a44fc commit ee57690

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cli/compose/convert/volume.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,19 @@ func convertVolumeToMount(
6161
return result, errors.Errorf("undefined volume %q", volume.Source)
6262
}
6363

64-
if stackVolume.External.External && stackVolume.External.Name != "" {
65-
return result, errors.Errorf("cannot specify external volume name %q", stackVolume.External.Name)
66-
}
6764
result.Source = namespace.Scope(volume.Source)
6865
result.VolumeOptions = &mount.VolumeOptions{}
6966

7067
if volume.Volume != nil {
7168
result.VolumeOptions.NoCopy = volume.Volume.NoCopy
7269
}
7370

71+
// External named volumes
72+
if stackVolume.External.External {
73+
result.Source = stackVolume.External.Name
74+
return result, nil
75+
}
76+
7477
if stackVolume.Name != "" {
7578
result.Source = stackVolume.Name
7679
}

cli/compose/types/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ type IPAMPool struct {
305305

306306
// VolumeConfig for a volume
307307
type VolumeConfig struct {
308-
Name string
308+
Name string
309309
Driver string
310310
DriverOpts map[string]string `mapstructure:"driver_opts"`
311311
External External

0 commit comments

Comments
 (0)