From bd7d6a3d736a3d9781ef3b243a8e18e93f632955 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Thu, 13 Aug 2020 10:11:24 -0400 Subject: [PATCH] go1.15 (#12475) * go1.15 * update makefile xgo version * fix vet issue * update docs to version of go in use * add TODO for asyncpreemptoff Co-authored-by: Lauris BH --- .drone.yml | 28 ++++++++++++++-------------- Dockerfile | 2 +- Makefile | 2 +- docs/config.yaml | 2 +- modules/git/command.go | 1 + modules/public/public.go | 3 ++- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.drone.yml b/.drone.yml index 75884cbba..2738edaf5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,7 @@ steps: - name: lint-backend pull: always - image: golang:1.14 + image: golang:1.15 commands: - make lint-backend environment: @@ -53,7 +53,7 @@ steps: - name: build-backend-arm64 pull: always - image: golang:1.14 + image: golang:1.15 environment: GO111MODULE: on GOPROXY: off @@ -67,7 +67,7 @@ steps: - name: build-backend-386 pull: always - image: golang:1.14 + image: golang:1.15 environment: GO111MODULE: on GOPROXY: off @@ -150,7 +150,7 @@ steps: - name: build pull: always - image: golang:1.14 + image: golang:1.15 commands: - make backend environment: @@ -166,7 +166,7 @@ steps: - name: unit-test pull: always - image: golang:1.14 + image: golang:1.15 commands: - make unit-test-coverage test-check environment: @@ -177,7 +177,7 @@ steps: - name: test-mysql pull: always - image: golang:1.14 + image: golang:1.15 commands: - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash" - apt-get install -y git-lfs @@ -192,7 +192,7 @@ steps: - name: test-mysql8 pull: always - image: golang:1.14 + image: golang:1.15 commands: - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash" - apt-get install -y git-lfs @@ -207,7 +207,7 @@ steps: - name: test-mssql pull: always - image: golang:1.14 + image: golang:1.15 commands: - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash" - apt-get install -y git-lfs @@ -222,7 +222,7 @@ steps: - name: generate-coverage pull: always - image: golang:1.14 + image: golang:1.15 commands: - make coverage environment: @@ -295,7 +295,7 @@ steps: - name: build pull: always - image: golang:1.14 + image: golang:1.15 commands: - make backend environment: @@ -305,7 +305,7 @@ steps: - name: test-sqlite pull: always - image: golang:1.14 + image: golang:1.15 commands: - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash" - apt-get install -y git-lfs @@ -319,7 +319,7 @@ steps: - name: test-pgsql pull: always - image: golang:1.14 + image: golang:1.15 commands: - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash" - apt-get install -y git-lfs @@ -427,7 +427,7 @@ steps: - name: static pull: always - image: techknowlogick/xgo:go-1.14.x + image: techknowlogick/xgo:go-1.15.x commands: - apt update && apt -y install curl - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs @@ -525,7 +525,7 @@ steps: - name: static pull: always - image: techknowlogick/xgo:go-1.14.x + image: techknowlogick/xgo:go-1.15.x commands: - apt update && apt -y install curl - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs diff --git a/Dockerfile b/Dockerfile index a04324c94..9c678a60a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ################################### #Build stage -FROM golang:1.14-alpine3.12 AS build-env +FROM golang:1.15-alpine3.12 AS build-env ARG GOPROXY ENV GOPROXY ${GOPROXY:-direct} diff --git a/Makefile b/Makefile index 890332fde..49df89622 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ SHASUM ?= shasum -a 256 HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" ) COMMA := , -XGO_VERSION := go-1.14.x +XGO_VERSION := go-1.15.x MIN_GO_VERSION := 001012000 MIN_NODE_VERSION := 010013000 diff --git a/docs/config.yaml b/docs/config.yaml index 8b7560a59..3935d04dd 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -20,7 +20,7 @@ params: website: https://docs.gitea.io version: 1.12.2 minGoVersion: 1.12 - goVersion: 1.14 + goVersion: 1.15 minNodeVersion: 10.13 outputs: diff --git a/modules/git/command.go b/modules/git/command.go index 14fab4ef3..1496b0186 100644 --- a/modules/git/command.go +++ b/modules/git/command.go @@ -129,6 +129,7 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time. cmd.Env = append(cmd.Env, fmt.Sprintf("LC_ALL=%s", DefaultLocale)) } + // TODO: verify if this is still needed in golang 1.15 cmd.Env = append(cmd.Env, "GODEBUG=asyncpreemptoff=1") cmd.Dir = dir cmd.Stdout = stdout diff --git a/modules/public/public.go b/modules/public/public.go index 9532c9b36..008fba9b0 100644 --- a/modules/public/public.go +++ b/modules/public/public.go @@ -6,6 +6,7 @@ package public import ( "encoding/base64" + "fmt" "log" "net/http" "path" @@ -158,7 +159,7 @@ func (opts *Options) handle(ctx *macaron.Context, log *log.Logger, opt *Options) // Add an Expires header to the static content if opt.ExpiresAfter > 0 { ctx.Resp.Header().Set("Expires", time.Now().Add(opt.ExpiresAfter).UTC().Format(http.TimeFormat)) - tag := GenerateETag(string(fi.Size()), fi.Name(), fi.ModTime().UTC().Format(http.TimeFormat)) + tag := GenerateETag(fmt.Sprintf("%d", fi.Size()), fi.Name(), fi.ModTime().UTC().Format(http.TimeFormat)) ctx.Resp.Header().Set("ETag", tag) if ctx.Req.Header.Get("If-None-Match") == tag { ctx.Resp.WriteHeader(304)