Skip to content

Instantly share code, notes, and snippets.

@jeanbza
Last active September 13, 2019 19:19
Show Gist options
  • Save jeanbza/8fba4df777308c9c50527901c9d861a3 to your computer and use it in GitHub Desktop.
Save jeanbza/8fba4df777308c9c50527901c9d861a3 to your computer and use it in GitHub Desktop.
tidyall

Stick the following in your ~/.bash_profile:

function tidyall {
  for i in `find . -name go.mod`; do
    pushd `dirname $i`;
      go mod tidy;
    popd;
  done
}
alias tidyall=tidyall

Then, run $ tidyall from your project root to run go mod tidy on all modules within your project.

(don't forget to run $ source ~/.bash_profile before trying to use your updated ~/.bash_profile!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment