goatcounter icon indicating copy to clipboard operation
goatcounter copied to clipboard

replace statements in go.mod make it impossible to use as a package

Open maruel opened this issue 1 year ago • 2 comments

At the time of writing, https://github.com/arp242/goatcounter/blob/master/go.mod contains 3 replace statements:

  • zgo.at/bgrun added in https://github.com/arp242/goatcounter/commit/c5810c639b0df378deb9224967cdbe9c85e98dac
  • github.com/oschwald/maxminddb-golang and github.com/oschwald/geoip2-golang added a long time ago.

These make the project impossible to import zgo.at/goatcounter/v2 as package.

maruel avatar Sep 23 '24 18:09 maruel

% go install zgo.at/goatcounter/v2/cmd/goatcounter@latest
go: zgo.at/goatcounter/v2/cmd/goatcounter@latest (in zgo.at/goatcounter/[email protected]):
        The go.mod file for the module providing named packages contains one or
        more replace directives. It must not contain directives that would cause
        it to be interpreted differently than if it were the main module.

This seems to be new; pretty sure this worked at some point.

Not entirely sure what the solution is here 🤔

arp242 avatar Sep 23 '24 18:09 arp242

The solution is to get rid of the replace statements. For zgo.at/bgrun, either creating the repository or reverting back to local (I'd recommend the later).

For the two others, figure out how to get https://github.com/oschwald/geoip2-golang/pull/68 and https://github.com/oschwald/maxminddb-golang/pull/75 in or to do a real fork for these two repositories.

maruel avatar Sep 23 '24 19:09 maruel

I'm okay with just not having go install zgo.at/goatcounter/v2/cmd/goatcounter@latest. It's not ideal, but git clone [..] && go install ./cmd/goatcounter isn't that big of a deal, and I'd rather spend my time on other things that give more concrete benefit to users. Most people probably use the pre-compiled binaries. I guess it will be fixed "eventually" at some point, but no need to keep an issue open for it.

arp242 avatar May 23 '25 03:05 arp242

Should be fixed after bd93d39 and 37ffa94, FYI

arp242 avatar Jun 18 '25 22:06 arp242