Skip to content

Instantly share code, notes, and snippets.

@fujiwara
Created July 29, 2015 09:03
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 fujiwara/7aa8ea48dfe171e111a5 to your computer and use it in GitHub Desktop.
Save fujiwara/7aa8ea48dfe171e111a5 to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"fmt"
)
type strslice []string
func (s *strslice) String() string {
return fmt.Sprintf("%v", *s)
}
func (s *strslice) Set(v string) error {
*s = append(*s, v)
return nil
}
func main() {
var multiflag strslice
flag.Var(&multiflag, "data", "Data values.")
flag.Parse()
fmt.Printf("%v", multiflag)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment