fix(dockerCompose): add Volume.MergeFirstWin()
This commit is contained in:
parent
7b0109caf4
commit
14c645dd96
@ -1129,6 +1129,25 @@ func (v *Volume) Equal(equalable Equalable) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Volume) MergeFirstWin(volume *Volume) {
|
||||
switch {
|
||||
case v == nil && volume == nil:
|
||||
fallthrough
|
||||
case v != nil && volume == nil:
|
||||
return
|
||||
|
||||
// WARN: It's not possible to change the memory pointer v *Volume to a new
|
||||
// initialized Volume without returning the volume it self.
|
||||
//
|
||||
// case v == nil && volume != nil:
|
||||
// v = NewVolume()
|
||||
// fallthrough
|
||||
|
||||
default:
|
||||
v.mergeFirstWinExternal(volume.External)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Volume) MergeLastWin(volume *Volume) {
|
||||
switch {
|
||||
case v == nil && volume == nil:
|
||||
@ -1148,6 +1167,13 @@ func (v *Volume) MergeLastWin(volume *Volume) {
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Volume) mergeFirstWinExternal(external bool) {
|
||||
if v.External {
|
||||
return
|
||||
}
|
||||
v.External = true
|
||||
}
|
||||
|
||||
func (v *Volume) mergeLastWinExternal(external bool) {
|
||||
if v.External != external {
|
||||
v.External = external
|
||||
|
Loading…
Reference in New Issue
Block a user