shared/generate/file/write.go
func Reset(path string, imports []string) error {
	content := fmt.Sprintf(`package %s

// The code below was generated by %s - DO NOT EDIT!

import (
`, os.Getenv("GOPACKAGE"), os.Args[0])

	for _, uri := range imports {
		content += fmt.Sprintf("\t%q\n", uri)
	}

	content += ")\n\n"

	// FIXME: we should only import what's needed.
	content += "var _ = api.ServerEnvironment{}\n"

	bytes := []byte(content)

	var err error

	if path == "-" {
		_, err = os.Stdout.Write(bytes)
	} else {
		err = ioutil.WriteFile(path, []byte(content), 0644)
	}

	if err != nil {
		errors.Wrapf(err, "Reset target source file '%s'", path)
	}

	return nil
}
func Reset(path string, imports []string) error {
	content := fmt.Sprintf(`package %s

// The code below was generated by %s - DO NOT EDIT!

import (
`, os.Getenv("GOPACKAGE"), os.Args[0])

	for _, uri := range imports {
		content += fmt.Sprintf("\t%q\n", uri)
	}

	content += ")\n\n"

	// FIXME: we should only import what's needed.
	content += "var _ = api.ServerEnvironment{}\n"

	bytes := []byte(content)

	var err error

	if path == "-" {
		_, err = os.Stdout.Write(bytes)
	} else {
		err = ioutil.WriteFile(path, []byte(content), 0644)
	}

	if err != nil {
		errors.Wrapf(err, "Reset target source file '%s'", path)
	}

	return nil
}
// Reset an auto-generated source file, writing a new empty file header.