Skip to content

Instantly share code, notes, and snippets.

@bradylove
Last active February 23, 2016 02:25
Show Gist options
  • Save bradylove/895de952923de09dc693 to your computer and use it in GitHub Desktop.
Save bradylove/895de952923de09dc693 to your computer and use it in GitHub Desktop.

Steps to get running on heroku

  • Create your application
package main

import (
	"os"
	"net/http"
	"log"
	"fmt"
)

func main() {
	p := os.Getenv("PORT")
	if p == "" {
		p = "3000"
	}

	http.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("pong"))
	})

	log.Println(http.ListenAndServe(fmt.Sprintf(":%s", p), nil))
}
  • Create Procfile
web: app_name
  • Install and setup godep
$ go get github.com/tools/godep
$ godep save -r
  • Set heroku app & deploy
$ heroku git:remote -a go-deploy-demo 
$ git push heroku master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment