Re: /usr/ports/distfiles/go insanely oversized

From: Denis Shaposhnikov <dsh_at_bamus.cz>
Date: Mon, 17 Jun 2024 16:00:46 UTC
Hi,

On Sun, 16 Jun 2024, at 11:15, Thor Ablestar wrote:
> go/archivers_nfpm/pkg/mod/cache/download/github.com/!masterminds/goutils/@v
>
> contains the same files (name and size) as
>
> go/audio_gonic/pkg/mod/cache/download/github.com/!masterminds/goutils/@v
>
> What to do? How to manage it? If the problem cannot be solved I am going 

I use a port overlay and inside it I have custom Mk/Uses/go.mk:
https://github.com/dsh2dsh/freebsd-ports/blob/master/Mk/Uses/go.mk

==========================================================
.include "${USESDIR}/go.mk"

.if !defined(_DSH_INCLUDE_USES_GO_MK)
_DSH_INCLUDE_USES_GO_MK=	yes

.  if ${go_ARGS:Mmodules}
GO_GOPATH=	${DISTDIR}/go
.  endif # ${go_ARGS:Mmodules}

.endif # !defined(_DSH_INCLUDE_USES_GO_MK)
==========================================================

This change shares mod cache between all go ports, instead of separated mod cache for every go port. Actually I don't understand why go.mk separates go cache for every port, I don't see a reason for that.

BTW, I use forked [poudriere-devel](https://github.com/dsh2dsh/poudriere) which shared go mod cache in DISTFILES_CACHE. As I see upstream's poudriere doesn't copy go dependencies back to DISTFILES_CACHE.