Re: Porting a new Golang app: go mod replace relative path

From: Matthias Fechner <idefix_at_fechner.net>
Date: Mon, 22 Apr 2024 07:22:39 UTC
Am 19.04.2024 um 19:44 schrieb Zach Leslie:
> ===> Fetching github.com/grafana/alloy dependencies go:
> github.com/grafana/alloy/syntax@v0.1.0  (replaced by ./syntax): reading
> syntax/go.mod: open
> /usr/ports/distfiles/go/sysutils_alloy/grafana-alloy-v1.0.0_GH0/syntax/go.mod:
> no such file or directory *** Error code 1
>
> I've spoken with the authors, and they don't intend to keep a `vendor`
> directory, nor do they intend to change the go mod replace line, so
> I'm left wondering what my options are.
>
> Is there a workaround for this?  Can we specify in the port that for a
> specific module, to reference the module
> github.com/grafana/alloy/syntax at the same version as the port?  Any
> advice would be appreciated.

I think the problem is this line:
https://github.com/grafana/alloy/blob/main/go.mod#L777

You can maybe try to fetch this additional go.mod somehow manually:
https://github.com/grafana/alloy/blob/main/syntax/go.mod

maybe by an additional manually added distfile entry to place it in the 
expected directly (maybe in a prefetch rule or by just manually 
extending the DIST_FILES).

Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook