func writeToFile(target, name string, content []byte) error { ffn := swag.ToFileName(name) + ".go" res, err := formatGoFile(ffn, content) if err != nil { log.Println(err) return writeFile(target, ffn, content) } return writeFile(target, ffn, res) }
func fileExists(target, name string) bool { ffn := swag.ToFileName(name) + ".go" _, err := os.Stat(filepath.Join(target, ffn)) return !os.IsNotExist(err) }