Fix formatting and version formatting tools (#5540)

This commit is contained in:
Robert Kaussow
2025-09-23 00:36:46 +02:00
committed by GitHub
parent c4b1b49247
commit 8a69a1cfc6
9 changed files with 21 additions and 15 deletions

View File

@@ -1,3 +1,10 @@
# renovate: datasource=github-releases depName=mvdan/gofumpt
GOFUMPT_VERSION := v0.9.1
# renovate: datasource=github-releases depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION := v2.5.0
# renovate: datasource=docker depName=docker.io/techknowlogick/xgo
XGO_VERSION := go-1.25.x
GO_PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
TARGETOS ?= $(shell go env GOOS)
@@ -39,12 +46,11 @@ CGO_ENABLED ?= 1 # only used to compile server
HAS_GO = $(shell hash go > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
ifeq ($(HAS_GO),GO)
# renovate: datasource=docker depName=docker.io/techknowlogick/xgo
XGO_VERSION ?= go-1.25.x
CGO_CFLAGS ?= $(shell go env CGO_CFLAGS)
endif
CGO_CFLAGS ?=
# If the first argument is "in_docker"...
ifeq (in_docker,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "in_docker"
@@ -129,10 +135,10 @@ check-xgo: ## Check if xgo is installed
install-tools: ## Install development tools
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest ; \
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) ; \
fi ; \
hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go install mvdan.cc/gofumpt@latest; \
go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION); \
fi ; \
hash addlicense > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go install github.com/google/addlicense@latest; \

View File

@@ -47,7 +47,7 @@ func (o *Table) Columns() (cols []string) {
cols = append(cols, c)
}
sort.Strings(cols)
return
return cols
}
// AddFieldAlias overrides the field name to allow custom column headers.

View File

@@ -367,5 +367,5 @@ func (l *Linter) lintBadHabits(config *WorkflowConfig) (err error) {
}
}
return
return err
}

View File

@@ -227,5 +227,5 @@ func extractEmail(gitAuthor string) (author string) {
if len(matches) == 1 {
author = matches[0][1]
}
return
return author
}

View File

@@ -91,11 +91,11 @@ func ParseRepo(str string) (user, repo string, err error) {
before, after, _ := strings.Cut(str, "/")
if before == "" || after == "" {
err = fmt.Errorf("invalid or missing repository (e.g. octocat/hello-world)")
return
return user, repo, err
}
user = before
repo = after
return
return user, repo, err
}
// Update updates the repository with values from the given Repo.

View File

@@ -67,5 +67,5 @@ func taskIDs(dependsOn []string, pipelineItems []*stepbuilder.Item) (taskIDs []s
}
}
}
return
return taskIDs
}

View File

@@ -65,7 +65,7 @@ func (f *forgeFetcher) Fetch(ctx context.Context, forge forge.Forge, user *model
}
}
return
return files, err
}
type forgeFetcherContext struct {

View File

@@ -32,7 +32,7 @@ func testDriverConfig() (driver, config string) {
driver = os.Getenv("WOODPECKER_DATABASE_DRIVER")
config = os.Getenv("WOODPECKER_DATABASE_DATASOURCE")
}
return
return driver, config
}
// newTestStore creates a new database connection for testing purposes.

View File

@@ -73,7 +73,7 @@ func testDB(t *testing.T, initNewDB bool) (engine *xorm.Engine, closeDB func())
if !assert.NoError(t, err) {
t.FailNow()
}
return
return engine, closeDB
case "mysql", "postgres":
config := os.Getenv("WOODPECKER_DATABASE_DATASOURCE")
if !initNewDB {
@@ -84,12 +84,12 @@ func testDB(t *testing.T, initNewDB bool) (engine *xorm.Engine, closeDB func())
if !assert.NoError(t, err) {
t.FailNow()
}
return
return engine, closeDB
default:
t.Errorf("unsupported driver: %s", driver)
t.FailNow()
}
return
return engine, closeDB
}
func TestMigrate(t *testing.T) {