git: 3012ca2179ce - main - */*: Introduce versioned Go ports

From: Dmitri Goutnik <dmgk_at_FreeBSD.org>
Date: Mon, 06 Jun 2022 18:22:32 UTC
The branch main has been updated by dmgk:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3012ca2179ceb0e389fbeb30a66f9fe60a3cf5a1

commit 3012ca2179ceb0e389fbeb30a66f9fe60a3cf5a1
Author:     Dmitri Goutnik <dmgk@FreeBSD.org>
AuthorDate: 2022-05-29 21:45:43 +0000
Commit:     Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2022-06-06 18:19:10 +0000

    */*: Introduce versioned Go ports
    
    - Mk/Uses/go.mk: add support for selecting Go port version in USES=go;
    - Mk/bsd.default-versions.mk: add GO_DEFAULT;
    - convert lang/go-devel to the master and lang/go{117,118} to slave
      ports;
    - add lang/go meta-port that provides go and gofmt symlinks to the
      current default version.
    
    PR:             264336
    Reviewed by:    ygy jwb yuri mikael drtr0jan@yandex.ru decke mat
    Differential Revision:  https://reviews.freebsd.org/D35346
---
 Mk/Scripts/qa.sh                                   |   3 +
 Mk/Uses/go.mk                                      |  35 +++---
 Mk/bsd.default-versions.mk                         |   2 +
 lang/Makefile                                      |   1 +
 lang/go-devel/Makefile                             | 131 ++++++++++++++++++---
 lang/go-devel/pkg-descr                            |   4 +
 lang/go/Makefile                                   | 126 ++------------------
 lang/go/pkg-descr                                  |   3 +
 lang/go117/Makefile                                |  28 ++---
 lang/go117/distinfo                                |   6 +-
 lang/go118/Makefile                                |  22 ++++
 lang/{go => go118}/distinfo                        |   2 +-
 .../patch-src_cmd_go_internal_modload_vendor.go    |   0
 13 files changed, 199 insertions(+), 164 deletions(-)

diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh
index 104d4d48006f..20d1e296dd5c 100644
--- a/Mk/Scripts/qa.sh
+++ b/Mk/Scripts/qa.sh
@@ -978,6 +978,9 @@ depends_blacklist()
 			lang/gcc)
 				instead="USE_GCC"
 				;;
+			lang/go)
+				instead="USES=go"
+				;;
 			lang/julia)
 				instead="a dependency on lang/julia\${JULIA_DEFAULT:S/.//}"
 				;;
diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
index 39585e0c9946..c18b8fcc4000 100644
--- a/Mk/Uses/go.mk
+++ b/Mk/Uses/go.mk
@@ -3,9 +3,10 @@
 #
 # Feature:	go
 # Usage:	USES=go
-# Valid ARGS:	(none), modules, no_targets, run
+# Valid ARGS:	(none), N.NN, N.NN-devel, modules, no_targets, run
 #
-# (none)	Setup GOPATH and build in GOPATH mode.
+# (none)	Setup GOPATH and build in GOPATH mode using default Go version.
+# N.NN[-devel]	Specify Go version
 # modules	If the upstream uses Go modules, this can be set to build
 #		in modules-aware mode.
 # no_targets	Indicates that Go is needed at build time as a part of
@@ -52,24 +53,29 @@
 # GO_TESTFLAGS
 #	Additional build arguments to be passed to the `go test` command
 #
-# GO_PORT
-#	The Go port to use.  By default this is lang/go but can be set
-#	to lang/go-devel in make.conf for testing with future Go versions.
-#
-#	This variable must not be set by individual ports!
-#
 # MAINTAINER: ports@FreeBSD.org
 
 .if !defined(_INCLUDE_USES_GO_MK)
 _INCLUDE_USES_GO_MK=	yes
 
-.  if !empty(go_ARGS:Nmodules:Nno_targets:Nrun)
-IGNORE=	USES=go has invalid arguments: ${go_ARGS:Nmodules:Nno_targets:Nrun}
+# When adding a version, please keep the comment in
+# Mk/bsd.default-versions.mk in sync.
+GO_VALID_VERSIONS=	1.17 1.18 1.19-devel
+
+# Check arguments sanity
+.  if !empty(go_ARGS:N[1-9].[0-9][0-9]:N*-devel:Nmodules:Nno_targets:Nrun)
+IGNORE=	USES=go has invalid arguments: ${go_ARGS:N[1-9].[0-9][0-9]:N*-devel:Nmodules:Nno_targets:Nrun}
 .  endif
 
-# Settable variables
+# Parse Go version
+GO_VERSION=	${go_ARGS:Nmodules:Nno_targets:Nrun:C/^$/${GO_DEFAULT}/}
+.  if empty(GO_VALID_VERSIONS:M${GO_VERSION})
+IGNORE?= USES=go has invalid version number: ${GO_VERSION}
+.  endif
+GO_SUFFIX=	${GO_VERSION:S/.//:C/.*-devel/-devel/}
+GO_PORT=	lang/go${GO_SUFFIX}
 
-GO_PORT?=	lang/go
+# Settable variables
 
 .  if empty(GO_PKGNAME)
 .    if !empty(GH_SUBDIR)
@@ -89,7 +95,7 @@ GO_BUILDFLAGS+=	-v -buildmode=exe -trimpath
 GO_BUILDFLAGS+=	-ldflags=-s
 .  endif
 GO_TESTFLAGS+=	-v
-.  if ${GO_PORT} != lang/go117
+.  if ${GO_VERSION} != 1.17
 GO_BUILDFLAGS+=	-buildvcs=false
 GO_TESTFLAGS+=	-buildvcs=false
 .  endif
@@ -107,7 +113,7 @@ GO_GOSUMDB?=	sum.golang.org
 
 # Read-only variables
 
-GO_CMD=		${LOCALBASE}/bin/go
+GO_CMD=		${LOCALBASE}/bin/go${GO_SUFFIX}
 GO_WRKDIR_BIN=	${WRKDIR}/bin
 GO_ENV+=	CGO_ENABLED=${CGO_ENABLED} \
 		CGO_CFLAGS="${CGO_CFLAGS}" \
@@ -154,6 +160,7 @@ GO_ENV+=	GOPATH="${GO_GOPATH}" \
 .  endif
 
 BUILD_DEPENDS+=	${GO_CMD}:${GO_PORT}
+BINARY_ALIAS+=	go=go${GO_SUFFIX} gofmt=gofmt${GO_SUFFIX}
 .  if ${go_ARGS:Mrun}
 RUN_DEPENDS+=	${GO_CMD}:${GO_PORT}
 .  endif
diff --git a/Mk/bsd.default-versions.mk b/Mk/bsd.default-versions.mk
index 974442a6a356..660b85418d3e 100644
--- a/Mk/bsd.default-versions.mk
+++ b/Mk/bsd.default-versions.mk
@@ -56,6 +56,8 @@ GCC_DEFAULT?=		10
 GL_DEFAULT?=		mesa-libs
 # Possible values: 7, 8, 9, agpl
 GHOSTSCRIPT_DEFAULT?=	agpl
+# Possible values: 1.17, 1.18, 1.19-devel
+GO_DEFAULT?=		1.18
 # Possible values: 6, 6-nox11, 7, 7-nox11
 IMAGEMAGICK_DEFAULT?=	7
 # Possible values: 7, 8, 11, 17, 18
diff --git a/lang/Makefile b/lang/Makefile
index 5b6f13b15ffe..7563ad7a7cd6 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -115,6 +115,7 @@
     SUBDIR += go
     SUBDIR += go-devel
     SUBDIR += go117
+    SUBDIR += go118
     SUBDIR += gomacro
     SUBDIR += gprolog
     SUBDIR += gravity
diff --git a/lang/go-devel/Makefile b/lang/go-devel/Makefile
index f310c8e597cc..28116dcebbb3 100644
--- a/lang/go-devel/Makefile
+++ b/lang/go-devel/Makefile
@@ -1,30 +1,129 @@
 # Created by: Devon H. O'Dell <devon.odell@gmail.com>
 
-PORTVERSION=	g20220319
-# Always set PORTREVISION and PORTEPOCH explicitly as otherwise they are inherited from lang/go
-PORTREVISION=	0
-PORTEPOCH=	0
-MASTER_SITES=	https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
+PORTNAME=	go
+DISTVERSION?=	g20220319
+PORTREVISION?=	0
+CATEGORIES=	lang
+MASTER_SITES?=	https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
 		LOCAL/dmgk:bootstrap
-PKGNAMESUFFIX=	-devel
-DISTFILES=	go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-${BOOTSTRAP_TAG}.tar.xz:bootstrap
+PKGNAMESUFFIX=	${DISTVERSION:C/^g[0-9]+/-devel/:C/^([0-9]+)\.([0-9]+).*/\1\2/}
+DISTFILES?=	go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-${BOOTSTRAP_TAG}.tar.xz:bootstrap
 
-# Avoid conflicting patch files
-PATCHFILES=
+MAINTAINER=	ygy@FreeBSD.org
+COMMENT?=	Go programming language (development version)
 
-COMMENT=	Go programming language (development version)
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
 
+.ifdef QEMU_EMULATING
+IGNORE=		fails to build with qemu-user-static
+.endif
+
+ONLY_FOR_ARCHS=	aarch64 amd64 armv6 armv7 i386
+
+RUN_DEPENDS=	${RUN_DEPENDS_${ARCH}}
+# ld.bfd from devel/binutils is needed for working cgo on aarch64
+RUN_DEPENDS_aarch64=	binutils>0:devel/binutils
+
+TEST_DEPENDS=	${TEST_DEPENDS_${ARCH}}
+# ld.bfd from devel/binutils is needed for working cgo on aarch64
+TEST_DEPENDS_aarch64=	binutils>0:devel/binutils
+
+USES=		cpe shebangfix
+
+CPE_VENDOR=	golang
+
+.ifndef MASTERDIR
 USE_GITHUB=	yes
 GH_ACCOUNT=	golang
 GH_TAGNAME=	4aa1efed4853ea067d665a952eee77c52faac774
+.endif
+
+SHEBANG_FILES=	misc/wasm/go_js_wasm_exec \
+		src/net/http/cgi/testdata/test.cgi
+SHEBANG_GLOB=	*.bash *.pl *.sh
+
+# Upstream archive contains files with UTF-8 names
+EXTRACT_CMD=	${SETENV} LC_ALL=en_US.UTF-8 ${TAR}
 
-CONFLICTS_INSTALL=	go
+.ifndef GH_TAGNAME
+.endif
 
-MASTERDIR=	${.CURDIR}/../go
-PATCHDIR=	${.CURDIR}/files
-DISTINFO_FILE=	${.CURDIR}/distinfo
+OPTIONS_DEFINE_i386=	SOFTFLOAT
+SOFTFLOAT_DESC=	Use soft float on non-SSE2 processors (Pentium 4 and older)
+SOFTFLOAT_VARS=	GO386=softfloat
+
+BOOTSTRAP_TAG=	go1.17.9
+GO_SUFFIX=	${PKGNAMESUFFIX}
+
+GOARCH_aarch64=	arm64
+GOARCH_amd64=	amd64
+GOARCH_armv6=	arm
+GOARCH_armv7=	arm
+GOARCH_i386=	386
+GOARM_armv6=	6
+GOARM_armv7=	7
 
 post-extract:
-	@[ -f ${WRKSRC}/VERSION ] || ${ECHO_CMD} "devel +${GH_TAGNAME}" > ${WRKSRC}/VERSION
+	@[ -z "${GH_TAGNAME}" ] || \
+		${ECHO_CMD} "devel ${DISTVERSION}-${GH_TAGNAME} ${OPSYS:tl}/${GOARCH_${ARCH}}" > ${WRKSRC}/VERSION
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|type -ap |type |' ${WRKSRC}/src/make.bash
+	@${REINPLACE_CMD} -e 's|^if ulimit -T|false \&\& &|' ${WRKSRC}/src/run.bash
+
+pre-build:
+	# Check that the running kernel has COMPAT_FREEBSD11 required by lang/go{,-devel} post-ino64
+	@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
+		${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
+
+do-build:
+	cd ${WRKSRC}/src ; ${SETENV} \
+		XDG_CACHE_HOME=${WRKDIR} \
+		GOROOT_BOOTSTRAP=${WRKDIR}/go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-bootstrap \
+		GOROOT=${WRKSRC} \
+		GOROOT_FINAL=${PREFIX}/go${GO_SUFFIX} \
+		GOBIN= \
+		GOOS=${OPSYS:tl} \
+		GOARCH=${GOARCH_${ARCH}} \
+		GO386=${GO386} \
+		GOARM=${GOARM_${ARCH}} \
+		CC=${CC} \
+		${SH} make.bash -v
+
+do-install:
+	@cd ${WRKSRC} ; \
+		${RM} -r .gitattributes .gitignore .github favicon.ico robots.txt \
+		pkg/obj pkg/bootstrap pkg/${OPSYS:tl}_${GOARCH_${ARCH}}/cmd
+	@${MKDIR} ${STAGEDIR}${PREFIX}/go${GO_SUFFIX}
+	@${CP} -a ${WRKSRC}/* ${STAGEDIR}${PREFIX}/go${GO_SUFFIX}
+.for f in go gofmt
+	${LN} -sf ../go${GO_SUFFIX}/bin/${f} ${STAGEDIR}${PREFIX}/bin/${f}${GO_SUFFIX}
+	@${ECHO_CMD} bin/${f}${GO_SUFFIX} >> ${TMPPLIST}
+.endfor
+	@cd ${STAGEDIR}${PREFIX} && ${FIND} go${GO_SUFFIX} -type f >> ${TMPPLIST}
+
+do-test:
+	cd ${WRKSRC}/src && ${SETENV} \
+		GOROOT=${WRKSRC} \
+		PATH=${WRKSRC}/bin:${PATH} \
+		GOOS=${OPSYS:tl} \
+		GOARCH=${GOARCH_${ARCH}} \
+		GO386=${GO386} \
+		GOARM=${GOARM_${ARCH}} \
+		CC=${CC} \
+		${SH} run.bash -no-rebuild
+
+.if !defined(_GO_MAKESUM_GUARD)
+makesum:
+	${MAKE} -D_GO_MAKESUM_GUARD makesum ARCH=${ONLY_FOR_ARCHS:O:[1]} DISTINFO_FILE=${DISTINFO_FILE}.tmp
+.for arch in ${ONLY_FOR_ARCHS:O:[2..-1]}
+	${MAKE} -D_GO_MAKESUM_GUARD makesum ARCH=${arch} DISTINFO_FILE=${DISTINFO_FILE}.${arch}
+	${SED} 1d ${DISTINFO_FILE}.${arch} >> ${DISTINFO_FILE}.tmp
+	${RM} ${DISTINFO_FILE}.${arch}
+.endfor
+	${AWK} '!seen[$$0]++' ${DISTINFO_FILE}.tmp > ${DISTINFO_FILE}
+	${RM} ${DISTINFO_FILE}.tmp
+.endif
 
-.include "${MASTERDIR}/Makefile"
+.include <bsd.port.mk>
diff --git a/lang/go-devel/pkg-descr b/lang/go-devel/pkg-descr
new file mode 100644
index 000000000000..fbb088ea81a7
--- /dev/null
+++ b/lang/go-devel/pkg-descr
@@ -0,0 +1,4 @@
+Go is an open source programming environment that makes it easy to build
+simple, reliable, and efficient software.
+
+WWW: https://golang.org
diff --git a/lang/go/Makefile b/lang/go/Makefile
index a507e20f9a2a..d41b2832c22b 100644
--- a/lang/go/Makefile
+++ b/lang/go/Makefile
@@ -1,125 +1,25 @@
-# Created by: Devon H. O'Dell <devon.odell@gmail.com>
-
 PORTNAME=	go
-PORTVERSION?=	1.18.2
-PORTREVISION?=	0
-PORTEPOCH?=	1
+DISTVERSION=	${GO_DEFAULT}
+PORTEPOCH=	2
 CATEGORIES=	lang
-MASTER_SITES?=	https://golang.org/dl/ \
-		https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
-		LOCAL/dmgk:bootstrap
-DISTFILES?=	go${PORTVERSION}.src.tar.gz \
-		go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-${BOOTSTRAP_TAG}.tar.xz:bootstrap
-
-MAINTAINER=	ygy@FreeBSD.org
-COMMENT?=	Go programming language
-
-LICENSE=	BSD3CLAUSE
-LICENSE_FILE=	${WRKSRC}/LICENSE
-
-.ifdef QEMU_EMULATING
-IGNORE=		fails to build with qemu-user-static
-.endif
-
-ONLY_FOR_ARCHS=	aarch64 amd64 armv6 armv7 i386
-
-RUN_DEPENDS=	${RUN_DEPENDS_${ARCH}}
-# ld.bfd from devel/binutils is needed for working cgo on aarch64
-RUN_DEPENDS_aarch64=	binutils>0:devel/binutils
-
-TEST_DEPENDS=	${TEST_DEPENDS_${ARCH}}
-TEST_DEPENDS_aarch64=	binutils>0:devel/binutils
-
-USES=		cpe shebangfix
-
-CPE_VENDOR=	golang
-
-SHEBANG_FILES=	misc/wasm/go_js_wasm_exec \
-		src/net/http/cgi/testdata/test.cgi
-SHEBANG_GLOB=	*.bash *.pl *.sh
+MASTER_SITES=	# not applicable
+DISTFILES=	# not applicable
 
-CONFLICTS_INSTALL?=	go-devel
+MAINTAINER=	dmgk@FreeBSD.org
+COMMENT=	Meta-port for the default version of the Go programming language
 
-# Upstream archive contains files with UTF-8 names
-EXTRACT_CMD=	${SETENV} LC_ALL=en_US.UTF-8 ${TAR}
+RUN_DEPENDS=	go${GO_SUFFIX}:lang/go${GO_SUFFIX}
 
-.ifndef MASTERDIR
-WRKSRC=		${WRKDIR}/go
-.endif
+NO_ARCH=	yes
+NO_BUILD=	yes
 
-OPTIONS_DEFINE_i386=	SOFTFLOAT
+PLIST_FILES=	bin/go bin/gofmt
 
-SOFTFLOAT_DESC=	Use soft float on non-SSE2 processors (Pentium 4 and older)
-
-SOFTFLOAT_VARS=	GO386=softfloat
-
-BINARIES=	go gofmt
-BOOTSTRAP_TAG=	go1.17.9
-
-GOARCH_aarch64=	arm64
-GOARCH_amd64=	amd64
-GOARCH_armv6=	arm
-GOARCH_armv7=	arm
-GOARCH_i386=	386
-
-GOARM_armv6=	6
-GOARM_armv7=	7
-
-post-patch:
-	@${REINPLACE_CMD} -e 's|^if ulimit -T|false \&\& &|' ${WRKSRC}/src/run.bash
-
-pre-build:
-	# Check that the running kernel has COMPAT_FREEBSD11 required by lang/go{,-devel} post-ino64
-	@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
-		${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
-
-do-build:
-	cd ${WRKSRC}/src ; ${SETENV} \
-		XDG_CACHE_HOME=${WRKDIR} \
-		GOROOT_BOOTSTRAP=${WRKDIR}/go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-bootstrap \
-		GOROOT=${WRKSRC} \
-		GOROOT_FINAL=${PREFIX}/go \
-		GOBIN= \
-		GOOS=${OPSYS:tl} \
-		GOARCH=${GOARCH_${ARCH}} \
-		GO386=${GO386} \
-		GOARM=${GOARM_${ARCH}} \
-		CC=${CC} \
-		${SH} make.bash -v
+GO_SUFFIX=	${GO_DEFAULT:S/.//:C/.*-devel/-devel/}
 
 do-install:
-	@cd ${WRKSRC} ; \
-		${RM} -r .gitattributes .gitignore .github favicon.ico robots.txt \
-		pkg/obj pkg/bootstrap pkg/${OPSYS:tl}_${GOARCH_${ARCH}}/cmd
-	@${MKDIR} ${STAGEDIR}${PREFIX}/go
-	@${CP} -a ${WRKSRC}/* ${STAGEDIR}${PREFIX}/go
-.for file in ${BINARIES}
-	@${LN} -sf ../go/bin/${file} ${STAGEDIR}${PREFIX}/bin/${file}
-	@${ECHO_CMD} bin/${file} >> ${TMPPLIST}
-.endfor
-	@cd ${STAGEDIR}${PREFIX} && ${FIND} go -type f >> ${TMPPLIST}
-
-do-test:
-	cd ${WRKSRC}/src && ${SETENV} \
-		GOROOT=${WRKSRC} \
-		PATH=${WRKSRC}/bin:${PATH} \
-		GOOS=${OPSYS:tl} \
-		GOARCH=${GOARCH_${ARCH}} \
-		GO386=${GO386} \
-		GOARM=${GOARM_${ARCH}} \
-		CC=${CC} \
-		${SH} run.bash -no-rebuild
-
-.if !defined(_GO_MAKESUM_GUARD)
-makesum:
-	${MAKE} -D_GO_MAKESUM_GUARD makesum ARCH=${ONLY_FOR_ARCHS:O:[1]} DISTINFO_FILE=${DISTINFO_FILE}.tmp
-.for arch in ${ONLY_FOR_ARCHS:O:[2..-1]}
-	${MAKE} -D_GO_MAKESUM_GUARD makesum ARCH=${arch} DISTINFO_FILE=${DISTINFO_FILE}.${arch}
-	${SED} 1d ${DISTINFO_FILE}.${arch} >> ${DISTINFO_FILE}.tmp
-	${RM} ${DISTINFO_FILE}.${arch}
+.for f in go gofmt
+	@${LN} -sf ${f}${GO_SUFFIX} ${STAGEDIR}${PREFIX}/bin/${f}
 .endfor
-	${AWK} '!seen[$$0]++' ${DISTINFO_FILE}.tmp > ${DISTINFO_FILE}
-	${RM} ${DISTINFO_FILE}.tmp
-.endif
 
 .include <bsd.port.mk>
diff --git a/lang/go/pkg-descr b/lang/go/pkg-descr
index fbb088ea81a7..4393206e82fa 100644
--- a/lang/go/pkg-descr
+++ b/lang/go/pkg-descr
@@ -1,4 +1,7 @@
 Go is an open source programming environment that makes it easy to build
 simple, reliable, and efficient software.
 
+This is a meta port for the default version of Go, it provides symbolic links
+called go and gofmt.
+
 WWW: https://golang.org
diff --git a/lang/go117/Makefile b/lang/go117/Makefile
index 33548aad50d9..dcbe9d635a1a 100644
--- a/lang/go117/Makefile
+++ b/lang/go117/Makefile
@@ -1,28 +1,22 @@
-PORTVERSION=	1.17.10
-# Always set PORTREVISION and PORTEPOCH explicitly as otherwise they are inherited from lang/go
+# Created by: Devon H. O'Dell <devon.odell@gmail.com>
+
+DISTVERSION=	1.17.10
+# Always set PORTREVISION explicitly as otherwise they are inherited from lang/go-devel
 PORTREVISION=	0
-PORTEPOCH=	0
-MASTER_SITES=	https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
+MASTER_SITES=	https://golang.org/dl/ \
+		https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
 		LOCAL/dmgk:bootstrap
-PKGNAMESUFFIX=	117
-DISTFILES=	go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-${BOOTSTRAP_TAG}.tar.xz:bootstrap
+DISTFILES=	go${DISTVERSION}.src.tar.gz \
+		go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-${BOOTSTRAP_TAG}.tar.xz:bootstrap
 
 # Avoid conflicting patch files
 PATCHFILES=
 
-COMMENT=	Go programming language (development version)
-
-USE_GITHUB=	yes
-GH_ACCOUNT=	golang
-GH_TAGNAME=	7dd10d4ce20e64d96a10cb67794851a58d96a2aa
+COMMENT=	Go programming language
 
-CONFLICTS_INSTALL=	go
-
-MASTERDIR=	${.CURDIR}/../go
+MASTERDIR=	${.CURDIR}/../go-devel
 PATCHDIR=	${.CURDIR}/files
+WRKSRC=		${WRKDIR}/go
 DISTINFO_FILE=	${.CURDIR}/distinfo
 
-post-extract:
-	@[ -f ${WRKSRC}/VERSION ] || ${ECHO_CMD} "${PORTVERSION} +${GH_TAGNAME}" > ${WRKSRC}/VERSION
-
 .include "${MASTERDIR}/Makefile"
diff --git a/lang/go117/distinfo b/lang/go117/distinfo
index 4a70920d679d..87296aeb8c0d 100644
--- a/lang/go117/distinfo
+++ b/lang/go117/distinfo
@@ -1,8 +1,8 @@
-TIMESTAMP = 1652618409
+TIMESTAMP = 1653843983
+SHA256 (go1.17.10.src.tar.gz) = 299e55af30f15691b015d8dcf8ecae72412412569e5b2ece20361753a456f2f9
+SIZE (go1.17.10.src.tar.gz) = 22196380
 SHA256 (go-freebsd-arm64-go1.17.9.tar.xz) = d9e9180bdc5ad0eec1654679a50084ebb31ecbe9bef24f0bd8ba917db8d1830c
 SIZE (go-freebsd-arm64-go1.17.9.tar.xz) = 38572776
-SHA256 (golang-go-1.17.10-7dd10d4ce20e64d96a10cb67794851a58d96a2aa_GH0.tar.gz) = 903cb4363af9a1c9a6c9d08ea0525983634862a5cb1f893b0b6156e3b99f847c
-SIZE (golang-go-1.17.10-7dd10d4ce20e64d96a10cb67794851a58d96a2aa_GH0.tar.gz) = 22176903
 SHA256 (go-freebsd-amd64-go1.17.9.tar.xz) = fd439ad091ed57d0ad728c05fc60465aad2e46e98da96e2d5b60b0c470f2efec
 SIZE (go-freebsd-amd64-go1.17.9.tar.xz) = 41951936
 SHA256 (go-freebsd-arm6-go1.17.9.tar.xz) = ba24590b8cec761207eafc5a39c71b5b5041320c6fb0c95d35c123f6054f8d1c
diff --git a/lang/go118/Makefile b/lang/go118/Makefile
new file mode 100644
index 000000000000..84d442ea9e56
--- /dev/null
+++ b/lang/go118/Makefile
@@ -0,0 +1,22 @@
+# Created by: Devon H. O'Dell <devon.odell@gmail.com>
+
+DISTVERSION=	1.18.2
+# Always set PORTREVISION explicitly as otherwise they are inherited from lang/go-devel
+PORTREVISION=	0
+MASTER_SITES=	https://golang.org/dl/ \
+		https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
+		LOCAL/dmgk:bootstrap
+DISTFILES=	go${DISTVERSION}.src.tar.gz \
+		go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-${BOOTSTRAP_TAG}.tar.xz:bootstrap
+
+# Avoid conflicting patch files
+PATCHFILES=
+
+COMMENT=	Go programming language
+
+MASTERDIR=	${.CURDIR}/../go-devel
+PATCHDIR=	${.CURDIR}/files
+WRKSRC=		${WRKDIR}/go
+DISTINFO_FILE=	${.CURDIR}/distinfo
+
+.include "${MASTERDIR}/Makefile"
diff --git a/lang/go/distinfo b/lang/go118/distinfo
similarity index 97%
rename from lang/go/distinfo
rename to lang/go118/distinfo
index ae1efb41ca12..d6c48fb08a52 100644
--- a/lang/go/distinfo
+++ b/lang/go118/distinfo
@@ -1,4 +1,4 @@
-TIMESTAMP = 1652618333
+TIMESTAMP = 1653843300
 SHA256 (go1.18.2.src.tar.gz) = 2c44d03ea2c34092137ab919ba602f2c261a038d08eb468528a3f3a28e5667e2
 SIZE (go1.18.2.src.tar.gz) = 22837686
 SHA256 (go-freebsd-arm64-go1.17.9.tar.xz) = d9e9180bdc5ad0eec1654679a50084ebb31ecbe9bef24f0bd8ba917db8d1830c
diff --git a/lang/go/files/patch-src_cmd_go_internal_modload_vendor.go b/lang/go118/files/patch-src_cmd_go_internal_modload_vendor.go
similarity index 100%
rename from lang/go/files/patch-src_cmd_go_internal_modload_vendor.go
rename to lang/go118/files/patch-src_cmd_go_internal_modload_vendor.go