feat: upgrade golang to 1.20.1 (#18370)

Signed-off-by: Shengwen Yu <yshengwen@vmware.com>
Co-authored-by: Shengwen Yu <yshengwen@vmware.com>
Co-authored-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
Daniel Jiang 2023-03-17 17:49:44 +08:00 committed by GitHub
parent 6774717185
commit bea8dece07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 27 additions and 28 deletions

View File

@ -33,10 +33,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.19.4
go-version: 1.20.1
id: go
- uses: actions/checkout@v3
with:
@ -94,10 +94,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.19.4
go-version: 1.20.1
id: go
- uses: actions/checkout@v3
with:
@ -149,10 +149,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.19.4
go-version: 1.20.1
id: go
- uses: actions/checkout@v3
with:
@ -204,10 +204,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.19.4
go-version: 1.20.1
id: go
- uses: actions/checkout@v3
with:
@ -257,10 +257,10 @@ jobs:
- ubuntu-latest
timeout-minutes: 100
steps:
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.19.4
go-version: 1.20.1
id: go
- uses: actions/checkout@v3
with:

View File

@ -23,10 +23,10 @@ jobs:
with:
version: '285.0.0'
- run: gcloud info
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.19.4
go-version: 1.20.1
id: go
- name: Setup Docker
uses: docker-practice/actions-setup-docker@1.0.11

View File

@ -25,10 +25,10 @@ jobs:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- uses: google-github-actions/setup-gcloud@v0
- run: gcloud info
- name: Set up Go 1.19
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.19.4
go-version: 1.20.1
id: go
- uses: actions/checkout@v3
with:

View File

@ -145,14 +145,14 @@ GOINSTALL=$(GOCMD) install
GOTEST=$(GOCMD) test
GODEP=$(GOTEST) -i
GOFMT=gofmt -w
GOBUILDIMAGE=golang:1.19.4
GOBUILDIMAGE=golang:1.20.1
GOBUILDPATHINCONTAINER=/harbor
# go build
PKG_PATH=github.com/goharbor/harbor/src/pkg
GITCOMMIT := $(shell git rev-parse --short=8 HEAD)
RELEASEVERSION := $(shell cat VERSION)
GOFLAGS=
GOFLAGS="-buildvcs=false"
GOTAGS=$(if $(GOBUILDTAGS),-tags "$(GOBUILDTAGS)",)
GOLDFLAGS=$(if $(GOBUILDLDFLAGS),--ldflags "-w -s $(GOBUILDLDFLAGS)",)
CORE_LDFLAGS=-X $(PKG_PATH)/version.GitCommit=$(GITCOMMIT) -X $(PKG_PATH)/version.ReleaseVersion=$(RELEASEVERSION)
@ -498,7 +498,7 @@ misspell:
@find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs misspell -error
# golangci-lint binary installation or refer to https://golangci-lint.run/usage/install/#local-installation
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2
GOLANGCI_LINT := $(shell go env GOPATH)/bin/golangci-lint
lint:
@echo checking lint

View File

@ -1,4 +1,4 @@
FROM golang:1.19.4
FROM golang:1.20.1
ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution
ENV BUILDTAGS include_oss include_gcs

View File

@ -1,4 +1,4 @@
FROM golang:1.19.4
FROM golang:1.20.1
ADD . /go/src/github.com/aquasecurity/harbor-scanner-trivy/
WORKDIR /go/src/github.com/aquasecurity/harbor-scanner-trivy/

View File

@ -19,7 +19,7 @@ TEMP=$(mktemp -d ${TMPDIR-/tmp}/trivy-adapter.XXXXXX)
git clone https://github.com/aquasecurity/harbor-scanner-trivy.git $TEMP
cd $TEMP; git checkout $VERSION; cd -
echo "Building Trivy adapter binary based on golang:1.19.4..."
echo "Building Trivy adapter binary based on golang:1.20.1..."
cp Dockerfile.binary $TEMP
docker build -f $TEMP/Dockerfile.binary -t trivy-adapter-golang $TEMP

View File

@ -1,6 +1,6 @@
module github.com/goharbor/harbor/src
go 1.19
go 1.20
require (
github.com/FZambia/sentinel v1.1.0

View File

@ -25,7 +25,7 @@ import (
)
func init() {
rand.Seed(time.Now().UnixNano())
rand.NewSource(time.Now().UnixNano())
}
var (

View File

@ -60,7 +60,7 @@ func init() {
func startRegexpStorePurging(s *regexpStore, intervalDuration time.Duration) {
go func() {
rand.Seed(time.Now().Unix())
rand.NewSource(time.Now().UnixNano())
jitter := time.Duration(rand.Int()%60) * time.Minute
log.Debugf("Starting regexp store purge in %s", jitter)
time.Sleep(jitter)

View File

@ -3,5 +3,5 @@ set -x
set -e
sudo make package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.19.4 COMPILETAG=compile_golangimage NOTARYFLAG=true TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false
sudo make package_offline GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.19.4 COMPILETAG=compile_golangimage NOTARYFLAG=true TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false
sudo make package_online GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.20.1 COMPILETAG=compile_golangimage NOTARYFLAG=true TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false
sudo make package_offline GOBUILDTAGS="include_oss include_gcs" VERSIONTAG=dev-gitaction PKGVERSIONTAG=dev-gitaction UIVERSIONTAG=dev-gitaction GOBUILDIMAGE=golang:1.20.1 COMPILETAG=compile_golangimage NOTARYFLAG=true TRIVYFLAG=true HTTPPROXY= PULL_BASE_FROM_DOCKERHUB=false

View File

@ -18,7 +18,7 @@ go get -u github.com/client9/misspell/cmd/misspell
set -e
# binary will be $(go env GOPATH)/bin/golangci-lint
# go install/go get installation aren't guaranteed to work. We recommend using binary installation.
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2
sudo service postgresql stop || echo no postgresql need to be stopped
sleep 2

View File

@ -16,6 +16,5 @@ sleep 10
docker ps
DIR="$(cd "$(dirname "$0")" && pwd)"
go test -race -i ./src/core ./src/jobservice
sudo -E env "PATH=$PATH" "POSTGRES_MIGRATION_SCRIPTS_PATH=$DIR/../../make/migrations/postgresql/" ./tests/coverage4gotest.sh
#goveralls -coverprofile=profile.cov -service=github || true
#goveralls -coverprofile=profile.cov -service=github || true