Skip to content
Snippets Groups Projects
Commit d592a0f8 authored by Dmitri Goutnik's avatar Dmitri Goutnik
Browse files

Mk/Uses/go.mk: Do not insist on always pulling go.mod and distfile from GOPROXY

Some Go packages are not listed on pkg.go.dev (usually because their
versioning scheme does not satisfy Go requirements) and, as a
consequence, are not accessible through proxy.golang.org.

Instead of resorting to hacks with pseudo-versions and/or enumerating
dependencies manually with modules2tuple, support fetching go.mod and
distfile from the usual places using DISTFILES mechanism. This will
allow bypassing GOPROXY for go.mod and the distribution archive, but
will still use it for fetching dependencies (with GO_MODULE).
parent 0af68092
No related branches found
No related tags found
No related merge requests found
......@@ -120,14 +120,16 @@ GO_ENV+= GOPATH="${GO_GOPATH}" \
GOSUMDB=${GO_GOSUMDB}
. if defined(GO_MODULE)
GO_MODNAME= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\1/}
. if empty(DISTFILES:Mgo.mod*)
GO_MODVERSION= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\2/:M@*:S/^@//:S/^$/${DISTVERSIONFULL}/}
GO_MODFILE= ${GO_MODVERSION}.mod
GO_DISTFILE= ${GO_MODVERSION}.zip
DIST_SUBDIR= go/${PKGORIGIN:S,/,_,g}/${DISTNAME}
MASTER_SITES+= ${GO_GOPROXY}/${GO_MODNAME:C/([A-Z])/!\1/g:tl}/@v/
DISTFILES+= ${GO_MODFILE} ${GO_DISTFILE}
EXTRACT_ONLY+= ${GO_DISTFILE}
WRKSRC= ${WRKDIR}/${GO_MODNAME}@${GO_MODVERSION}
. endif
DIST_SUBDIR= go/${PKGORIGIN:S,/,_,g}/${DISTNAME}
FETCH_DEPENDS+= ${GO_CMD}:${GO_PORT} \
ca_root_nss>0:security/ca_root_nss
USES+= zip
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment