github.com/switchupcb/yaegi@v0.10.2/_test/issue-1276.go (about)

     1  package main
     2  
     3  import (
     4  	"flag"
     5  )
     6  
     7  type customFlag struct{}
     8  
     9  func (cf customFlag) String() string {
    10  	return "custom flag"
    11  }
    12  
    13  func (cf customFlag) Set(string) error {
    14  	return nil
    15  }
    16  
    17  func main() {
    18  	flag.Var(customFlag{}, "cf", "custom flag")
    19  	flag.Parse()
    20  	println("Hello, playground")
    21  }
    22  
    23  // Output:
    24  // Hello, playground