mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-23 19:11:58 +01:00
update to build with go1.20 (#22732)
as title --------- Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
1410e13dc5
commit
cfb1cb1168
8 changed files with 27 additions and 30 deletions
32
.drone.yml
32
.drone.yml
|
@ -25,7 +25,7 @@ steps:
|
||||||
- make deps-frontend
|
- make deps-frontend
|
||||||
|
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- make deps-backend
|
- make deps-backend
|
||||||
|
@ -88,7 +88,7 @@ steps:
|
||||||
depends_on: [deps-frontend]
|
depends_on: [deps-frontend]
|
||||||
|
|
||||||
- name: checks-backend
|
- name: checks-backend
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
commands:
|
commands:
|
||||||
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
|
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
|
||||||
depends_on: [deps-backend]
|
depends_on: [deps-backend]
|
||||||
|
@ -109,7 +109,7 @@ steps:
|
||||||
depends_on: [deps-frontend]
|
depends_on: [deps-frontend]
|
||||||
|
|
||||||
- name: build-backend-no-gcc
|
- name: build-backend-no-gcc
|
||||||
image: golang:1.18 # this step is kept as the lowest version of golang that we support
|
image: golang:1.19 # this step is kept as the lowest version of golang that we support
|
||||||
pull: always
|
pull: always
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
|
@ -122,7 +122,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: build-backend-arm64
|
- name: build-backend-arm64
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
GOPROXY: https://goproxy.io
|
GOPROXY: https://goproxy.io
|
||||||
|
@ -138,7 +138,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: build-backend-windows
|
- name: build-backend-windows
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
GOPROXY: https://goproxy.io
|
GOPROXY: https://goproxy.io
|
||||||
|
@ -153,7 +153,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: build-backend-386
|
- name: build-backend-386
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
environment:
|
environment:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
GOPROXY: https://goproxy.io
|
GOPROXY: https://goproxy.io
|
||||||
|
@ -247,7 +247,7 @@ steps:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- make deps-backend
|
- make deps-backend
|
||||||
|
@ -364,7 +364,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: generate-coverage
|
- name: generate-coverage
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
commands:
|
commands:
|
||||||
- make coverage
|
- make coverage
|
||||||
environment:
|
environment:
|
||||||
|
@ -440,7 +440,7 @@ steps:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- make deps-backend
|
- make deps-backend
|
||||||
|
@ -557,7 +557,7 @@ steps:
|
||||||
- name: test-e2e
|
- name: test-e2e
|
||||||
image: mcr.microsoft.com/playwright:v1.29.2-focal
|
image: mcr.microsoft.com/playwright:v1.29.2-focal
|
||||||
commands:
|
commands:
|
||||||
- curl -sLO https://go.dev/dl/go1.19.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
|
- curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
|
||||||
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
|
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
|
||||||
- apt-get -qq update && apt-get -qqy install build-essential
|
- apt-get -qq update && apt-get -qqy install build-essential
|
||||||
- export TEST_PGSQL_SCHEMA=''
|
- export TEST_PGSQL_SCHEMA=''
|
||||||
|
@ -656,7 +656,7 @@ trigger:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: download
|
- name: download
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- timeout -s ABRT 40m make generate-license generate-gitignore
|
- timeout -s ABRT 40m make generate-license generate-gitignore
|
||||||
|
@ -720,7 +720,7 @@ steps:
|
||||||
- make deps-frontend
|
- make deps-frontend
|
||||||
|
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- make deps-backend
|
- make deps-backend
|
||||||
|
@ -729,7 +729,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: static
|
- name: static
|
||||||
image: techknowlogick/xgo:go-1.19.x
|
image: techknowlogick/xgo:go-1.20.x
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
|
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
|
||||||
|
@ -841,7 +841,7 @@ steps:
|
||||||
- make deps-frontend
|
- make deps-frontend
|
||||||
|
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- make deps-backend
|
- make deps-backend
|
||||||
|
@ -850,7 +850,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: static
|
- name: static
|
||||||
image: techknowlogick/xgo:go-1.19.x
|
image: techknowlogick/xgo:go-1.20.x
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
|
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
|
||||||
|
@ -932,7 +932,7 @@ trigger:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-docs
|
- name: build-docs
|
||||||
image: golang:1.19
|
image: golang:1.20
|
||||||
commands:
|
commands:
|
||||||
- cd docs
|
- cd docs
|
||||||
- make trans-copy clean build
|
- make trans-copy clean build
|
||||||
|
|
|
@ -28,7 +28,7 @@ linters:
|
||||||
fast: false
|
fast: false
|
||||||
|
|
||||||
run:
|
run:
|
||||||
go: 1.19
|
go: 1.20
|
||||||
timeout: 10m
|
timeout: 10m
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
- node_modules
|
- node_modules
|
||||||
|
@ -74,7 +74,7 @@ linters-settings:
|
||||||
- name: modifies-value-receiver
|
- name: modifies-value-receiver
|
||||||
gofumpt:
|
gofumpt:
|
||||||
extra-rules: true
|
extra-rules: true
|
||||||
lang-version: "1.19"
|
lang-version: "1.20"
|
||||||
depguard:
|
depguard:
|
||||||
list-type: denylist
|
list-type: denylist
|
||||||
# Check the list against standard lib.
|
# Check the list against standard lib.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#Build stage
|
#Build stage
|
||||||
FROM golang:1.19-alpine3.17 AS build-env
|
FROM golang:1.20-alpine3.17 AS build-env
|
||||||
|
|
||||||
ARG GOPROXY
|
ARG GOPROXY
|
||||||
ENV GOPROXY ${GOPROXY:-direct}
|
ENV GOPROXY ${GOPROXY:-direct}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#Build stage
|
#Build stage
|
||||||
FROM golang:1.19-alpine3.17 AS build-env
|
FROM golang:1.20-alpine3.17 AS build-env
|
||||||
|
|
||||||
ARG GOPROXY
|
ARG GOPROXY
|
||||||
ENV GOPROXY ${GOPROXY:-direct}
|
ENV GOPROXY ${GOPROXY:-direct}
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -23,13 +23,13 @@ SHASUM ?= shasum -a 256
|
||||||
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
|
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
|
||||||
COMMA := ,
|
COMMA := ,
|
||||||
|
|
||||||
XGO_VERSION := go-1.19.x
|
XGO_VERSION := go-1.20.x
|
||||||
|
|
||||||
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
|
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
|
||||||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0
|
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0
|
||||||
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
|
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
|
||||||
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
|
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
|
||||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
|
||||||
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
|
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
|
||||||
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
||||||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.3
|
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.3
|
||||||
|
|
|
@ -19,8 +19,8 @@ params:
|
||||||
author: The Gitea Authors
|
author: The Gitea Authors
|
||||||
website: https://docs.gitea.io
|
website: https://docs.gitea.io
|
||||||
version: 1.18.1
|
version: 1.18.1
|
||||||
minGoVersion: 1.18
|
minGoVersion: 1.19
|
||||||
goVersion: 1.19
|
goVersion: 1.20
|
||||||
minNodeVersion: 16
|
minNodeVersion: 16
|
||||||
search: nav
|
search: nav
|
||||||
repo: "https://github.com/go-gitea/gitea"
|
repo: "https://github.com/go-gitea/gitea"
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
||||||
module code.gitea.io/gitea
|
module code.gitea.io/gitea
|
||||||
|
|
||||||
go 1.18
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
code.gitea.io/actions-proto-go v0.2.0
|
code.gitea.io/actions-proto-go v0.2.0
|
||||||
|
|
|
@ -37,9 +37,7 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
|
||||||
}
|
}
|
||||||
schemaValue, _ := driver.String.ConvertValue(setting.Database.Schema)
|
schemaValue, _ := driver.String.ConvertValue(setting.Database.Schema)
|
||||||
|
|
||||||
// golangci lint is incorrect here - there is no benefit to using driver.ExecerContext here
|
if execer, ok := conn.(driver.Execer); ok {
|
||||||
// and in any case pq does not implement it
|
|
||||||
if execer, ok := conn.(driver.Execer); ok { //nolint
|
|
||||||
_, err := execer.Exec(`SELECT set_config(
|
_, err := execer.Exec(`SELECT set_config(
|
||||||
'search_path',
|
'search_path',
|
||||||
$1 || ',' || current_setting('search_path'),
|
$1 || ',' || current_setting('search_path'),
|
||||||
|
@ -63,8 +61,7 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
|
||||||
|
|
||||||
// driver.String.ConvertValue will never return err for string
|
// driver.String.ConvertValue will never return err for string
|
||||||
|
|
||||||
// golangci lint is incorrect here - there is no benefit to using stmt.ExecWithContext here
|
_, err = stmt.Exec([]driver.Value{schemaValue})
|
||||||
_, err = stmt.Exec([]driver.Value{schemaValue}) //nolint
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = conn.Close()
|
_ = conn.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue