mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
NEW FEATURE: diff2: A better "diff" mechanism (#1852)
This commit is contained in:
22
pkg/diff2/nopurge.go
Normal file
22
pkg/diff2/nopurge.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package diff2
|
||||
|
||||
func processPurge(instructions ChangeList, nopurge bool) ChangeList {
|
||||
|
||||
if nopurge {
|
||||
return instructions
|
||||
}
|
||||
|
||||
// TODO(tlim): This can probably be done without allocations but it
|
||||
// works and I won't want to prematurely optimize.
|
||||
|
||||
newinstructions := make(ChangeList, 0, len(instructions))
|
||||
for _, j := range instructions {
|
||||
if j.Type == DELETE {
|
||||
continue
|
||||
}
|
||||
newinstructions = append(newinstructions, j)
|
||||
}
|
||||
|
||||
return newinstructions
|
||||
|
||||
}
|
Reference in New Issue
Block a user