CheckArgs should be used to ensure the right command line arguments are passed before executing an example.
(arg ...string)
| 665 | // CheckArgs should be used to ensure the right command line arguments are |
| 666 | // passed before executing an example. |
| 667 | func CheckArgs(arg ...string) { |
| 668 | if len(os.Args) < len(arg)+1 { |
| 669 | Warning("Usage: %s %s", os.Args[0], strings.Join(arg, " ")) |
| 670 | os.Exit(1) |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | // CheckIfError should be used to naively panics if an error is not nil. |
| 675 | func CheckIfError(err error) { |