cannot `go get github.com/buchgr/bazel-remote@v2.4.0`
dragonsinth opened this issue · 9 comments
Hi friends, great library! We're finding it very useful. However, we're sorta stuck on v1.3.3 because the directory layout doesn't follow the normal Go module version guidelines. Trying to pull a recent version fails:
> go get github.com/buchgr/bazel-remote@v2.4.0
go: github.com/buchgr/bazel-remote@v2.4.0: invalid version: module contains a go.mod file, so module path must match major version ("github.com/buchgr/bazel-remote/v2")
Thanks!
Scott
Hi, bazel-remote isn't intended to be used as a library (though I have heard of people trying), and the "official" way to build it is with bazel, which "go get" doesn't support. Do you actually need to consume parts of bazel-remote as a library, or are you just trying to get a binary?
I'm actually trying to use it as a library, since it has a pretty nice clean interface. I'm bundling it into a service that also includes other sorts of network-accessible caches and proxies. (And in my case, it's easier to deploy as part of internal application framework, where I get things like logging and metrics and monitoring for free.)
I'll need to do some research on go modules then (perhaps next week). I wonder if moving all the code except main.go into a v2/ directory with its own go.mod file would work...
It might be possible to just change the module declaration? Example I found: https://github.com/ClickHouse/clickhouse-go/blob/main/go.mod -- this package is imported as github.com/ClickHouse/clickhouse-go/v2
and works just fine.
Assuming there's no need to maintain 1.x releases going forward, this might be easiest.
I'm running into this same issue. I want to build my own version of bazel-remote
with a custom cache implementation.
Sorry it took me a while to get around to this. Would something like this work? #646
(Note that I provide no guarantees on the stability or backwards compatibility of these packages.)
I would love to hear more about how you're using bazel-remote (or parts of it). Just curious- maybe it's something worth upstreaming?
Seems like that would work #646 (comment)
I'm putting together a caching proxy for a self-hosted CI that can handle multiple languages/tools, such as bazel, npm, go, python, etc. We sort of have our own "service rails" that make it easy to deploy self-built Go services.
I made a 2.4.1 release with this change- does it work for you now?
Seems to work, thank you!!
> go get github.com/buchgr/bazel-remote/v2
go: downloading github.com/buchgr/bazel-remote/v2 v2.4.1