From 460421a445b58c4bda7d709d4f62f0361fc99a8c Mon Sep 17 00:00:00 2001 From: Mark van Lent Date: Tue, 19 Nov 2024 13:55:16 +0100 Subject: [PATCH] Allow user to customise gci sections To allow the user of these tasks to specify their own sections, I've introduced the GCI_SECTIONS variable (which is not defined on purpose). This also fixes the mismatch between the `gci` and `gci-write` tasks where the latter did specify sections and the former did not. --- Taskfile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 7e2af0d..8a426f3 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -105,7 +105,7 @@ tasks: cmds: - task: gci-install - | - if ~/go/bin/gci list --skip-generated . | grep "\.go$"; then + if ~/go/bin/gci list --skip-generated {{.GCI_SECTIONS}} . | grep "\.go$"; then echo "One or more golang files detected with: 'incorrect import order':" echo " * Observe: '~/go/bin/gci diff --skip-generated .'" echo " * Resolve: '~/go/bin/gci write --skip-generated .'" @@ -116,7 +116,7 @@ tasks: silent: true cmds: - task: gci-install - - ~/go/bin/gci write --skip-generated -s standard -s default . + - ~/go/bin/gci write --skip-generated {{.GCI_SECTIONS}} . golangci-lint-install: silent: true cmds: