2022-08-28 08:27:51 +08:00
|
|
|
DIST := dist
|
2023-04-30 18:13:11 +02:00
|
|
|
EXECUTABLE := forgejo-runner
|
2022-08-28 08:27:51 +08:00
|
|
|
GOFMT ?= gofumpt -l
|
|
|
|
DIST := dist
|
|
|
|
DIST_DIRS := $(DIST)/binaries $(DIST)/release
|
2025-02-25 09:47:45 +00:00
|
|
|
GO ?= $(shell go env GOROOT)/bin/go
|
2022-08-28 08:27:51 +08:00
|
|
|
SHASUM ?= shasum -a 256
|
|
|
|
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
|
|
|
|
|
|
|
|
LINUX_ARCHS ?= linux/amd64,linux/arm64
|
|
|
|
DARWIN_ARCHS ?= darwin-12/amd64,darwin-12/arm64
|
|
|
|
WINDOWS_ARCHS ?= windows/amd64
|
2023-03-14 18:43:05 +08:00
|
|
|
GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*")
|
|
|
|
GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*")
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2025-07-04 06:49:18 +00:00
|
|
|
MOCKERY_PACKAGE ?= github.com/vektra/mockery/v2@v2.53.4 # renovate: datasource=go
|
Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.64.8 (#690)
This PR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/golangci/golangci-lint/cmd/golangci-lint](https://github.com/golangci/golangci-lint) | `v1.62.2` -> `v1.64.8` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) |
---
### Release Notes
<details>
<summary>golangci/golangci-lint (github.com/golangci/golangci-lint/cmd/golangci-lint)</summary>
### [`v1.64.8`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1648)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.7...v1.64.8)
- Detects use of configuration files from golangci-lint v2
### [`v1.64.7`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1647)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.6...v1.64.7)
1. Linters bug fixes
- `depguard`: from 2.2.0 to 2.2.1
- `dupl`: from [`3e9179a`](https://github.com/golangci/golangci-lint/commit/3e9179ac440a) to [`f665c8d`](https://github.com/golangci/golangci-lint/commit/f665c8d69b32)
- `gosec`: from 2.22.1 to 2.22.2
- `staticcheck`: from 0.6.0 to 0.6.1
2. Documentation
- Add GitLab documentation
### [`v1.64.6`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1646)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.5...v1.64.6)
1. Linters bug fixes
- `asciicheck`: from 0.4.0 to 0.4.1
- `contextcheck`: from 1.1.5 to 1.1.6
- `errcheck`: from 1.8.0 to 1.9.0
- `exptostd`: from 0.4.1 to 0.4.2
- `ginkgolinter`: from 0.19.0 to 0.19.1
- `go-exhaustruct`: from 3.3.0 to 3.3.1
- `gocheckcompilerdirectives`: from 1.2.1 to 1.3.0
- `godot`: from 1.4.20 to 1.5.0
- `perfsprint`: from 0.8.1 to 0.8.2
- `revive`: from 1.6.1 to 1.7.0
- `tagalign`: from 1.4.1 to 1.4.2
### [`v1.64.5`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1645)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.4...v1.64.5)
1. Bug fixes
- Add missing flag `new-from-merge-base-flag`
2. Linters bug fixes
- `asciicheck`: from 0.3.0 to 0.4.0
- `forcetypeassert`: from 0.1.0 to 0.2.0
- `gosec`: from 2.22.0 to 2.22.1
### [`v1.64.4`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1644)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.3...v1.64.4)
1. Linters bug fixes
- `gci`: fix standard packages list for go1.24
### [`v1.64.3`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1643)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.2...v1.64.3)
1. Linters bug fixes
- `ginkgolinter`: from 0.18.4 to 0.19.0
- `go-critic`: from 0.11.5 to 0.12.0
- `revive`: from 1.6.0 to 1.6.1
- `gci`: fix standard packages list for go1.24
2. Misc.
- Build Docker images with go1.24
### [`v1.64.2`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1642)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.1...v1.64.2)
This is the last minor release of golangci-lint v1.
The next release will be golangci-lint [v2](https://github.com/golangci/golangci-lint/issues/5300).
1. Enhancements
- 🎉 go1.24 support
- New `issues.new-from-merge-base` option
- New `run.relative-path-mode` option
2. Linters new features
- `copyloopvar`: from 1.1.0 to 1.2.1 (support suggested fixes)
- `exptostd`: from 0.3.1 to 0.4.1 (handles `golang.org/x/exp/constraints.Ordered`)
- `fatcontext`: from 0.5.3 to 0.7.1 (new option: `check-struct-pointers`)
- `perfsprint`: from 0.7.1 to 0.8.1 (new options: `integer-format`, `error-format`, `string-format`, `bool-format`, and `hex-format`)
- `revive`: from 1.5.1 to 1.6.0 (new rules: `redundant-build-tag`, `use-errors-new`. New option `early-return.early-return`)
3. Linters bug fixes
- `go-errorlint`: from 1.7.0 to 1.7.1
- `gochecknoglobals`: from 0.2.1 to 0.2.2
- `godox`: from [`006bad1`](https://github.com/golangci/golangci-lint/commit/006bad1f9d26) to 1.1.0
- `gosec`: from 2.21.4 to 2.22.0
- `iface`: from 1.3.0 to 1.3.1
- `nilnesserr`: from 0.1.1 to 0.1.2
- `protogetter`: from 0.3.8 to 0.3.9
- `sloglint`: from 0.7.2 to 0.9.0
- `spancheck`: fix default `StartSpanMatchersSlice` values
- `staticcheck`: from 0.5.1 to 0.6.0
4. Deprecations
- ⚠️ `tenv` is deprecated and replaced by `usetesting.os-setenv: true`.
- ⚠️ `exportloopref` deprecation step 2
5. Misc.
- Sanitize severities by output format
- Avoid panic with plugin without description
6. Documentation
- Clarify `depguard` configuration
### [`v1.64.1`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1641)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.64.0...v1.64.1)
Cancelled due to CI failure.
### [`v1.64.0`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1640)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.63.4...v1.64.0)
Cancelled due to CI failure.
### [`v1.63.4`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1634)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.63.3...v1.63.4)
1. Linters bug fixes
- `dupl`, `gomodguard`, `revive`: keep only Go-files.
### [`v1.63.3`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1633)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.63.2...v1.63.3)
1. Linters bug fixes
- `gofmt`, `gofumpt`, `goimports`, `gci`: panic with several trailing EOL
- `goheader`: skip issues with invalid positions
### [`v1.63.2`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1632)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.63.1...v1.63.2)
1. Linters bug fixes
- `gofmt`, `gofumpt`, `goimports`, `gci`: panic with missing trailing EOL
### [`v1.63.1`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1631)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.63.0...v1.63.1)
1. Linters bug fixes
- `cgi`: invalid reports with cgo
- `gofumpt`: panic with autofix and cgo
### [`v1.63.0`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1630)
[Compare Source](https://github.com/golangci/golangci-lint/compare/v1.62.2...v1.63.0)
1. Enhancements
- Add support for SuggestedFixes 🎉 (35 linters can "autofix" reports).
- Formatters (`gofmt`, `goimports`, `gofumpt`, `gci`) are applied after the suggested fixes.
2. New linters
- Add `exptostd` linter https://github.com/ldez/exptostd
- Add `nilnesserr` linter https://github.com/alingse/nilnesserr
- Add `usetesting` linter https://github.com/ldez/usetesting
3. Linters new features
- `gci`: new options: `no-inline-comments`, `no-prefix-comments`
- `gomoddirectives`: from 0.2.4 to 0.6.0 (new options: `go-version-pattern`, `toolchain-pattern`,`toolchain-forbidden`, `tool-forbidden`, `go-debug-forbidden`)
- `govet`: new `stdversion`, `waitgroup` analyzers
- `importas`: allow multiple empty aliases
- `loggercheck`: new `slog` option
- `recvcheck`: from 0.1.2 to 0.2.0 (new options: `disable-builtin`, `exclusions`)
- `tagliatelle`: from 0.5.0 to 0.7.1 (new options: `ignored-fields`, `extended-rules`,`overrides`, `pkg`, `ignore`)
- `usestdlibvars`: from 1.27.0 to 1.28.0 (autofix)
- `wrapcheck`: from 2.9.0 to 2.10.0 (new option: `extra-ignore-sigs`)
4. Linters bug fixes
- `asciicheck`: from 0.2.0 to 0.3.0
- `bodyclose`: from [`5742072`](https://github.com/golangci/golangci-lint/commit/574207250966) to [`ed6a65f`](https://github.com/golangci/golangci-lint/commit/ed6a65f985e)
- `funlen`: from 0.1.0 to 0.2.0
- `ginkgolinter`: from 0.18.3 to 0.18.4
- `gochecksumtype`: from 0.2.0 to 0.3.1
- `gocognit`: from 1.1.3 to 1.2.0
- `godot`: from 1.4.18 to 1.4.20
- `goheader`: report position improvement
- `gosec`: handling of global nosec option when it is false
- `iface`: from 1.2.1 to 1.3.0
- `importas`: from 0.1.0 to 0.2.0
- `intrange`: from 0.2.1 to 0.3.0
- `makezero`: from 1.1.1 to 1.2.0
- `mirror`: from 1.2.0 to 1.3.0
- `nilnil`: from 1.0.0 to 1.0.1
- `nosprintfhostport`: from 0.1.1 to 0.2.0
- `reassign`: from 0.2.0 to 0.3.0
- `spancheck`: from 0.6.2 to 0.6.4
- `tagalign`: from 1.3.4 to 1.4.1
- `wastedassign`: from 2.0.7 to 2.1.0
- `whitespace`: from 0.1.1 to 0.2.0
- `wsl`: from 4.4.1 to 4.5.0
5. Deprecations
- ⚠️ `output.uniq-by-line` is deprecated and replaced by `issues.uniq-by-line`.
6. Misc.
- Improvements of the help command (color and JSON support).
- Removes `decoder`, `sloglint`, `tagalign` from `format` preset.
- Enables paths with junction inside Windows.
- The timeout is disabled if `run.timeout` <= 0.
</details>
---
### Configuration
📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4yMy4yIiwidXBkYXRlZEluVmVyIjoiNDEuMjMuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/690
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-07-12 07:52:16 +00:00
|
|
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8 # renovate: datasource=go
|
2025-07-03 16:41:05 +00:00
|
|
|
|
2023-04-13 04:17:08 +08:00
|
|
|
DOCKER_IMAGE ?= gitea/act_runner
|
|
|
|
DOCKER_TAG ?= nightly
|
|
|
|
DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)
|
2023-06-15 05:27:35 +00:00
|
|
|
DOCKER_ROOTLESS_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)-dind-rootless
|
2023-04-13 04:17:08 +08:00
|
|
|
|
2023-04-30 18:13:11 +02:00
|
|
|
EXTLDFLAGS = -extldflags "-static" $(null)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
|
|
|
ifeq ($(HAS_GO), GO)
|
|
|
|
GOPATH ?= $(shell $(GO) env GOPATH)
|
|
|
|
export PATH := $(GOPATH)/bin:$(PATH)
|
|
|
|
|
|
|
|
CGO_EXTRA_CFLAGS := -DSQLITE_MAX_VARIABLE_NUMBER=32766
|
|
|
|
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OS), Windows_NT)
|
|
|
|
GOFLAGS := -v -buildmode=exe
|
|
|
|
EXECUTABLE ?= $(EXECUTABLE).exe
|
|
|
|
else ifeq ($(OS), Windows)
|
|
|
|
GOFLAGS := -v -buildmode=exe
|
|
|
|
EXECUTABLE ?= $(EXECUTABLE).exe
|
|
|
|
else
|
|
|
|
GOFLAGS := -v
|
|
|
|
EXECUTABLE ?= $(EXECUTABLE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
STORED_VERSION_FILE := VERSION
|
|
|
|
|
|
|
|
ifneq ($(DRONE_TAG),)
|
|
|
|
VERSION ?= $(subst v,,$(DRONE_TAG))
|
2025-06-01 15:03:22 +00:00
|
|
|
RELEASE_VERSION ?= $(VERSION)
|
2022-08-28 08:27:51 +08:00
|
|
|
else
|
|
|
|
ifneq ($(DRONE_BRANCH),)
|
|
|
|
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
|
|
|
|
else
|
2023-03-13 18:57:35 +08:00
|
|
|
VERSION ?= main
|
2022-08-28 08:27:51 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null)
|
|
|
|
ifneq ($(STORED_VERSION),)
|
2025-06-01 15:03:22 +00:00
|
|
|
RELEASE_VERSION ?= $(STORED_VERSION)
|
2022-08-28 08:27:51 +08:00
|
|
|
else
|
2025-06-01 15:03:22 +00:00
|
|
|
RELEASE_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
2022-08-28 08:27:51 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2025-07-03 19:01:33 +02:00
|
|
|
GO_PACKAGES_TO_VET ?= $(filter-out runner.forgejo.org/internal/pkg/client/mocks,$(shell $(GO) list ./...))
|
2023-05-06 17:00:52 +08:00
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
TAGS ?=
|
2025-07-03 19:01:33 +02:00
|
|
|
LDFLAGS ?= -X "runner.forgejo.org/internal/pkg/ver.version=v$(RELEASE_VERSION)"
|
2022-08-28 08:27:51 +08:00
|
|
|
|
|
|
|
all: build
|
|
|
|
|
2025-07-11 07:57:23 +00:00
|
|
|
.PHONY: lint
|
|
|
|
lint-check:
|
|
|
|
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS)
|
|
|
|
|
|
|
|
.PHONY: lint-fix
|
|
|
|
lint:
|
|
|
|
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS) --fix
|
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
fmt:
|
|
|
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
2023-02-24 23:30:09 +08:00
|
|
|
$(GO) install mvdan.cc/gofumpt@latest; \
|
2022-08-28 08:27:51 +08:00
|
|
|
fi
|
2023-03-14 18:43:05 +08:00
|
|
|
$(GOFMT) -w $(GO_FMT_FILES)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2023-03-16 11:37:08 +08:00
|
|
|
.PHONY: go-check
|
|
|
|
go-check:
|
|
|
|
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9]+' go.mod | cut -d' ' -f2))
|
|
|
|
$(eval MIN_GO_VERSION := $(shell printf "%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')))
|
|
|
|
$(eval GO_VERSION := $(shell printf "%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9]+' | tr '.' ' ');))
|
|
|
|
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
|
|
|
|
echo "Act Runner requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
.PHONY: fmt-check
|
|
|
|
fmt-check:
|
|
|
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
2023-02-24 23:30:09 +08:00
|
|
|
$(GO) install mvdan.cc/gofumpt@latest; \
|
2022-08-28 08:27:51 +08:00
|
|
|
fi
|
2023-03-14 18:43:05 +08:00
|
|
|
@diff=$$($(GOFMT) -d $(GO_FMT_FILES)); \
|
2022-08-28 08:27:51 +08:00
|
|
|
if [ -n "$$diff" ]; then \
|
|
|
|
echo "Please run 'make fmt' and commit the result:"; \
|
|
|
|
echo "$${diff}"; \
|
|
|
|
exit 1; \
|
|
|
|
fi;
|
|
|
|
|
2025-07-11 07:57:23 +00:00
|
|
|
test: lint-check fmt-check
|
2022-08-28 08:27:51 +08:00
|
|
|
@$(GO) test -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
|
|
|
|
2023-02-28 18:44:46 +08:00
|
|
|
.PHONY: vet
|
|
|
|
vet:
|
|
|
|
@echo "Running go vet..."
|
2023-07-13 09:08:21 +02:00
|
|
|
@$(GO) vet $(GO_PACKAGES_TO_VET)
|
2023-02-28 18:44:46 +08:00
|
|
|
|
2025-07-03 16:41:05 +00:00
|
|
|
.PHONY: generate
|
|
|
|
generate:
|
|
|
|
$(GO) generate ./...
|
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
install: $(GOFILES)
|
|
|
|
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
|
|
|
|
|
2023-03-16 11:37:08 +08:00
|
|
|
build: go-check $(EXECUTABLE)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
|
|
|
$(EXECUTABLE): $(GOFILES)
|
2023-04-30 18:13:11 +02:00
|
|
|
$(GO) build -v -tags 'netgo osusergo $(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@
|
2022-08-28 08:27:51 +08:00
|
|
|
|
2025-07-03 16:41:05 +00:00
|
|
|
.PHONY: deps-tools
|
|
|
|
deps-tools:
|
|
|
|
$(GO) install $(MOCKERY_PACKAGE)
|
2022-08-28 08:27:51 +08:00
|
|
|
|
|
|
|
$(DIST_DIRS):
|
|
|
|
mkdir -p $(DIST_DIRS)
|
|
|
|
|
2023-04-13 04:17:08 +08:00
|
|
|
.PHONY: docker
|
|
|
|
docker:
|
2023-04-25 03:15:48 +08:00
|
|
|
if ! docker buildx version >/dev/null 2>&1; then \
|
|
|
|
ARG_DISABLE_CONTENT_TRUST=--disable-content-trust=false; \
|
|
|
|
fi; \
|
|
|
|
docker build $${ARG_DISABLE_CONTENT_TRUST} -t $(DOCKER_REF) .
|
2023-06-12 06:35:27 +00:00
|
|
|
docker build $${ARG_DISABLE_CONTENT_TRUST} -t $(DOCKER_ROOTLESS_REF) -f Dockerfile.rootless .
|
2023-04-13 04:17:08 +08:00
|
|
|
|
2022-08-28 08:27:51 +08:00
|
|
|
clean:
|
|
|
|
$(GO) clean -x -i ./...
|
|
|
|
rm -rf coverage.txt $(EXECUTABLE) $(DIST)
|
|
|
|
|
|
|
|
version:
|
|
|
|
@echo $(VERSION)
|