-
Notifications
You must be signed in to change notification settings - Fork 76
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 Post Processor #96
Add GoImports Post Processor #96
Conversation
@dkunitsk any chance to see this merged soon? We would also be interested in this feature. |
In the But this is never use by type goImports struct {}
// GoImports returns a PostProcessor that run goimports on any files ending in ".go"
func GoImports() pgs.PostProcessor { return goImports{} }
func (g goImports) Match(a pgs.Artifact) bool {
var n string
switch a := a.(type) {
case pgs.GeneratorFile:
n = a.Name
case pgs.GeneratorTemplateFile:
n = a.Name
case pgs.CustomFile:
n = a.Name
case pgs.CustomTemplateFile:
n = a.Name
default:
return false
}
return strings.HasSuffix(n, ".go")
}
func (g goImports) Process(in []byte) ([]byte, error) {
// We do not want to give a filename here, ever
return imports.Process("", in, nil)
} |
apply @upils's feedback!
thanks @upils ! I have updated my branch with your feedback. @keith @ardakuyumcu @pdecks Could you please review this? Thanks! |
Co-authored-by: Tricia Decker <1440268+pdecks@users.noreply.github.com>
Co-authored-by: Tricia Decker <1440268+pdecks@users.noreply.github.com>
Co-authored-by: Tricia Decker <1440268+pdecks@users.noreply.github.com>
Co-authored-by: Tricia Decker <1440268+pdecks@users.noreply.github.com>
Co-authored-by: Tricia Decker <1440268+pdecks@users.noreply.github.com>
Co-authored-by: Tricia Decker <1440268+pdecks@users.noreply.github.com>
Co-authored-by: Tricia Decker <1440268+pdecks@users.noreply.github.com>
Hello @pdecks I have updated the PR with your feedback. |
It looks like the linter test started failing after this merge commit: cd567a8 |
This is now fixed @pdecks |
@pdecks When can we expect a new release with this PR? |
You'll need to address the error in the |
I've fixed the |
Thanks for the heads up -- a teammate had enabled |
To re-run tests / clear pre-commit.ci failure.
Thanks a lot for this wonderful framework. I was building a protoc-gen plugin and needed a post processor for
GoImports
. As it was not a part of this framework, I implemented my own. I think that this could be a useful part of this framework.