Re: go: errors parsing go.mod: unexpected input character '\x1f'

From: Christopher Beppler <freebsd_at_funzi.org>
Date: Sat, 14 Oct 2023 19:55:56 UTC
Am 14.10.23 um 21:39 schrieb Christopher Beppler:
> Hey there porting experts,
>
> I am in the process of migrating the sysutils/loki port to 
> USES=go:modules instead of the quite cumbersome GH_TUPLE shenanigans.
> [...]

Some progress, the error is a different one now (Updated Makefile below):

===>  License AGPLv3 accepted by the user
===>  License AGPLv3 accepted by the user
===>   grafana-loki-2.9.1 depends on file: /usr/local/sbin/pkg - found
===>   grafana-loki-2.9.1 depends on file: /usr/local/bin/go120 - found
===>   grafana-loki-2.9.1 depends on package: ca_root_nss>0 - found
=> v2.9.1.mod doesn't seem to exist in 
/usr/ports/distfiles/go/sysutils_loki/loki-v2.9.1.
=> Attempting to fetch 
https://proxy.golang.org/github.com/grafana/loki/@v/v2.9.1.mod
fetch: https://proxy.golang.org/github.com/grafana/loki/@v/v2.9.1.mod: 
Not Found
=> Attempting to fetch 
http://distcache.FreeBSD.org/ports-distfiles/go/sysutils_loki/loki-v2.9.1/v2.9.1.mod
fetch: 
http://distcache.FreeBSD.org/ports-distfiles/go/sysutils_loki/loki-v2.9.1/v2.9.1.mod: 
Not Found
=> Couldn't fetch it - please try to retrieve this
=> port manually into /usr/ports/distfiles/go/sysutils_loki/loki-v2.9.1 
and try again.
*** Error code 1

If I open 
https://proxy.golang.org/github.com/grafana/loki/@v/v2.9.1.mod, I can see

not found:github.com/grafana/loki@v2.9.1: invalid version: module contains a go.mod file, so module path must match major version ("github.com/grafana/loki/v2")

Is this a bug (similar to https://github.com/golang/go/issues/35732) in 
go or am I missing something?

>
> This is the (reduced) Makefile I am using that reproduces the issue:
> [...]

Correcting this to:

PORTNAME=    loki
DISTVERSIONPREFIX=    v
DISTVERSION=    2.9.1
CATEGORIES=    sysutils
PKGNAMEPREFIX=    grafana-

USES=        go:modules

USE_RC_SUBR=    loki

GO_MODULE=    github.com/grafana/loki
GO_TARGET=    ./cmd/loki ./cmd/loki-canary ./cmd/logcli 
./clients/cmd/promtail

.include <bsd.port.mk>

Having still cpe and USES_GITHUB=yes enabled was wrong.