rules_go icon indicating copy to clipboard operation
rules_go copied to clipboard

How to use go vendoring with bzlmod?

Open farcop opened this issue 1 year ago • 2 comments

bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go")

What version of gazelle are you using?

bazel_dep(name = "gazelle", version = "0.32.0", repo_name = "bazel_gazelle")

What version of Bazel are you using?

6.5.0

I want to migrate go modules vendoring to Bzlmod, now we use WORKSPACE defined deps stored in monorepo at vendor folder and I want to know how to use go vendoring with bzlmod?

farcop avatar Feb 19 '24 15:02 farcop

You can use a combination of bazel fetch and bazel vendor to write module repos to a vendor folder. See https://docs.google.com/document/d/1P9WwRvpGLi9Tw-AKN7dZ2AeRmfVsl_-lH-N9g3UkVMI/edit?pli=1#heading=h.ij7l30ek7uph. This seems to be changing rapidly. You may want to use latest bazel to experiment.

peakschris avatar Feb 23 '24 01:02 peakschris

Try @peakschris' suggestion first as it wouldn't require any ruleset specific work. But 7.1.0 also provides the necessary tools to implement this in a way that mimics Go's native vendoring support, which we could investigate if the alternative doesn't work.

fmeum avatar Feb 23 '24 07:02 fmeum