cmd/zlint-gtld-update/main.go
func main() {
	errQuit := func(err error) {
		fmt.Fprintf(os.Stderr, "error updating gTLD map: %s\n", err)
		os.Exit(1)
	}

	// Default to writing to standard out
	writer := os.Stdout
	if flag.NArg() > 0 {
		// If a filename is specified as a command line flag then open it (creating
		// if needed), truncate the existing contents, and use the file as the
		// writer instead of standard out
		filename := flag.Args()[0]
		f, err := os.OpenFile(filename, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0664)
		if err != nil {
			errQuit(err)
		}
		defer f.Close()
		writer = f
	}

	if err := renderGTLDMap(writer); err != nil {
		errQuit(err)
	}
}
func main() {
	errQuit := func(err error) {
		fmt.Fprintf(os.Stderr, "error updating gTLD map: %s\n", err)
		os.Exit(1)
	}

	// Default to writing to standard out
	writer := os.Stdout
	if flag.NArg() > 0 {
		// If a filename is specified as a command line flag then open it (creating
		// if needed), truncate the existing contents, and use the file as the
		// writer instead of standard out
		filename := flag.Args()[0]
		f, err := os.OpenFile(filename, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0664)
		if err != nil {
			errQuit(err)
		}
		defer f.Close()
		writer = f
	}

	if err := renderGTLDMap(writer); err != nil {
		errQuit(err)
	}
}
// main handles rendering a gTLD map to either standard out (when no argument is
// provided) or to the provided filename. If an error occurs it is printed to
// standard err and the program terminates with a non-zero exit status.