[go: up one dir, main page]

Skip to content

Exclude golang Vendor folders in Merge Requests

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Description

When committing vendor directories in Go projects, Merge Requests can be larger and harder to review as content from the vendor packages is included in the changes of the merge request.

Additional Details

From Go's FAQ on dependencies:

It's up to you:

Pros

  • It's the only way to get truly reproducible builds, as it guards against upstream renames, deletes and commit history overwrites.
  • You don't need an extra dep ensure step to sync vendor/ with Gopkg.lock after most operations, such as go get, cloning, getting latest, merging, etc.

Cons

  • Your repo will be bigger, potentially a lot bigger, though prune can help minimize this problem.
  • PR diffs will include changes for files under vendor/ when Gopkg.lock is modified, however files in vendor/ are hidden by default on GitHub.

Proposal

Files in Go's vendor folder don't need to be reviewed as part of the code review workflow. These files should be automatically suppressed in Merge Requests.

Current Workaround

In GitLab 16.10 we introduced collapse generated files which automatically collapses generated style files. It's also possible to use this and configure your .gitattributes with custom paths that would then follow this behavior.

Edited by 🤖 GitLab Bot 🤖