Last active
May 29, 2025 15:15
-
-
Save Integralist/d21ee193a83fdf68bc3fa506f25782fe to your computer and use it in GitHub Desktop.
Go: Delete a slice entry in Go #go #computation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// zones == complete list of dns zones | |
// denyList == list of zones to remove | |
for _, deniedZone := range denyList { | |
for i := 0; i < len(zones); i++ { | |
if zones[i] == deniedZone { | |
zones = append(zones[:i], zones[i+1:]...) | |
i-- // Adjust index to stay at the correct position after removal | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment