Skip to content

Instantly share code, notes, and snippets.

@tdegrunt
Created October 30, 2014 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdegrunt/681a633c22a92e7d6dc5 to your computer and use it in GitHub Desktop.
Save tdegrunt/681a633c22a92e7d6dc5 to your computer and use it in GitHub Desktop.
How to remove value from slice
package main
import "fmt"
func main() {
example := []string{"a", "b", "c", "d", "e", "f", "g", "h"}
i := 3
example = example[:i+copy(example[i:], example[i+1:])]
fmt.Printf("example: %+v\n", example)
}
@tdegrunt
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment