Created
March 28, 2023 19:47
-
-
Save GerardoHP/be1e490a7f23d0bf92b302ad97c8748d to your computer and use it in GitHub Desktop.
bash script to create basic files template for new exercises in go, should be created under /usr/local/bin
This file contains 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 | |
# Find the module file of go | |
if find go.mod | |
then | |
# Change to the structure | |
if cd $1 | |
then | |
echo "package $1" >> "$2.go" | |
echo "package $1_test" >> "$2_test.go" | |
else | |
echo "the folder $1 does not existe" | |
fi | |
else | |
echo "the current location does not meet the criteria for a go root folder" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment