git: f26bf85ff91b - main - Mk/Uses/go.mk: Omit version control information

From: Dmitri Goutnik <dmgk_at_FreeBSD.org>
Date: Sat, 07 May 2022 11:40:53 UTC
The branch main has been updated by dmgk:

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

commit f26bf85ff91bc418bf332b23420e4fa87dfb9a53
Author:     Dmitri Goutnik <dmgk@FreeBSD.org>
AuthorDate: 2022-05-06 17:48:53 +0000
Commit:     Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2022-05-07 11:37:36 +0000

    Mk/Uses/go.mk: Omit version control information
    
    Disable embedding of version control information [1] in binaries built
    by go1.18 and later.
    
    [1] https://tip.golang.org/doc/go1.18#go-version
    
    PR:             263390
---
 Mk/Uses/go.mk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
index 96c46ce30fbc..bdee332a368b 100644
--- a/Mk/Uses/go.mk
+++ b/Mk/Uses/go.mk
@@ -69,6 +69,8 @@ IGNORE=	USES=go has invalid arguments: ${go_ARGS:Nmodules:Nno_targets:Nrun}
 
 # Settable variables
 
+GO_PORT?=	lang/go
+
 .  if empty(GO_PKGNAME)
 .    if !empty(GH_SUBDIR)
 GO_PKGNAME=	${GH_SUBDIR:S|^src/||}
@@ -87,6 +89,10 @@ GO_BUILDFLAGS+=	-v -buildmode=exe -trimpath
 GO_BUILDFLAGS+=	-ldflags=-s
 .  endif
 GO_TESTFLAGS+=	-v
+.  if ${GO_PORT} != lang/go117
+GO_BUILDFLAGS+=	-buildvcs=false
+GO_TESTFLAGS+=	-buildvcs=false
+.  endif
 
 CGO_ENABLED?=	1
 CGO_CFLAGS+=	-I${LOCALBASE}/include
@@ -144,8 +150,6 @@ GO_ENV+=	GOPATH="${GO_GOPATH}" \
 		GO111MODULE=off
 .  endif
 
-GO_PORT?=	lang/go
-
 BUILD_DEPENDS+=	${GO_CMD}:${GO_PORT}
 .  if ${go_ARGS:Mrun}
 RUN_DEPENDS+=	${GO_CMD}:${GO_PORT}