github.com/neilgarb/delve@v1.9.2-nobreaks/_fixtures/testargs.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os" 6 ) 7 8 func main() { 9 // this test expects AT LEAST 1 argument, and the first one needs to be "test". 10 // second one is optional but if given, it should be "-passFlag" 11 fmt.Printf("received args %#v\n", os.Args) 12 if len(os.Args) < 2 { 13 panic("os.args too short!") 14 } else if os.Args[1] != "test" { 15 panic("os.args[1] is not test!") 16 } 17 if len(os.Args) >= 3 && os.Args[2] != "pass flag" { 18 panic("os.args[2] is not \"pass flag\"!") 19 } 20 }