deploy,devtools: upgrade to go1.20rc3
- Disabled staticcheck while go1.20 is unsupported.
- Fixed out of bounds error in doc html parsing.
- Fixed test issue related to rand package changes.
Change-Id: Ib7b30ed9c40505a5a51d986426f0e41e53a298b1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/464296
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
diff --git a/all.bash b/all.bash
index afb938a..3f4b4fa 100755
--- a/all.bash
+++ b/all.bash
@@ -149,7 +149,8 @@
# check_staticcheck runs staticcheck on source files.
check_staticcheck() {
ensure_go_binary honnef.co/go/tools/cmd/staticcheck
- runcmd staticcheck $(go list ./... | grep -v third_party | grep -v internal/doc | grep -v internal/render)
+# runcmd staticcheck $(go list ./... | grep -v third_party | grep -v internal/doc | grep -v internal/render)
+ echo "disabling staticcheck until go1.20 is supported"
}
# check_misspell runs misspell on source files.
diff --git a/deploy/deploy-env.yaml b/deploy/deploy-env.yaml
index 3b3481b..dea84c2 100644
--- a/deploy/deploy-env.yaml
+++ b/deploy/deploy-env.yaml
@@ -22,7 +22,7 @@
args:
- $PROJECT_ID
- id: Check redistributable
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: private/devtools/check_redist.sh
- id: Build
name: gcr.io/cloud-builders/docker
@@ -48,7 +48,7 @@
- -c
- deploy/frontend.sh $_ENV gcr.io/$PROJECT_ID/frontend:$(cat _BUILD_TAG)
- id: Pagecheck
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: deploy/pagecheck.sh
args:
- $_ENV
diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml
index c942305..8c50a48 100644
--- a/deploy/deploy.yaml
+++ b/deploy/deploy.yaml
@@ -22,7 +22,7 @@
args:
- $PROJECT_ID
- id: Check redistributable
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: private/devtools/check_redist.sh
- id: Build
name: gcr.io/cloud-builders/docker
@@ -48,7 +48,7 @@
- -c
- deploy/frontend.sh staging gcr.io/$PROJECT_ID/frontend:$(cat _BUILD_TAG)
- id: Pagecheck - staging
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: deploy/pagecheck.sh
args:
- staging
@@ -77,7 +77,7 @@
- -c
- deploy/frontend.sh prod gcr.io/$PROJECT_ID/frontend:$(cat _BUILD_TAG)
- id: Pagecheck - prod
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: deploy/pagecheck.sh
args:
- prod
@@ -88,7 +88,7 @@
- -c
- deploy/frontend.sh beta gcr.io/$PROJECT_ID/frontend:$(cat _BUILD_TAG)
- id: Pagecheck - beta
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: deploy/pagecheck.sh
args:
- beta
diff --git a/deploy/migrate.yaml b/deploy/migrate.yaml
index 526fce6..cae0971 100644
--- a/deploy/migrate.yaml
+++ b/deploy/migrate.yaml
@@ -16,7 +16,7 @@
args:
- $PROJECT_ID
- id: Migrate
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: bash
dir: private
args:
diff --git a/deploy/sitemap.yaml b/deploy/sitemap.yaml
index d3e5746..4eb31d8 100644
--- a/deploy/sitemap.yaml
+++ b/deploy/sitemap.yaml
@@ -9,7 +9,7 @@
args:
- $PROJECT_ID
- id: Build
- name: golang:1.19
+ name: golang:1.20rc3
entrypoint: bash
dir: private
args:
diff --git a/devtools/docker/compose.yaml b/devtools/docker/compose.yaml
index 55f234e..727a8e3 100644
--- a/devtools/docker/compose.yaml
+++ b/devtools/docker/compose.yaml
@@ -31,7 +31,7 @@
depends_on:
- db
# This should match the version we are using on Cloud Run.
- image: golang:1.19
+ image: golang:1.20rc3
environment:
<<: *database-variables
<<: *go-variables
@@ -44,7 +44,7 @@
- ../../:/pkgsite
working_dir: /pkgsite
searchtest:
- image: golang:1.19
+ image: golang:1.20rc3
depends_on:
- frontend
environment:
@@ -57,7 +57,7 @@
- ../../:/pkgsite
working_dir: /pkgsite
api:
- image: golang:1.19
+ image: golang:1.20rc3
depends_on:
- frontend
environment:
@@ -70,7 +70,7 @@
working_dir: /pkgsite
frontend:
# This should match the version we are using on AppEngine.
- image: golang:1.19
+ image: golang:1.20rc3
depends_on:
- db
command: bash -c "
@@ -89,7 +89,7 @@
working_dir: /pkgsite
seeddb:
# This should match the version we are using on Cloud Run.
- image: golang:1.19
+ image: golang:1.20rc3
depends_on:
- db
# Note: technically we should check that migrations have completed before
@@ -142,7 +142,7 @@
shm_size: 8G
go:
# This should match the version we are using on Cloud Run.
- image: golang:1.19
+ image: golang:1.20rc3
entrypoint: go
environment:
<<: *database-variables
diff --git a/internal/godoc/dochtml/internal/render/linkify.go b/internal/godoc/dochtml/internal/render/linkify.go
index 5ee5bf5..13e05b3 100644
--- a/internal/godoc/dochtml/internal/render/linkify.go
+++ b/internal/godoc/dochtml/internal/render/linkify.go
@@ -612,7 +612,9 @@
line := file.Line(p) - 1 // current 0-indexed line number
offset := file.Offset(p) // current offset into source file
tokType := codeType // current token type (assume source code)
-
+ if lastOffset > offset {
+ continue
+ }
// Add traversed bytes from src to the appropriate line.
prevLines := strings.SplitAfter(string(src[lastOffset:offset]), "\n")
for i, ln := range prevLines {
diff --git a/internal/middleware/experiment_test.go b/internal/middleware/experiment_test.go
index ae524fc..81687ef 100644
--- a/internal/middleware/experiment_test.go
+++ b/internal/middleware/experiment_test.go
@@ -77,6 +77,8 @@
}
func TestShouldSetExperiment(t *testing.T) {
+ // Force the pre-go1.20 behavior of rand.Seed
+ rand.Seed(1)
ipv4Addr := func() string {
a := make([]string, 4)
for i := 0; i < 4; i++ {