Skip to content

Commit e1e22c6

Browse files
kaovilaiclaude
andcommitted
Add lint-fix make targets
This commit adds lint-fix and local-lint-fix make targets that automatically fix linting issues using golangci-lint --fix. The implementation reuses the existing hack/lint.sh script by adding support for a "fix" parameter that enables the --fix flag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Tiger Kaovilai <[email protected]>
1 parent 45755e1 commit e1e22c6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ ifneq ($(SKIP_TESTS), 1)
336336
@hack/lint.sh
337337
endif
338338

339+
lint-fix:
340+
ifneq ($(SKIP_TESTS), 1)
341+
@$(MAKE) shell CMD="-c 'hack/lint.sh fix'"
342+
endif
343+
344+
local-lint-fix:
345+
ifneq ($(SKIP_TESTS), 1)
346+
@hack/lint.sh fix
347+
endif
348+
339349
update:
340350
@$(MAKE) shell CMD="-c 'hack/update-all.sh'"
341351

hack/lint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ golangci-lint cache status
2020
# Enable GL_DEBUG line below for debug messages for golangci-lint
2121
# export GL_DEBUG=loader,gocritic,env
2222
CMD="golangci-lint run"
23+
24+
# Add --fix flag if first argument is "fix"
25+
if [ "$1" = "fix" ]; then
26+
CMD="$CMD --fix"
27+
fi
28+
2329
echo "Running $CMD"
2430

2531
eval $CMD

0 commit comments

Comments
 (0)