Skip to content

Extract go-mod-tidy code to script

Adam Cohen requested to merge add-git-hooks into master

What does this MR do?

This MR moves the code for the go mod tidy job to scripts/git-hooks/go-mod-tidy. This will allow developers to reference this same script in a pre-push git hook.

What are the relevant issue numbers?

gitlab-org/gitlab#357514 (closed)

Does this MR meet the acceptance criteria?

  • Tests added for this feature/bug

    • When there are local changes to go.mod or go.sum that haven't been committed, go mod tidy stage fails as expected:

      ERROR: local changes to go.mod and go.sum exist, please commit the changes before pushing.
    • When there are no local changes to go.mod or go.sum that haven't been committed, go mod tidy stage succeeds as expected.

Edited by Adam Cohen

Merge request reports