簡単だけどすぐ忘れそう。
package main
import (
"fmt"
)
func main() {
t := []string{"0番目","1番目","2番目","3番目","4番目"}
fmt.Println(t)
n := 2
fmt.Printf("%d番目を削除\n", n)
t = unset(t, n)
fmt.Println(t)
}
func unset(s []string, i int) []string {
if i >= len(s) {
return s
}
return append(s[:i], s[i+1:]...)
}