Skip to content

Commit

Permalink
Bump to build with go1.18 (#19120 et al) (#19127)
Browse files Browse the repository at this point in the history
Backport #19120 
Backport #19099 
Backport #18874 
Backport #18420
Backport #19128
Backport #18270 

Bump to build with go1.18

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Jelle Hulter <jellehulter@gmail.com>
  • Loading branch information
5 people committed Mar 19, 2022
1 parent e6d46ee commit f9ea4ab
Show file tree
Hide file tree
Showing 16 changed files with 1,053 additions and 338 deletions.
39 changes: 24 additions & 15 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ steps:
- make deps-frontend

- name: deps-backend
image: golang:1.17
image: golang:1.18
pull: always
commands:
- make deps-backend
Expand All @@ -49,18 +49,24 @@ steps:
GOSUMDB: sum.golang.org
TAGS: bindata sqlite sqlite_unlock_notify
depends_on: [deps-backend]
volumes:
- name: deps
path: /go

- name: lint-backend-windows
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
commands:
- make golangci-lint vet
- make golangci-lint-windows vet
environment:
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
GOSUMDB: sum.golang.org
TAGS: bindata sqlite sqlite_unlock_notify
GOOS: windows
GOARCH: amd64
depends_on: [deps-backend]
volumes:
- name: deps
path: /go

- name: lint-backend-gogit
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
Expand All @@ -71,6 +77,9 @@ steps:
GOSUMDB: sum.golang.org
TAGS: bindata gogit sqlite sqlite_unlock_notify
depends_on: [deps-backend]
volumes:
- name: deps
path: /go

- name: checks-frontend
image: node:16
Expand All @@ -79,7 +88,7 @@ steps:
depends_on: [deps-frontend]

- name: checks-backend
image: golang:1.17
image: golang:1.18
commands:
- make checks-backend
depends_on: [deps-backend]
Expand All @@ -100,7 +109,7 @@ steps:
depends_on: [test-frontend]

- name: build-backend-no-gcc
image: golang:1.16 # this step is kept as the lowest version of golang that we support
image: golang:1.17 # this step is kept as the lowest version of golang that we support
pull: always
environment:
GO111MODULE: on
Expand All @@ -113,7 +122,7 @@ steps:
path: /go

- name: build-backend-arm64
image: golang:1.17
image: golang:1.18
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
Expand All @@ -129,7 +138,7 @@ steps:
path: /go

- name: build-backend-windows
image: golang:1.17
image: golang:1.18
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
Expand All @@ -144,7 +153,7 @@ steps:
path: /go

- name: build-backend-386
image: golang:1.17
image: golang:1.18
environment:
GO111MODULE: on
GOPROXY: https://goproxy.cn
Expand Down Expand Up @@ -233,7 +242,7 @@ steps:
- pull_request

- name: deps-backend
image: golang:1.17
image: golang:1.18
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -350,7 +359,7 @@ steps:
path: /go

- name: generate-coverage
image: golang:1.17
image: golang:1.18
commands:
- make coverage
environment:
Expand Down Expand Up @@ -425,7 +434,7 @@ steps:
- pull_request

- name: deps-backend
image: golang:1.17
image: golang:1.18
pull: always
commands:
- make deps-backend
Expand Down Expand Up @@ -567,7 +576,7 @@ trigger:

steps:
- name: download
image: golang:1.17
image: golang:1.18
pull: always
commands:
- timeout -s ABRT 40m make generate-license generate-gitignore
Expand Down Expand Up @@ -628,7 +637,7 @@ steps:
- make deps-frontend

- name: deps-backend
image: golang:1.17
image: golang:1.18
pull: always
commands:
- make deps-backend
Expand All @@ -637,7 +646,7 @@ steps:
path: /go

- name: static
image: techknowlogick/xgo:go-1.17.x
image: techknowlogick/xgo:go-1.18.x
pull: always
commands:
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
Expand Down Expand Up @@ -746,7 +755,7 @@ steps:
- make deps-frontend

- name: deps-backend
image: golang:1.17
image: golang:1.18
pull: always
commands:
- make deps-backend
Expand All @@ -755,7 +764,7 @@ steps:
path: /go

- name: static
image: techknowlogick/xgo:go-1.17.x
image: techknowlogick/xgo:go-1.18.x
pull: always
commands:
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
Expand Down
15 changes: 13 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ linters:
#- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
- gofmt
- misspell
- gocritic
#- gocritic # TODO: disabled until fixed with go 1.18
- bidichk
- ineffassign
- revive
Expand All @@ -22,7 +22,7 @@ linters:
fast: false

run:
timeout: 3m
timeout: 10m
skip-dirs:
- node_modules
- public
Expand Down Expand Up @@ -61,6 +61,9 @@ linters-settings:
- name: errorf
- name: duplicated-imports
- name: modifies-value-receiver
gofumpt:
extra-rules: true
lang-version: 1.18

issues:
exclude-rules:
Expand Down Expand Up @@ -148,3 +151,11 @@ issues:
- path: models/user/openid.go
linters:
- golint
- linters: staticcheck
text: "strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead."
- linters: staticcheck
text: "util.FindClosure is deprecated: This function can not handle newlines. Many elements can be existed over multiple lines(e.g. link labels). Use text.Reader.FindClosure."
- linters: staticcheck
text: "gossh.SigAlgoRSASHA2256 is deprecated: use KeyAlgoRSASHA256."
- linters: staticcheck
text: "gossh.SigAlgoRSASHA2512 is deprecated: use KeyAlgoRSASHA512."
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

###################################
#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image
FROM techknowlogick/go:1.17-alpine3.13 AS build-env
#Build stage
FROM golang:1.18-alpine3.15 AS build-env

ARG GOPROXY
ENV GOPROXY ${GOPROXY:-direct}
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile.rootless
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

###################################
#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image
FROM techknowlogick/go:1.17-alpine3.13 AS build-env
#Build stage
FROM golang:1.18-alpine3.15 AS build-env

ARG GOPROXY
ENV GOPROXY ${GOPROXY:-direct}
Expand Down

0 comments on commit f9ea4ab

Please sign in to comment.