The `vendor` directory that go mod targets for caching third party code, is unfortunately not programming language agnostic.
When Go and Rust are used in tandem, then go mod becomes confused. In situations where only Rust vendoring is applied, then go mod sees a vendor directory, assumes it is Go code, then aborts.
Please migrate to a language specific directory name, such as vendor-go.
As a workaround, use cargo primitives to customize the Rust vendor directory name.
Note that go mod currently lacks the ability to customize this name.
Again, you’ll get better response if you file that at Issues · golang/go · GitHub . I’ve never seen any indication that anyone from the Go team visits this site.
To be fair, it’s already solved on the cargo side of things. Cargo supports vendoring into arbitrary folders:
… which totally solves this problem. Also the idea that you would share a single top-level folder for a combination Rust/Go project is… interesting to say the least. I would contend that you should think about your folder/project structure a bit more and this is a non-issue.
Can go mod vendor -o vendor-go solve your problem?
go help mod vendor output that:
The -o flag causes vendor to create the vendor directory at the given
path instead of "vendor". The go command can only use a vendor directory
named "vendor" within the module root directory, so this flag is
primarily useful for other tools.