Skip to content

Instantly share code, notes, and snippets.

@luontola
Created December 15, 2009 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luontola/256946 to your computer and use it in GitHub Desktop.
Save luontola/256946 to your computer and use it in GitHub Desktop.
Commands for easily compiling and testing Go programs in Gedit
#!/bin/bash
get_topmost_makefile() {
dir=$1
while test "$dir" != "/"; do
makefile=`get_makefile $dir`
if [ "$makefile" != "" ]; then
topmost=$makefile
else
echo "$topmost"
exit
fi
dir=`dirname "$dir"`
done
}
get_makefile() {
dir=$1
for m in GNUmakefile makefile Makefile; do
if [ -f "${dir}/${m}" ]; then
echo "${dir}/${m}"
exit
fi
done
}
makefile=`get_topmost_makefile $GEDIT_CURRENT_DOCUMENT_DIR`
if [ "$makefile" == "" ]; then
echo "No Makefile found!" > /dev/stderr
exit 1
fi
echo "Using makefile:"
echo "$makefile"
dir=`dirname "$makefile"`
make -C "$dir" -s
#!/bin/bash
get_topmost_makefile() {
dir=$1
while test "$dir" != "/"; do
makefile=`get_makefile $dir`
if [ "$makefile" != "" ]; then
topmost=$makefile
else
echo "$topmost"
exit
fi
dir=`dirname "$dir"`
done
}
get_makefile() {
dir=$1
for m in GNUmakefile makefile Makefile; do
if [ -f "${dir}/${m}" ]; then
echo "${dir}/${m}"
exit
fi
done
}
makefile=`get_topmost_makefile $GEDIT_CURRENT_DOCUMENT_DIR`
if [ "$makefile" == "" ]; then
echo "No Makefile found!" > /dev/stderr
exit 1
fi
echo "Using makefile:"
echo "$makefile"
echo
dir=`dirname "$makefile"`
make -C "$dir" -s test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment