Skip to content

Instantly share code, notes, and snippets.

@Integralist
Created February 16, 2026 14:48
Show Gist options
  • Select an option

  • Save Integralist/99b6a9e7ad181bd95d177de670f78767 to your computer and use it in GitHub Desktop.

Select an option

Save Integralist/99b6a9e7ad181bd95d177de670f78767 to your computer and use it in GitHub Desktop.
Go: ignore vendor directory for multi-language repo

In a multi-language repository—for example, one that includes both Go and Ruby—you can run into conflicts around the vendor/ directory. Ruby commonly uses a vendor/ directory to store dependencies, but Go’s toolchain assumes that a vendor/ directory follows its own vendoring format (including the modules.txt file that defines vendored modules).

If Ruby’s vendor/ directory is present, the Go toolchain may attempt to interpret it as a Go vendoring directory, leading to unexpected errors.

To prevent this, configure Go to use module mode explicitly and ignore the vendor/ directory (which, in this case, is only relevant to Ruby):

  • Add -mod=mod to commands such as go build and go test.
  • Set a global flag with export GOFLAGS=-mod=mod for commands like go tool that do not expose a -mod flag directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment