-
Notifications
You must be signed in to change notification settings - Fork 1.8k
*: operator-sdk new now outputs progress #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: operator-sdk new now outputs progress #105
Conversation
Manual test:
|
cc/ @hasbro17 |
pkg/generator/generator.go
Outdated
if err := ioutil.WriteFile(tp, buf.Bytes(), defaultFileMode); err != nil { | ||
return err | ||
} | ||
fmt.Printf("Create %v \n", tp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a fmt.Printf() after every write could be hard to maintain if we add new files to generate. Or want to change the print message. How about making it a helper function in generator.go:
func writeFileAndPrint(filePath string, data []byte, fileMode os.FileMode) error {
if err := ioutil.WriteFile(filePath, data, fileMode); err != nil {
return err
}
fmt.Printf("Create %v \n", hp)
return nil
}
And then just call it
if err := writeFileAndPrint(filepath.Join(g.projectName, gopkgtoml), buf.Bytes(), defaultFileMode) err != nil {
return err
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that's better.
Latest test:
|
all fixed. PTAL cc/ @hasbro17 |
LGTM |
fixes #82