@@ -32,28 +32,33 @@ clean:
32
32
rm -f vt
33
33
34
34
# Pretty: formats the code using gofumpt and goimports-reviser
35
- pretty : install -tools
35
+ pretty : check -tools
36
36
@echo " Running formatting tools..."
37
37
@gofumpt -l -w . > /dev/null 2>&1 || true
38
38
@goimports-reviser -project-name $$(go list -m ) -rm-unused -set-alias -format . > /dev/null 2>&1 || true
39
39
40
- # Install tools: Checks if the required tools are installed, installs if missing
40
+ # Tools installation command
41
41
install-tools :
42
- @command -v gofumpt > /dev/null 2>&1 || { \
43
- echo " Installing gofumpt..." ; \
44
- go install mvdan.cc/gofumpt@latest > /dev/null 2>&1 ; \
45
- }
46
- @command -v goimports-reviser > /dev/null 2>&1 || { \
47
- echo " Installing goimports-reviser..." ; \
48
- go install github.com/incu6us/goimports-reviser@latest > /dev/null 2>&1 ; \
49
- }
50
- @command -v golangci-lint > /dev/null 2>&1 || { \
51
- echo " Installing golangci-lint..." ; \
52
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH ) /bin $(GOLANGCI_LINT_VERSION ) ; \
53
- }
42
+ @echo " Installing gofumpt..."
43
+ go install mvdan.cc/gofumpt@latest
44
+
45
+ @echo "Installing goimports-reviser..."
46
+ go install github.com/incu6us/goimports-reviser/v3@latest
47
+
48
+ @echo "Installing golangci-lint..."
49
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)
50
+
51
+ @echo "All tools installed successfully."
52
+
53
+ # Ensure tools are available
54
+ check-tools :
55
+ @command -v gofumpt > /dev/null 2>&1 || { echo " gofumpt not found. Run 'make install-tools' to install it." >&2 ; exit 1; }
56
+ @command -v goimports-reviser > /dev/null 2>&1 || { echo " goimports-reviser not found. Run 'make install-tools' to install it." >&2 ; exit 1; }
57
+ @command -v golangci-lint > /dev/null 2>&1 || { echo " golangci_lint not found. Run 'make install-tools' to install it." >&2 ; exit 1; }
58
+
54
59
55
60
# Lint: runs golangci-lint
56
- lint : install -tools
61
+ lint : check -tools
57
62
@echo " Running golangci-lint..."
58
63
@golangci-lint run --config .golangci.yml ./go/...
59
64
0 commit comments