mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 22:21:18 +02:00
Makefile: add lint check for Go version in Dockerfile and YAML
Implemented linter scripts to ensure consistency of the Go version specified in Dockerfiles and YAML files. These scripts verify that the Go version used across these files is uniform, enhancing maintainability and reducing configuration errors. This commit also introduces a `GO_VERSION` Makefile variable to control the Go version used throughout the project.
This commit is contained in:
25
Makefile
25
Makefile
@@ -32,6 +32,11 @@ ifeq ($(shell expr $(ACTIVE_GO_VERSION_MINOR) \>= 21), 1)
|
||||
LOOPVARFIX := GOEXPERIMENT=loopvar
|
||||
endif
|
||||
|
||||
# GO_VERSION is the Go version used for the release build, docker files, and
|
||||
# GitHub Actions. This is the reference version for the project. All other Go
|
||||
# versions are checked against this version.
|
||||
GO_VERSION = 1.22.5
|
||||
|
||||
GOBUILD := $(LOOPVARFIX) go build -v
|
||||
GOINSTALL := $(LOOPVARFIX) go install -v
|
||||
GOTEST := $(LOOPVARFIX) go test
|
||||
@@ -298,11 +303,27 @@ fmt-check: fmt
|
||||
@$(call print, "Checking fmt results.")
|
||||
if test -n "$$(git status --porcelain)"; then echo "code not formatted correctly, please run `make fmt` again!"; git status; git diff; exit 1; fi
|
||||
|
||||
#? lint: Run static code analysis
|
||||
lint: docker-tools
|
||||
#? check-go-version-yaml: Verify that the Go version is correct in all YAML files
|
||||
check-go-version-yaml:
|
||||
@$(call print, "Checking for target Go version (v$(GO_VERSION)) in YAML files (*.yaml, *.yml)")
|
||||
./scripts/check-go-version-yaml.sh $(GO_VERSION)
|
||||
|
||||
#? check-go-version-dockerfile: Verify that the Go version is correct in all Dockerfile files
|
||||
check-go-version-dockerfile:
|
||||
@$(call print, "Checking for target Go version (v$(GO_VERSION)) in Dockerfile files (*Dockerfile)")
|
||||
./scripts/check-go-version-dockerfile.sh $(GO_VERSION)
|
||||
|
||||
#? check-go-version: Verify that the Go version is correct in all project files
|
||||
check-go-version: check-go-version-dockerfile check-go-version-yaml
|
||||
|
||||
#? lint-source: Run static code analysis
|
||||
lint-source: docker-tools
|
||||
@$(call print, "Linting source.")
|
||||
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
|
||||
|
||||
#? lint: Run static code analysis
|
||||
lint: check-go-version lint-source
|
||||
|
||||
#? protolint: Lint proto files using protolint
|
||||
protolint:
|
||||
@$(call print, "Linting proto files.")
|
||||
|
Reference in New Issue
Block a user