Skip to content

Commit

Permalink
Allow user to customise gci sections
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
markvl-sbp committed Nov 19, 2024
1 parent 4aad9fa commit 460421a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .'"
Expand All @@ -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:
Expand Down

0 comments on commit 460421a

Please sign in to comment.