From nobody Mon Dec 15 13:43:51 2025 X-Original-To: dev-commits-ports-all@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 4dVLr73N18z6Kjst for ; Mon, 15 Dec 2025 13:43:51 +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 4dVLr72WVBz3DlQ for ; Mon, 15 Dec 2025 13:43:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765806231; 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=V5FcM2yB1crt5D14TRlIOzy+FXufLQ3TOD363j56Jn0606Svihlu6iLB2RbOnyk834tqiV TY3DJDyvt0TduyIr0qJuqBtrY3qkCSLrwYSpOvl2iSU1jvuixFH5joGqMt1480Bz9prBqq EXlqVNWQuqGwTKANdNGcA9u2AxFnjGj5RrR43iw9Rp+TcWkJ06AQjJ4Q21xslJISW6Mi2Z hHInGy41ziqKPcndfzugBVwQNKR5lL6UOB6Mfb3Ewyk/PCITwH5vn3Y9Jble14TqGbm4HO S4cq3F08c+KsmnesuR59kF3AgfyFa3aYFcPBoTTMB1KcdxpaW/pIuC5W3JlBgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765806231; 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=o3qgbz+4s9bk9SMrKvF2wEv+E0jjBveenwqT+cuGwxsChsgbEuDWmS++6tl06WZRsRq0hC y6Y56jtigtHAXljtjy+A7ArqzEJAsNWVjLPdZaUNCFftIeP45DyN7/L2l4WxylQ30mxX8+ BJMdg1N7d1f7Rdh6e26Y3uYG4SdIx0euREdZei8/kYz4MBX+CmZA3O2jUf+3irxvzwFniH cemIFKIe5Iv8FEdzHf+8OhSyVU33JeofrQiupz1mVQk79/iZunXZ5JPQJaZG8U5QZ7Oi6t HG5VY0hG0Gm8C5+/AIHOxkW9otn3Abw2O03gpaKDsnHLvrVyhpYkNjN7GLYFpA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765806231; a=rsa-sha256; cv=none; b=u1JJsP9wQ3o7N2UxM6wDJ2m6EY+BajrpE+DscJ4VZ/o8tJEzaSB72FeIHr8whEyvxXVX5x iVu4pxAjnh1+dww7fLIRD9R/q4p61nDL9F1l3K0YPSw0Cu2+Q6QYK64hqwfixzE8Qme5PA A/jng8pLYOqQ8hspAgaaGIMP3Q20Eese8i2b2PZ735VZIyMZKIxcIypugBxjpVtbbkeNQe ei1zKSsqs7tQLZco2qa9o+7TqiCp928rk6FcL/eLhL0Xh94fV6lFFT0m3SMsSQ8mDPlNwz hOJtWRGF7JjAitjcenRNU5Q2JbCwIhECZN+44y0E5rHhyGdY4dOMcIGSf4lTRw== 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 4dVLr71w0Sz6kJ for ; Mon, 15 Dec 2025 13:43:51 +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: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@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