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

Add goimports beautifier for Go language #1726

Merged
merged 1 commit into from
Jun 22, 2017

Conversation

tanyadegurechaff
Copy link
Contributor

@tanyadegurechaff tanyadegurechaff commented Jun 19, 2017

What does this implement/fix? Explain your changes.

This adds goimports beautifier for Go language.

Does this close any currently open issues?

...

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Merged with latest master branch
  • Regenerate documentation with npm run docs
  • Add change details to CHANGELOG.md under "Next" section
  • Added examples for testing to examples/ directory
  • Travis CI passes (Mac support)
  • AppVeyor passes (Windows support)

Copy link
Owner

@Glavin001 Glavin001 left a comment

Choose a reason for hiding this comment

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

Afterwards, you will also need to re-generate the documentation with npm run docs. Thanks!

isPreInstalled: false

options: {
Go: true
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like no options are supported, therefore this should be false. 😃

module.exports = class Goimports extends Beautifier
name: "goimports"
link: "https://godoc.org/golang.org/x/tools/cmd/goimports"
isPreInstalled: false
Copy link
Owner

Choose a reason for hiding this comment

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

This has been deprecated.

We have switched to using Executables: #1687

See https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/sass-convert.coffee#L7-L20 and https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/sass-convert.coffee#L30 for simple example. And another: example https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/autopep8.coffee#L12-L56

Please let me know if you have any questions! This is a new process to help standardize creating non-preinstalled beautifiers. Thanks!

Copy link
Contributor Author

@tanyadegurechaff tanyadegurechaff Jun 19, 2017

Choose a reason for hiding this comment

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

It seems that goimports doesn't have version option or subcommand.

Copy link
Owner

@Glavin001 Glavin001 Jun 19, 2017

Choose a reason for hiding this comment

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

If --version is not available then I've used --help and returned a fake version of 0.0.0 like https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/beautysh.coffee#L14-L16 after validating the --help actually works (returned golang help... or some substring).

@tanyadegurechaff
Copy link
Contributor Author

tanyadegurechaff commented Jun 20, 2017

Could you re-generate the documentation and commit to master?

@Glavin001
Copy link
Owner

Could you re-generate the documentation and commit to master?

Are you asking me? If so, I can, however I highly encourage you to do this part yourself. I need to see that your changes were setup properly before I merge and the auto-generated documentation usually shows it all worked.

It's easy: npm run docs 😄
Are you having troubles with this step? Any errors?

@tanyadegurechaff
Copy link
Contributor Author

I don't want to include changes related to #1708

@Glavin001
Copy link
Owner

Oh, I see what you mean. Pushed!

@tanyadegurechaff
Copy link
Contributor Author

Thank you for your help!

version: {
# Does not display version
args: ['--help'],
parse: (text) -> text.indexOf("usage: goimports") isnt -1 and "0.0.0",
Copy link
Owner

Choose a reason for hiding this comment

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

I also created a Docker image for goimports: https://hub.docker.com/r/unibeautify/goimports/
I am going to use it during my testing right now.

@Glavin001 Glavin001 merged commit d2eaba7 into Glavin001:master Jun 22, 2017
@Glavin001
Copy link
Owner

Worked great! Thank you for contributing!

@Glavin001 Glavin001 modified the milestones: v1.0.0, v0.31.0 Jun 22, 2017
@Glavin001
Copy link
Owner

Published to v0.30.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants