From nobody Sun Mar 1 02:18:37 2026 X-Original-To: dev-commits-doc-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 4fNm2W1bTxz6Snvf for ; Sun, 01 Mar 2026 02:18:43 +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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fNm2W13y3z3vh0 for ; Sun, 01 Mar 2026 02:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772331523; 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=Qf+IcjFP82AWmgJysidm0E+CHZgi2RjFpj4dSpL0cnU=; b=WKJnETzGB0e4PthLaYxbz0bkm3l+UUrszyFVg2kNNAbVO/pHCsboDYiEU+kTgFTj8cReUm txY4sMmhnuWBlVEe78prrqO9gkdTqtD5G1rspsKnRD9NLZx1rnGzCsTLUQFgm3cWaqaFiQ CfDVtBq3SL2Z5Y7Joe/v1fqHIa3HXerRmjmSg+wLnQskIPwN9symAk4EIsuJa1ZJG+p+b6 h1x2kOc6rnK34+z34XL6pZfIi38hpN7mNMZaJAAIwZtStJUy/N3IqULuQlqG1EO90V5Hcp 2XM/Nn+BRjybEwoEPofCA5IGc0lukVDt9UVrY1fVhUter3l8xWKMWHHTNlBvLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772331523; a=rsa-sha256; cv=none; b=SqjIscm8iQ4A0TaYb1MCPKMfcr2XeeQmZFVc8Qp6mt371vGpxKK//VgzEHVbJC68h3KqID oDDOgjqgCJbAMtrXInbLE5hT2YBXz5pWB2IOsONaefRyALGGjX8oFc5DnFchDfu1/SkPSh 1UMWULQZmqmYmMAQP/gBMKD7GBneYYFF4MjkfdOL+ly2c9qmmQ0ssjHLOVGyTcUXWcyB1H UhBsng+Alybya3dF6zTmBkN8ebbscpj5rJOkAAPJCP4i96eRB325ongNCYyKISwTbOnJoS 8hTbXL0JKrwfd7KJe4uvBtT6kkWj8+ZYJsC8BjVwlIVYbcZhYiQY6UI3H+h0+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772331523; 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=Qf+IcjFP82AWmgJysidm0E+CHZgi2RjFpj4dSpL0cnU=; b=l6WL+yLj1cUg5ugwRSVxVdbdkLrACq9sAIm+nM8dRmv55zEoWiFl7RAnQwRtfTOK3kID/L IwtpOyQrMbr5RPSS/tcSPmSnamU0Uy9jJAjKYk8MX8ZiHHkbbd6NVS39ymLAedu0HUOrJf nuUElMijfmFnJQkN+AdiNgvi62uyXv2AgGprm6sH/poT1I/kqxrrKgWUK5nyZwuhZVrWOF BRxR/6SOh7gbtemMlrhf6ZwUwWK9XUK10tKQwcUZHMdsEQYDCMUxUs891YQsuHxDkxYb7T su7p2lfi0kf2lAvkVTchMcdC+6XzZmj7Pc/xHITIcawhgRrKkHjGREzWPrj0VQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fNm2W0P05zTZb for ; Sun, 01 Mar 2026 02:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1fcb5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 01 Mar 2026 02:18:37 +0000 To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: Adam Weinberger Subject: git: 22b66edfc1 - main - PHB(special>go): Add instructions for overriding go.mod List-Id: Commit messages for all branches of the doc repository List-Archive: https://lists.freebsd.org/archives/dev-commits-doc-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-doc-all@freebsd.org Sender: owner-dev-commits-doc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adamw X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22b66edfc15fa035d9e43f39522a15c11212cfbe Auto-Submitted: auto-generated Date: Sun, 01 Mar 2026 02:18:37 +0000 Message-Id: <69a3a1fd.1fcb5.70c3152a@gitrepo.freebsd.org> The branch main has been updated by adamw: URL: https://cgit.FreeBSD.org/doc/commit/?id=22b66edfc15fa035d9e43f39522a15c11212cfbe commit 22b66edfc15fa035d9e43f39522a15c11212cfbe Author: Adam Weinberger AuthorDate: 2026-03-01 02:17:26 +0000 Commit: Adam Weinberger CommitDate: 2026-03-01 02:17:26 +0000 PHB(special>go): Add instructions for overriding go.mod The USES=go:modules system is smart and clever, but it does all its evaluation of go.mod during fetch phase, which means that porters can't patch it first (say, to alter dependencies or change the toolchain version). Instead, it's possible to override go.mod by specifying a new one as a second distfile (and go.sum can be overridden in the same way). We've supported that for a long time, but we've never documented it before. Reviewed by: fuz, ziaee Approved by: ziaee (doc) Differential Revision: https://reviews.freebsd.org/D55580 --- .../en/books/porters-handbook/special/_index.adoc | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/documentation/content/en/books/porters-handbook/special/_index.adoc b/documentation/content/en/books/porters-handbook/special/_index.adoc index ea0b1b3b22..9501ff8ef3 100644 --- a/documentation/content/en/books/porters-handbook/special/_index.adoc +++ b/documentation/content/en/books/porters-handbook/special/_index.adoc @@ -990,6 +990,34 @@ GO_TARGET= ./dnscrypt-proxy:${PREFIX}/sbin/dnscrypt-proxy will install `dnscrypt-proxy` to `${PREFIX}/sbin`. ==== +[[overriding-go-mod]] +.Overriding go.mod in Modules Mode +[example] +==== +During the fetch phase, modules-aware mode (that is, `USES=go:modules`) obtains sources for dependent packages by fetching the port's [.filename]#go.mod# and then immediately running `go mod download` against it. +Because the fetch phase occurs long before patching, regular patches in [.filename]#files/# are applied far too late to affect those dependency resolution and fetch steps. + +While patching the upstream [.filename]#go.mod# to alter dependencies isn't possible at this time, you can still *override* it by listing another [.filename]#go.mod# as a second distfile. + +[.programlisting] +.... +PORTNAME= miller +DISTVERSIONPREFIX= v +DISTVERSION= 6.17.0 +CATEGORIES= textproc +MASTER_SITES= https://raw.githubusercontent.com/johnkerl/${PORTNAME}/${DISTVERSIONFULL}/:gomod + +DISTFILES= go.mod:gomod +.... + +To override [.filename]#go.sum# as well, just add it to `DISTFILES`: + +[.programlisting] +.... +DISTFILES= go.mod:gomod go.sum:gomod +.... +==== + [[using-cabal]] === Building Haskell Applications with `cabal`