Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: updated golanglint

=c772145b2c5a
diff --git a/backend-go/Makefile b/backend-go/Makefile
index d5c91cfa5e..1e16f68fcc 100644
--- a/backend-go/Makefile
+++ b/backend-go/Makefile
@@ -1,10 +1,20 @@
-.PHONY: lint lint-fix test test-unit test-integration dev build generate test-hsm-image test-hsm
+.PHONY: lint lint-fix test test-unit test-integration dev build generate test-hsm-image test-hsm ensure-golangci-lint
+
+# golangci-lint version - keep in sync with .github/workflows/run-backend-go-tests.yml
+GOLANGCI_LINT_VERSION := v2.12.2
+
+# Ensure correct golangci-lint version is installed
+ensure-golangci-lint:
+ @if ! command -v golangci-lint >/dev/null 2>&1 || ! golangci-lint version 2>/dev/null | grep -q "$(GOLANGCI_LINT_VERSION:v%=%)"; then \
+ echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)..."; \
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION); \
+ fi
# Run linters
-lint:
+lint: ensure-golangci-lint
golangci-lint run --build-tags integration
-lint-fix:
+lint-fix: ensure-golangci-lint
go fix ./... && golangci-lint run --build-tags integration --fix
# Run unit tests only (no testcontainers)
diff --git a/backend-go/cmd/infisical/main.go b/backend-go/cmd/infisical/main.go
index c8f74e3a60..d194b28afa 100644
--- a/backend-go/cmd/infisical/main.go
+++ b/backend-go/cmd/infisical/main.go
@@ -36,12 +36,12 @@ func main() {
if err != nil {
var validationErr *config.ValidationError
if errors.As(err, &validationErr) {
- slog.ErrorContext(context.Background(), "invalid environment variables")
+ logger.ErrorContext(context.Background(), "invalid environment variables")
for _, issue := range validationErr.Issues {
- slog.ErrorContext(context.Background(), " "+issue)
+ logger.ErrorContext(context.Background(), " "+issue)
}
} else {
- slog.ErrorContext(context.Background(), "failed to load config", slog.Any("error", err))
+ logger.ErrorContext(context.Background(), "failed to load config", slog.Any("error", err))
}
os.Exit(1)
}