From 445c74c92bcf174e0f8a8cb309d1e6c1a117f708 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Sun, 13 Nov 2022 17:24:28 +0900 Subject: [PATCH] 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 * 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 Signed-off-by: Yusuke Kuoka --- .github/workflows/ci.yaml | 2 +- Makefile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1f49c4ef..d4314a44 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/Makefile b/Makefile index b2295947..d91a4a3c 100644 --- a/Makefile +++ b/Makefile @@ -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: