func Run(ctxt *build.Context, gofile string) error { fmt.Println(chalk.Magenta.Color("======== Memoization Code Generator =======")) fmt.Printf(chalk.Magenta.Color(">>> Input: \"%s\"\n"), gofile) fs, err := parse.File(gofile) if err != nil { return err } if len(fs.Identities) == 0 { fmt.Println(chalk.Magenta.Color("No types requiring code generation were found!")) return nil } return printer.PrintFile(newFilename(gofile, fs.Package), fs, mode) }
// Run writes all methods using the associated file or path, e.g. // // err := msgp.Run("path/to/myfile.go", gen.Size|gen.Marshal|gen.Unmarshal|gen.Test, false) // func Run(gofile string, mode gen.Method, unexported bool) error { if mode&^gen.Test == 0 { return nil } fmt.Println(chalk.Magenta.Color("======== MessagePack Code Generator =======")) fmt.Printf(chalk.Magenta.Color(">>> Input: \"%s\"...\n"), gofile) fs, err := parse.File(gofile, unexported) if err != nil { return err } if len(fs.Identities) == 0 { fmt.Println(chalk.Magenta.Color("No types requiring code generation were found!")) return nil } return printer.PrintFile(newFilename(gofile, fs.Package), fs, mode) }