Skip to content

Commit

Permalink
feat: upgrade golang to 1.20.1
Browse files Browse the repository at this point in the history
Signed-off-by: Shengwen Yu <[email protected]>
  • Loading branch information
Shengwen Yu authored and reasonerjt committed Mar 17, 2023
1 parent e76aff6 commit 094e9fc
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 28 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/conformance_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion make/photon/registry/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion make/photon/trivy-adapter/Dockerfile.binary
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
2 changes: 1 addition & 1 deletion make/photon/trivy-adapter/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/goharbor/harbor/src

go 1.19
go 1.20

require (
github.com/FZambia/sentinel v1.1.0
Expand Down
2 changes: 1 addition & 1 deletion src/lib/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

func init() {
rand.Seed(time.Now().UnixNano())
rand.NewSource(time.Now().UnixNano())
}

var (
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/permission/evaluator/rbac/casbin_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/ci/distro_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/ci/ut_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions tests/ci/ut_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 094e9fc

Please sign in to comment.