func createOutFile()

in renderer/renderer.go [106:119]


func createOutFile(outputPath string, expectedDir bool, defaultFileName string) (*os.File, error) {
	finfo, err := os.Stat(outputPath)
	if err != nil && !os.IsNotExist(err) {
		return nil, err
	}

	if finfo != nil && finfo.IsDir() {
		outputPath = filepath.Join(outputPath, defaultFileName)
	} else if expectedDir {
		return nil, fmt.Errorf("output path must point to an existing directory")
	}

	return os.Create(outputPath)
}