From nobody Mon Dec 15 13:43:51 2025 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dVLrD35Lpz6Kk9m for ; Mon, 15 Dec 2025 13:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dVLrD2R19z3F1h for ; Mon, 15 Dec 2025 13:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765806236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yWIZBsxNKaNgUDpoC8kSmWFpDLnA8BRCWnGoo+QBjGQ=; b=eeRYb59FEZWLu8J9mCzpM3lxl240KnqQNeOeIY6tnbQ6y+lCebY6eOsrEr7j/XVDvGx4hK ugxrwn5Arvvjo3gVMOmprK5O5rCHlHyOej83f23JWxXmDjes0uVIVxdrcxkkKkKpXn2mAT mUUYYlDpUR7AorPH2+z/UcavNA6ANEOhLD/xDjQ9hnDCRsa0n4zmnsXjv5AJ7vfWyhjhbT iGyClFPeCU8F280KwCZOVsODC54LkAv625I8NsLdGhcGj5f1HBOPYHDdaBPCLJJhgmdszj gEkwVMHPvKYCnlzBZzfYe7IodBwNcswegPfB+9Rjrw1SylhQ7jLFcCi4/abdNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765806236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yWIZBsxNKaNgUDpoC8kSmWFpDLnA8BRCWnGoo+QBjGQ=; b=EUiUOu9cUAr/4suO88GZw1G/WfTWzpk2Wdi5okx4tpqC+7kTgVt8YLFF0CJSwULgt4iTOf bc7VUfiHZQCeI7/tHl4YYFsqDsbK9dZVqdsM5wIb6flotQAFyNIb3el9eTYz2ZfpRhzRPj DZKEdju4RLq6DRDiM6PmT8SliknQNAAO1PyPbGiUIMS5pvjM7k8+IOvW59K+8mVWRUGl8g CwzL9/OUySBKC67GLxjkjVRgfr5s0W9mJLDq5EATe/WJGRhJ64Zp7p0xfRqVwcnE6eoTby 38V7YUw1MLjuZObSV8liQe7Vt1OBCyMXAftdKQXAjxPDGlDkydkc0rlI3OpAkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765806236; a=rsa-sha256; cv=none; b=WjqFeerU5RxblZVuFV7Vp22GZZiGOZLYtfaTFv1pdqJlcx6VxuCZGPIyhLkDYFDtsakrUc W/wRtlCWlHxGskM5iR7espWR7PHFh7Q37owp/7QHdMcGw5IsWLMV6X05Q4IqHhVOr7XCpo OLLHeLwRBz7qk+18KWc6CUQGpFGs9d0ulvYow0yvFzDKPKXQ2nZ7FqkLrZ5NCuaca9O6l9 0jRKndtm+/nIBCSHE9NplgVolvEjCJBub4QkydpAoaGDDg3VkWLobDji/iWnRcvdHGW6Io sURWnRtB4VZ6UljMG1eRPO28R6q5hScGZgFSCbnk1MOHmNeYARbFAq9V5tzKWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dVLrD1w2pz603 for ; Mon, 15 Dec 2025 13:43:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3113f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 15 Dec 2025 13:43:51 +0000 To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: b318a7cadc57 - main - Uses/go.mk: Add support for requesting a minimum version List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b318a7cadc57d35a4dfdc1db90048b5e7b194501 Auto-Submitted: auto-generated Date: Mon, 15 Dec 2025 13:43:51 +0000 Message-Id: <69401097.3113f.27b7f14a@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/ports/commit/?id=b318a7cadc57d35a4dfdc1db90048b5e7b194501 commit b318a7cadc57d35a4dfdc1db90048b5e7b194501 Author: Dag-Erling Smørgrav AuthorDate: 2025-12-15 13:42:57 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-12-15 13:43:24 +0000 Uses/go.mk: Add support for requesting a minimum version This adds support for requesting a minimum Go version instead of an exact one. If USES contains something like go:X.Y+, we walk the list of valid Go versions backward and pick the first element that matches either the requested version or the default version. Assuming the list of valid versions is sorted semantically, this means we will pick the requested version if it is newer than the default version, and the default version otherwise. This is somewhat imprecise, but it's hard to do better without a comparison operator that understands semantic versioning, which bmake lacks. Simply comparing versions lexicographically or numerically would produce incorrect results, since e.g. 1.3 precedes 1.29 but is both lexicographically and numerically larger. Note that specifying a version that does not yet exist in the ports tree will have the same effect as specifying a version that has been retired: silently fall back to the default version. This also drops support for pinning to -devel. This is currently unused and doesn't work as implemented; furthermore, the current -devel port is wildly out of date and is expected to be removed rather than updated. MFH: 2025Q4 Reviewed by: fuz, adamw Differential Revision: https://reviews.freebsd.org/D54104 --- Mk/Uses/go.mk | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk index 872546e6fd01..3d34f15508cd 100644 --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -3,10 +3,11 @@ # # Feature: go # Usage: USES=go -# Valid ARGS: (none), N.NN, N.NN-devel, modules, no_targets, run +# Valid ARGS: (none), N.NN+, N.NN, modules, no_targets, run # # (none) Setup GOPATH and build in GOPATH mode using default Go version. -# N.NN Specify Go version +# N.NN+ Specify minimum Go version +# N.NN Specify exact Go version (should be avoided) # 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 @@ -83,19 +84,30 @@ _INCLUDE_USES_GO_MK= yes # When adding a version, please keep the comment in # Mk/bsd.default-versions.mk in sync. -GO_VALID_VERSIONS= 1.20 1.21 1.22 1.23 1.24 1.25 1.26-devel +GO_VALID_VERSIONS= 1.20 1.21 1.22 1.23 1.24 1.25 # 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} +. if !empty(go_ARGS:N[1-9].[0-9][0-9]+:N[1-9].[0-9][0-9]:Nmodules:Nno_targets:Nrun) +IGNORE= USES=go has invalid arguments: ${go_ARGS:N[1-9].[0-9][0-9]+:N[1-9].[0-9][0-9]:Nmodules:Nno_targets:Nrun} . endif # Parse Go version -GO_VERSION= ${go_ARGS:Nmodules:Nno_targets:Nrun:C/^$/${GO_DEFAULT}/} -. if empty(GO_VALID_VERSIONS:M${GO_VERSION}) +. if !empty(go_ARGS:M*+) +GO_MIN_VERSION= ${go_ARGS:M*+:S/+//} +. for version in ${GO_VALID_VERSIONS:[-1..1]} +. if empty(GO_VERSION) +. if ${version} == ${GO_DEFAULT} || ${version} == ${GO_MIN_VERSION} +GO_VERSION:= ${version} +. endif +. endif +. endfor +. else +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 . endif -GO_SUFFIX= ${GO_VERSION:S/.//:C/.*-devel/-devel/} +GO_SUFFIX= ${GO_VERSION:S/.//} GO_PORT= lang/go${GO_SUFFIX} # Settable variables