Created
          May 12, 2015 21:00 
        
      - 
      
 - 
        
Save raggi/c26b9edd442073206021 to your computer and use it in GitHub Desktop.  
    A "pure" Heroku buildpack for Golang, uses GOPATH, no Godep. Make in a repo with files under bin/detect and bin/compile
  
        
  
    
      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 | |
| BUILD_DIR=$1 | |
| CACHE_DIR=$2 | |
| ENV_DIR=$3 | |
| GOBALL=go1.4.1.linux-amd64.tar.gz | |
| mkdir -p $CACHE_DIR | |
| export PATH=$PATH:$CACHE_DIR/go/bin | |
| build_go() { | |
| cd $CACHE_DIR | |
| if [[ ! -d go ]]; then | |
| if [[ ! -r $GOBALL ]]; then | |
| wget https://storage.googleapis.com/golang/$GOBALL | |
| fi | |
| tar zxf $GOBALL | |
| rm $GOBALL | |
| fi | |
| } | |
| build_app() { | |
| cd $BUILD_DIR | |
| export GOPATH=$BUILD_DIR | |
| # TODO: make build targets configurable from metadata | |
| go get ./... | |
| go install ./... | |
| } | |
| echo '-----> Fetching Go' | |
| build_go | |
| echo '-----> Compiling go application' | |
| build_app | 
  
    
      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 | |
| BUILD_DIR=$1 | |
| find ${BUILD_DIR}/src | grep '.go$' >/dev/null || exit 1 | |
| echo Go | |
| exit 0 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment