Created
January 5, 2015 22:24
-
-
Save sperelson/3b49f2ef625e2bbf18de to your computer and use it in GitHub Desktop.
BBEdit 11 scripts to help build GoLang files and apps
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/bash | |
# Builds a Go app where the src folder is part of the default folder structure | |
# This assumes you have the app's src folder open in BBEdit and not any of the subfolders. Otherwise horrible dirname dirname won't work | |
# Setting the GOPATH may be a mistake? | |
# You may desire finer control over the output | |
# The src's folder name may not be desirable as your binary name | |
folder=$(basename "$BBEDIT_INSTAPROJECT_ROOT") | |
if [ "$folder" != "" ]; then | |
cd $(dirname `dirname "$BBEDIT_INSTAPROJECT_ROOT"`) | |
GOPATH=$(dirname `dirname "$BBEDIT_INSTAPROJECT_ROOT"`) go build -o $folder $folder | |
fi |
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/bash | |
# Builds a single .go file | |
# Setting the GOPATH may be a mistake? | |
fileext=${BB_DOC_NAME##*.} | |
if [ "$fileext" = "go" ]; then | |
cd $(dirname "$BB_DOC_PATH") | |
GOPATH=$(dirname "$BB_DOC_PATH") go build $BB_DOC_PATH | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment