Skip to content

Instantly share code, notes, and snippets.

@TripleDogDare
Last active July 19, 2017 20:24
Show Gist options
  • Save TripleDogDare/188ee09e93ff403e573d18af762d1692 to your computer and use it in GitHub Desktop.
Save TripleDogDare/188ee09e93ff403e573d18af762d1692 to your computer and use it in GitHub Desktop.
Greenfield project initializer using go dep tool
#!/bin/bash
set -euo pipefail
[ -z "${GOPATH:-}" ] && {
>&2 echo "GOPATH must be set"
exit 1
}
# FIXME: Make less specific to this project
PROJECT_PATH='github.com/tripledogdare'
PROJECT_NAME=$(basename $PWD)
BASE_PATH="${GOPATH}/src/${PROJECT_PATH}"
FULL_PATH="${BASE_PATH}/${PROJECT_NAME}"
mkdir -p "$BASE_PATH"
TARGET=$PWD
(
cd $BASE_PATH
ln -sf "$TARGET" "$PROJECT_NAME"
)
dep init $FULL_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment