dev-lang/go: Upgrade go to 1.20.8

BUG=b/300127791,b/300126751
TEST=None
RELEASE_NOTE=Upgraded go from 1.19.13 to 1.20.8. This also required
upgrading dev-go/go-tools to 0.3.0. Fixed CVE-2023-39318
and CVE-2023-39319.

cos-patch: security-moderate
Change-Id: I2be5f74136ba880eb98a127653292ed4131bb5af
Reviewed-on: https://cos-review.googlesource.com/c/third_party/overlays/chromiumos-overlay/+/57567
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Oleksandr Tymoshenko <ovt@google.com>
Main-Branch-Verified: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
diff --git a/dev-go/go-tools/Manifest b/dev-go/go-tools/Manifest
index 10ecb3a..994478e 100644
--- a/dev-go/go-tools/Manifest
+++ b/dev-go/go-tools/Manifest
@@ -1 +1 @@
-DIST go.googlesource.com-tools-v0.1.11.tar.gz 3075563 BLAKE2B d7599ece680d56bac2f2a5ac752edd2b3fbd3ee3e44b01cc5c4c65259dd52422327147416557151b06ebc907435de0b1b283aa218d3ee90571e631b96e60fbbd SHA512 d31352a70f16aa81949d31fa1a6247358f0aa5703edb590f46bed29fb9534be586e529913ce9a3c068e6b795263550c59b6bd1f031c71320e736b75d94895b56
+DIST go.googlesource.com-tools-070db2996ebe3aa00667288f8e5749e867deeb39.tar.gz 3374486 BLAKE2B 976da29f7b443571bae065f682f1be017891285e41156b783f4f72ba2dd4946bb47b4f04dd6745714db48a0e73b80a22e2e772a557d1aaad8303963552cf3489 SHA512 237182e5613de76067bba15b7d6c4d4bd148e190cdb50ef17c40ac3a30427072dc27cf9a2f782f4fbb3f5a4dc429cf3838b198f23e5464f006e1c582297100d2
diff --git a/dev-go/go-tools/go-tools-0.1.11-r1.ebuild b/dev-go/go-tools/go-tools-0.1.11-r1.ebuild
deleted file mode 120000
index be87c35..0000000
--- a/dev-go/go-tools/go-tools-0.1.11-r1.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-go-tools-0.1.11.ebuild
\ No newline at end of file
diff --git a/dev-go/go-tools/go-tools-0.1.11.ebuild b/dev-go/go-tools/go-tools-0.1.11.ebuild
deleted file mode 100644
index 3d83ed7..0000000
--- a/dev-go/go-tools/go-tools-0.1.11.ebuild
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
-# Distributed under the terms of the GNU General Public License v2.
-
-EAPI=7
-
-CROS_GO_SOURCE="go.googlesource.com/tools:golang.org/x/tools v${PV}"
-
-CROS_GO_PACKAGES=(
-	"golang.org/x/tools/go/ast/astutil"
-	"golang.org/x/tools/go/buildutil"
-	"golang.org/x/tools/go/gcexportdata"
-	"golang.org/x/tools/go/internal/cgo"
-	"golang.org/x/tools/go/internal/gcimporter"
-	"golang.org/x/tools/go/internal/packagesdriver"
-	"golang.org/x/tools/go/loader"
-	"golang.org/x/tools/go/packages"
-	"golang.org/x/tools/internal/event"
-	"golang.org/x/tools/internal/event/core"
-	"golang.org/x/tools/internal/event/keys"
-	"golang.org/x/tools/internal/event/label"
-	"golang.org/x/tools/internal/fastwalk"
-	"golang.org/x/tools/internal/gocommand"
-	"golang.org/x/tools/internal/gopathwalk"
-	"golang.org/x/tools/internal/packagesinternal"
-	"golang.org/x/tools/internal/typesinternal"
-	"golang.org/x/tools/internal/typeparams"
-	"golang.org/x/tools/imports"
-	"golang.org/x/tools/internal/imports"
-)
-
-CROS_GO_TEST=(
-	"${CROS_GO_PACKAGES[@]}"
-)
-
-CROS_GO_BINARIES=(
-	"golang.org/x/tools/cmd/godoc"
-	"golang.org/x/tools/cmd/goimports"
-	"golang.org/x/tools/cmd/guru:goguru"
-	"golang.org/x/tools/cmd/stringer"
-)
-
-inherit cros-go
-
-DESCRIPTION="Packages and tools that support the Go programming language"
-HOMEPAGE="https://golang.org/x/tools"
-SRC_URI="$(cros-go_src_uri)"
-
-LICENSE="BSD-Google"
-SLOT="0"
-KEYWORDS="*"
-IUSE=""
-RESTRICT="binchecks strip"
-
-DEPEND="
-	dev-go/mod
-	dev-go/net
-	dev-go/sync
-	dev-go/xerrors
-	dev-go/text
-	dev-go/goldmark
-"
-RDEPEND="${DEPEND}"
diff --git a/dev-go/go-tools/go-tools-0.3.0_p20230118-r1.ebuild b/dev-go/go-tools/go-tools-0.3.0_p20230118-r1.ebuild
new file mode 120000
index 0000000..35e0917
--- /dev/null
+++ b/dev-go/go-tools/go-tools-0.3.0_p20230118-r1.ebuild
@@ -0,0 +1 @@
+go-tools-0.3.0_p20230118.ebuild
\ No newline at end of file
diff --git a/dev-go/go-tools/go-tools-0.3.0_p20230118.ebuild b/dev-go/go-tools/go-tools-0.3.0_p20230118.ebuild
new file mode 100644
index 0000000..887e6b7
--- /dev/null
+++ b/dev-go/go-tools/go-tools-0.3.0_p20230118.ebuild
@@ -0,0 +1,83 @@
+# Copyright 2023 The Chromium OS Authors. All rights reserved.
+# Distributed under the terms of the GNU General Public License v2.
+
+EAPI=7
+
+CROS_GO_SOURCE="go.googlesource.com/tools:golang.org/x/tools 070db2996ebe3aa00667288f8e5749e867deeb39"
+
+CROS_GO_PACKAGES=(
+	"golang.org/x/tools/go/analysis"
+	"golang.org/x/tools/go/analysis/analysistest"
+	"golang.org/x/tools/go/analysis/internal/analysisflags"
+	"golang.org/x/tools/go/analysis/internal/checker"
+	"golang.org/x/tools/go/analysis/passes/inspect"
+	"golang.org/x/tools/go/ast/astutil"
+	"golang.org/x/tools/go/ast/inspector"
+	"golang.org/x/tools/go/buildutil"
+	"golang.org/x/tools/go/expect"
+	"golang.org/x/tools/go/gcexportdata"
+	"golang.org/x/tools/go/internal/cgo"
+	"golang.org/x/tools/internal/gcimporter"
+	"golang.org/x/tools/go/internal/packagesdriver"
+	"golang.org/x/tools/go/loader"
+	"golang.org/x/tools/go/packages"
+	"golang.org/x/tools/go/packages/packagestest"
+	"golang.org/x/tools/present"
+	"golang.org/x/tools/go/types/objectpath"
+	"golang.org/x/tools/go/types/typeutil"
+	"golang.org/x/tools/internal/analysisinternal"
+	"golang.org/x/tools/internal/apidiff"
+	"golang.org/x/tools/internal/event"
+	"golang.org/x/tools/internal/event/core"
+	"golang.org/x/tools/internal/event/export"
+	"golang.org/x/tools/internal/event/keys"
+	"golang.org/x/tools/internal/event/label"
+	"golang.org/x/tools/internal/fastwalk"
+	"golang.org/x/tools/internal/gocommand"
+	"golang.org/x/tools/internal/gopathwalk"
+	"golang.org/x/tools/internal/diff/..."
+	"golang.org/x/tools/internal/goroot"
+	"golang.org/x/tools/internal/packagesinternal"
+	"golang.org/x/tools/internal/pkgbits"
+	"golang.org/x/tools/internal/proxydir"
+	"golang.org/x/tools/internal/testenv"
+	"golang.org/x/tools/internal/typesinternal"
+	"golang.org/x/tools/internal/typeparams"
+	"golang.org/x/tools/internal/typeparams/genericfeatures"
+	"golang.org/x/tools/imports"
+	"golang.org/x/tools/internal/imports"
+	"golang.org/x/tools/txtar"
+)
+
+CROS_GO_TEST=(
+	"${CROS_GO_PACKAGES[@]}"
+)
+
+CROS_GO_BINARIES=(
+	"golang.org/x/tools/cmd/godoc"
+	"golang.org/x/tools/cmd/goimports"
+	"golang.org/x/tools/cmd/guru:/usr/bin/goguru"
+	"golang.org/x/tools/cmd/stringer"
+)
+
+inherit cros-go
+
+DESCRIPTION="Packages and tools that support the Go programming language"
+HOMEPAGE="https://golang.org/x/tools"
+SRC_URI="$(cros-go_src_uri)"
+
+LICENSE="BSD-Google"
+SLOT="0"
+KEYWORDS="*"
+IUSE=""
+RESTRICT="binchecks strip"
+
+DEPEND="
+	dev-go/mod
+	dev-go/net
+	dev-go/sync
+	dev-go/xerrors
+	dev-go/text
+	dev-go/goldmark
+"
+RDEPEND="${DEPEND}"
diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
index 576c9e2..32f3c75 100644
--- a/dev-lang/go/Manifest
+++ b/dev-lang/go/Manifest
@@ -1,2 +1,2 @@
-DIST go1.19.13.src.tar.gz 26578128 BLAKE2B 085e26f9cc6f54472c6e7bb710987895def7a1de774c5f02d468ce8d39ec70a79ef9332e75275921df5fbd9b1ee2cc04ea674e43197f0318c7288ffba8c57f3c SHA512 59405e9b8e061ddaf99b0fb60aa3795bb6a8cf8743ca191a82ba9a4fa3c83da300de2519f13d6fe664f95c7e34fd75259a9e1c92471d219590701572ff0f26e6
-DIST go1.4-bootstrap-20170531.tar.gz 11315348 BLAKE2B bdc66bc1aca3f86ca8deaa01f598db955d6de6dd069bc2ae095a4335a9b113079aff93a23310c3bb6ea7e91b0ce0ef45394ce7094d234f7daffc088af4c1b6e0 SHA512 f04b4822aae0953ec2982ab9e8ad02dde588bbf3cf27ad294178f7faa7c3359ee20e77c2c06b293e88d9b680b79c4b5958f1f772f0710637324a3b8c024c1bc3
+DIST go1.17.13-bootstrap-20230206.tar.gz 22206518 BLAKE2B b227e5197c6466e7dc4594646a6b5f7e2f5e8bc0d44b8ab45b488f5249eb64ff736fccf0e0070d6685a08361e1b3dd1a2ee7050df6395bec519a7ae7dca78630 SHA512 2820bdd679fdb5e37d4c601b26c246bab23d4e8e1b226ac37c38e90a68b693e877bff944275eb25e3296ee772e7b40ef7d71dd49cca524df4cb8e721bfb50c33
+DIST go1.20.8.src.tar.gz 26197375 BLAKE2B 1d6c5eb4da9f2f892b30013427b54039feeaf0bc41e1928a82da56e1c96689a796828758989a85a2d156f0547826eb0d408c324a93e02894dbb0a6c7b73b6b67 SHA512 858d0289b3cd709e71e14aed9a36fd3d462fb3aa72cc1108eef0c70ab583742ab2eff99a24f8bfd72d42d1cc741adc1d3619073fbed943f8aea20e453ed479d3
diff --git a/dev-lang/go/files/0001-Preserve-go-1.17-behavior-while-updating-to-go-1.19.patch b/dev-lang/go/files/0001-Preserve-go-1.17-behavior-while-updating-to-go-1.19.patch
deleted file mode 100644
index 05da67d..0000000
--- a/dev-lang/go/files/0001-Preserve-go-1.17-behavior-while-updating-to-go-1.19.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 5f72c49ce8f90efbd8a5f2b773c97f60d06e11b1 Mon Sep 17 00:00:00 2001
-From: Vaibhav Rustagi <vaibhavrustagi@google.com>
-Date: Fri, 13 Jan 2023 08:07:32 -0800
-Subject: [PATCH] Preserve go-1.17 behavior while updating to go-1.19.
-
-Golang introduced couple of breaking changes when updating from go-1.17
-to go-1.19. This CL is preserving those behavior if not overridden by
-the user or the package source.
----
- src/internal/godebug/godebug.go | 23 +++++++++++++++++++++--
- 1 file changed, 21 insertions(+), 2 deletions(-)
-
-diff --git a/src/internal/godebug/godebug.go b/src/internal/godebug/godebug.go
-index ac434e5fd8..cc27bdc075 100644
---- a/src/internal/godebug/godebug.go
-+++ b/src/internal/godebug/godebug.go
-@@ -5,11 +5,30 @@
- // Package godebug parses the GODEBUG environment variable.
- package godebug
- 
--import "os"
-+import (
-+	"os"
-+	"strings"
-+)
- 
- // Get returns the value for the provided GODEBUG key.
- func Get(key string) string {
--	return get(os.Getenv("GODEBUG"), key)
-+	// lakitu patch to preserve go-1.17 behavior
-+	// while updating to go-1.19.
-+	godebug := os.Getenv("GODEBUG")
-+	switch key {
-+	case "x509sha1":
-+		if !strings.Contains(godebug, "x509sha1") {
-+			return "1"
-+		}
-+		return get(godebug, key)
-+	case "execerrdot":
-+		if !strings.Contains(godebug, "execerrdot") {
-+			return "0"
-+		}
-+		fallthrough
-+	default:
-+		return get(godebug, key)
-+	}
- }
- 
- // get returns the value part of key=value in s (a GODEBUG value).
--- 
-2.39.0.314.g84b9a713c41-goog
-
diff --git a/dev-lang/go/go-1.19.13-r1.ebuild b/dev-lang/go/go-1.19.13-r1.ebuild
deleted file mode 120000
index dc27eb5..0000000
--- a/dev-lang/go/go-1.19.13-r1.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-go-1.19.13.ebuild
\ No newline at end of file
diff --git a/dev-lang/go/go-1.20.8-r1.ebuild b/dev-lang/go/go-1.20.8-r1.ebuild
new file mode 120000
index 0000000..ba09da1
--- /dev/null
+++ b/dev-lang/go/go-1.20.8-r1.ebuild
@@ -0,0 +1 @@
+go-1.20.8.ebuild
\ No newline at end of file
diff --git a/dev-lang/go/go-1.19.13.ebuild b/dev-lang/go/go-1.20.8.ebuild
similarity index 90%
rename from dev-lang/go/go-1.19.13.ebuild
rename to dev-lang/go/go-1.20.8.ebuild
index 34cf648..eb44d31 100644
--- a/dev-lang/go/go-1.19.13.ebuild
+++ b/dev-lang/go/go-1.20.8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2022 The ChromiumOS Authors
+# Copyright 2023 The ChromiumOS Authors
 # Distributed under the terms of the GNU General Public License v2.
 
 EAPI=7
@@ -6,7 +6,7 @@
 inherit eutils toolchain-funcs
 
 # Version used to bootstrap the build.
-BOOTSTRAP="go1.4-bootstrap-20170531"
+BOOTSTRAP="go1.17.13-bootstrap-20230206"
 
 DESCRIPTION="An expressive, concurrent, garbage-collected programming language"
 HOMEPAGE="http://golang.org/"
@@ -65,11 +65,6 @@
 	export GOROOT_FINAL="${EPREFIX}$(get_goroot)"
 }
 
-src_prepare() {
-	eapply "${FILESDIR}/0001-Preserve-go-1.17-behavior-while-updating-to-go-1.19.patch"
-	default
-}
-
 src_compile() {
 	einfo "Building the bootstrap compiler."
 	cd "${GOROOT_BOOTSTRAP}/src" || die
@@ -110,10 +105,6 @@
 
 	insinto "${goroot}/pkg"
 	doins -r "pkg/include"
-	doins -r "pkg/linux_$(get_goarch "${CTARGET}")"
-	if is_cross ; then
-		doins -r "pkg/linux_$(get_goarch "${CTARGET}")_shared"
-	fi
 
 	exeinto "${goroot}/${tooldir}"
 	doexe "${tooldir}/"{asm,cgo,compile,link,pack}