Skip to content

Instantly share code, notes, and snippets.

@theharveyz
Created August 17, 2017 09:24
Show Gist options
  • Select an option

  • Save theharveyz/569956a9756cb7974a1255e70249fb07 to your computer and use it in GitHub Desktop.

Select an option

Save theharveyz/569956a9756cb7974a1255e70249fb07 to your computer and use it in GitHub Desktop.

Revisions

  1. theharveyz created this gist Aug 17, 2017.
    23 changes: 23 additions & 0 deletions go-build.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/bash
    RUN_MODE=develop
    APP_NAME=wawazu-machine-server
    SVC_NAME=$APP_NAME-$RUN_MODE
    PRJ_PATH=/data/projects/$RUN_MODE/$APP_NAME
    BIN_NAME=$APP_NAME-$RUN_MODE
    RUN_PATH=/data/GORUN/$RUN_MODE/$APP_NAME

    BUILDNO=`date '+%Y%m%d%H%M%S'`

    mkdir -p $RUN_PATH

    export GOROOT=/data/GO1.4.1
    export GOPATH=/data/projects/develop/gopath-develop
    export GOPATH=$GOPATH:$PRJ_PATH

    cd $PRJ_PATH
    $GOROOT/bin/go build -ldflags "-X main.BuildNumber=$BUILDNO" -o $PRJ_PATH/bin/$BIN_NAME "src/$APP_NAME.go"
    cd $PRJ_PATH/bin
    /usr/bin/supervisorctl stop $SVC_NAME
    cp * $RUN_PATH -Rf
    cd $RUN_PATH
    /usr/bin/supervisorctl start $SVC_NAME