Skip to content

Check go files formatting with goimports

Philippe Lafoucrière requested to merge gofmt into master

This MR adds a check for unformatted go files. Unformatted files will be formatted eventually by engineers with an automatic goimports, and will lead to unrelated formatting changes in commits. We should block these files from being committed to our protected branches.

Ex: The job will produce (for the spotbugs project):

Invalid formatting in files:
project/project_test.go
sdkman/sdkman.go

https://gitlab.com/gitlab-org/security-products/analyzers/spotbugs/blob/b0742d897608ddbe7ddecd0f79055488db245975/sdkman/sdkman.go https://gitlab.com/gitlab-org/security-products/analyzers/spotbugs/blob/b0742d897608ddbe7ddecd0f79055488db245975/project/project_test.go

Note that I didn't restrict this job to branches, so it's likely that several masters will go red after this change. We need to fix this code anyway.

Edited by Adam Cohen

Merge request reports