|
8 | 8 | go-lint: |
9 | 9 | @$(LOG_TARGET) |
10 | 10 | @echo "Running golangci-lint for src/semantic-router..." |
11 | | - @set -e; \ |
12 | | - BIN=$$(command -v golangci-lint || true); \ |
13 | | - if [ -z "$$BIN" ] && [ -x "/snap/bin/golangci-lint" ]; then BIN="/snap/bin/golangci-lint"; fi; \ |
14 | | - if [ -z "$$BIN" ]; then \ |
15 | | - if command -v go >/dev/null 2>&1; then \ |
16 | | - echo "Installing golangci-lint via 'go install'..."; \ |
17 | | - GOPATH_DIR=$$(go env GOPATH); \ |
18 | | - BIN="$$GOPATH_DIR/bin/golangci-lint"; \ |
19 | | - go install github.com/golangci/golangci-lint/cmd/ [email protected]; \ |
20 | | - else \ |
21 | | - echo "ERROR: golangci-lint not found. Add /snap/bin to PATH or install via 'go install'." >&2; \ |
22 | | - echo "Hint: export PATH=\$$PATH:/snap/bin" >&2; \ |
23 | | - exit 127; \ |
24 | | - fi; \ |
25 | | - fi; \ |
26 | | - cd src/semantic-router/ && "$$BIN" run ./... --config ../../tools/linter/go/.golangci.yml |
| 11 | + @cd src/semantic-router/ && golangci-lint run ./... --config ../../tools/linter/go/.golangci.yml |
27 | 12 | @echo "✅ src/semantic-router go module lint passed" |
28 | 13 |
|
29 | 14 | # golangci-lint fix for Go modules |
30 | 15 | # Tips: only fix src/semantic-router and some files may need manual fix. |
31 | 16 | go-lint-fix: |
32 | 17 | @$(LOG_TARGET) |
33 | 18 | @echo "Running golangci-lint fix for src/semantic-router..." |
34 | | - @set -e; \ |
35 | | - BIN=$$(command -v golangci-lint || true); \ |
36 | | - if [ -z "$$BIN" ] && [ -x "/snap/bin/golangci-lint" ]; then BIN="/snap/bin/golangci-lint"; fi; \ |
37 | | - if [ -z "$$BIN" ]; then \ |
38 | | - if command -v go >/dev/null 2>&1; then \ |
39 | | - echo "Installing golangci-lint via 'go install'..."; \ |
40 | | - GOPATH_DIR=$$(go env GOPATH); \ |
41 | | - BIN="$$GOPATH_DIR/bin/golangci-lint"; \ |
42 | | - go install github.com/golangci/golangci-lint/cmd/ [email protected]; \ |
43 | | - else \ |
44 | | - echo "ERROR: golangci-lint not found. Add /snap/bin to PATH or install via 'go install'." >&2; \ |
45 | | - echo "Hint: export PATH=\$$PATH:/snap/bin" >&2; \ |
46 | | - exit 127; \ |
47 | | - fi; \ |
48 | | - fi; \ |
49 | | - cd src/semantic-router/ && "$$BIN" run ./... --fix --config ../../tools/linter/go/.golangci.yml |
| 19 | + @cd src/semantic-router/ && golangci-lint run ./... --fix --config ../../tools/linter/go/.golangci.yml |
50 | 20 | @echo "✅ src/semantic-router go module lint fix applied" |
51 | 21 |
|
52 | 22 | # Run go vet for all Go modules |
|
0 commit comments