Skip to content

Instantly share code, notes, and snippets.

@miekg
Created August 12, 2013 05:12
Show Gist options
  • Save miekg/6208366 to your computer and use it in GitHub Desktop.
Save miekg/6208366 to your computer and use it in GitHub Desktop.
When doing cgo I get confused when to type make (to compile C code) or when to type go build (to compile Go code). Also in Vim you use :make, so to stop any confusing I'm using the following function. This allows me to always use 'make'.
make() {
if [[ -f Makefile || -f GNUMakefile ]]; then
command make "$@"
return
fi
go build
# if go build failed with exit code 1, the build env wasn't
# correct, in that case, try make again
if [[ $? -eq 1 ]]; then
command make "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment