1. 30 Mar, 2010 2 commits
    • Rob Pike's avatar
      Flags: add user-defined flag types. The change is really no code; it's just publishing · 570af81e
      Rob Pike authored
      the set() method and add() functions.  But we rename add() to Var() for consistency.
      Also rename FlagValue to Value for simplicity.
      
      Also, delete the check for multiple settings for a flag.  This makes it possible to
      define a flag that collects values, such as into a slice of strings.
      
      type flagVar []string
      
      func (f *flagVar) String() string {
      	return fmt.Sprint(v)
      }
      
      func (f *flagVar) Set(value string) bool {
      	if v == nil {
      		v = make(flagVar, 1)
      	} else {
      		nv := make(flagVar, len(v)+1)
      		copy(nv, v)
      		v = nv
      	}
      	v[len(v)-1] = value
      	return true
      }
      
      var v flagVar
      
      func main() {
      	flag.Var(&v, "testV", "multiple values build []string")
      	flag.Parse()
      	fmt.Printf("v = %v\n", v)
      }
      
      R=rsc
      CC=golang-dev
      https://golang.org/cl/842041
      570af81e
    • Russ Cox's avatar
      runtime: a couple more memory stats. · d99a3da7
      Russ Cox authored
      now runtime.MemStats.Sys really is the sum of all the other Sys fields.
      
      R=r
      CC=golang-dev
      https://golang.org/cl/843041
      d99a3da7
  2. 29 Mar, 2010 10 commits
  3. 28 Mar, 2010 2 commits
  4. 27 Mar, 2010 2 commits
  5. 26 Mar, 2010 13 commits
  6. 25 Mar, 2010 11 commits