Created
August 12, 2023 18:18
-
-
Save bardic/96ffa78ff7f45a8a071acac1bcacb92e to your computer and use it in GitHub Desktop.
Simple shell script to loop through your go.work and tidy the known modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ROOT=`pwd` | |
| while read p; do | |
| all=$(echo $p) | |
| first=${all%% *} | |
| if [[ $first == "use" ]]; then | |
| last=${all##* } | |
| cd $last | |
| go mod tidy | |
| cd $ROOT | |
| fi | |
| done <go.work |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment