Skip to content

Instantly share code, notes, and snippets.

@GerardoHP
Created March 28, 2023 19:47
Show Gist options
  • Save GerardoHP/be1e490a7f23d0bf92b302ad97c8748d to your computer and use it in GitHub Desktop.
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
#!/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