0. Prepare your github project containing go app

this is mine:

for newbee, important thing is your folder is going to be under src folder. so, there is no src or pkg folder in  github (related go structure).

if you already have $GOPATH just skip #1, 2 

1. Make some folder whatever you named, I named it "go"

$mkdir go
$cd go

2. Set gopath

go>$export GOROOT=/usr/local/go
go>$export GOPATH=`pwd`
go>$export PATH=$PATH:$GOPATH/bin

3. Login to heroku

you should install this first.

go>$heroku login

4. Get your project into this folder

go>$go get

then, whatever there is an error or not,
"go/src/" folder is created.

if you got an import like error when you "go get" then, It will be something occurred from your own module.

you should change your import path to solve this.

if you have folder and files like this,

and if chat.go imports jarvis.go, then it should be like this

import O
import ./jarvis X

4. Deploy to heroku!

go/src/>$heroku create
go/src/>$git push heroku master

if you got "reject" error something like "failed to detect set buildpack" then you should add "godep"

How to godep

$go get -u   // install

go/src/>$godep save  // make godep after this you got Godep folder

go/src/>$git add -A; git commit -am "godep added" // important! you should apply this to your github

(after this, retry git push heroku master command. It should work!)

last command

go/src/>$heroku open

'Go' 카테고리의 다른 글

How to install Golang on centos  (0) 2018.04.12
How to run go app in heroku by your own project (with github)  (0) 2017.02.24
LITE IDE setup  (0) 2015.01.28
cannot download, $GOPATH not set  (0) 2015.01.28

+ Recent posts