Enhance `make fmt` to cover running gci for golangci-lint compat (#515)

* Enhance `make fmt` to cover running gci for golangci-lint compat

I have been using `make fmt` for formatting code before submitting a pull request. It turned out not to work in some cases where you added a new import because the default go-fmt obviously do not organize imports as the golangci-lint and gci expect.
This fixes that, by adding a gci command to the `make fmt` target.
Please note that this does not cover installing gci. If you need, please submit another pull request to add something like a `make install-gci` and make the `make fmt` depenedent on that target, so that one can get automatic gci installation when running `make fmt` for first time.

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

* We don't need running gci via make on CI as we already run it as part of golangci-lint run

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
Yusuke Kuoka 2022-11-13 17:24:28 +09:00 committed by GitHub
parent f09ec18aa9
commit 445c74c92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -34,7 +34,7 @@ jobs:
- name: Build
run: make build build-test-tools
- name: Test
run: make check pristine test
run: make check test
- name: Prepare tar to upload built binaries
run: tar -cvf built-binaries.tar helmfile diff-yamls yamldiff

View File

@ -31,6 +31,7 @@ generate:
fmt:
go fmt ${PKGS}
gci write --skip-generated -s standard -s default -s 'prefix(github.com/helmfile/helmfile)' .
.PHONY: fmt
check: