Skip to content
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

Cleanup and refactor code #1

Merged
merged 3 commits into from
Oct 13, 2016
Merged

Cleanup and refactor code #1

merged 3 commits into from
Oct 13, 2016

Conversation

achilleasa
Copy link
Contributor

No description provided.

This commit cleans up the code and improves its documentation
@leocassarani
Copy link
Member

I think some of the comments above your methods need to start with the method name itself in order to be parsed by godoc correctly? https://blog.golang.org/godoc-documenting-go-code

I could be wrong!

fmt.Printf("profile: call graph analyzed %d target(s) and detected %d locations for injecting profiler hooks\n", len(profileFuncs), len(profileTargets))
profileTargets, err := goPackage.Find(profileFuncs...)
if err != nil {
defer util.ExitWithError(err.Error())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a defer, when we immediately return in the line below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look a couple of lines above I use a defer() call to cleanup the tmp folder. So I am wrapping util.ExitWithError (basically prints and error and calls os.Exit(1)) with a defer so it executes after the cleanup code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait... it executes in reverse order.... :-( I need to update it to use the new cli package which supports errors

@achilleasa
Copy link
Contributor Author

Looks like godoc is picking up the comments correctly

@leocassarani
Copy link
Member

Gotcha! 🍰

@achilleasa achilleasa merged commit e316273 into master Oct 13, 2016
@achilleasa achilleasa deleted the feature-polish-code branch October 13, 2016 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants