I am new to golang. I am trying to add a method to a slice. The method is just a wrapper of append, which does not work.
package main
import (
"fmt"
)
type SliceStr []string
func (ss *SliceStr) Add(s string) {
ss = append(ss, s)
}
func main() {
var s SliceStr
s.Add("hello")
fmt.Println(s)
}
prog.go:10:12: first argument to append must be slice; have *SliceStr