Go to Top

Installing Go in Bluehost

Start out by loging in and making sure you are in your home directory:

ssh user@domain

Next select your architecture from the Golang downloads page and download the package and uncompress it.

wget -O ~/go1.3.1.linux-amd64.tar.gz https://storage.googleapis.com/golang/go1.3.1.linux-amd64.tar.gz
tar -xvf go1.3.1.linux-amd64.tar.gz
rm go1.3.1.linux-amd64.tar.gz # Cleanup!
vi ~/.bashrc

At the bottom of your .bashrc file add

# Configuration for Go
export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin
# Go projects
export GOPATH=$HOME/goprojects
export PATH=$PATH:$GOPATH/bin

Save your .bashrc file and refresh it using source. Then make sure all the needed directories required are created.

source .bashrc
mkdir $GOPATH/src $GOPATH/bin $GOPATH/pkg
mkdir -p $GOPATH/src/github.com/$USER/hello

Now we can write our first Go script!

vi $GOPATH/src/github.com/$USER/hello/hello.go

And type in the following:

package main

import (
        "fmt"
        "net/http"
        "net/http/cgi"
)

func hello(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "Hello from Go!")
}

func main() {
        http.HandleFunc("/", hello)
        cgi.Serve(nil)
}

Next write and exit and compile the source to a cgi file located at your public web folder:

go build -o ~/public_html/hello.cgi hello.go

Now you can visit yourdomain.com/hello.cgi and go get a cup of tea to admire your first little go script.

(Reblogged from nosql)
(Reblogged from mainframed767)
"Time ain’t money if all you got is time."

- Richard M. Stallman

"Time ain’t money if all you got is time."

- Richard M. Stallman

(Source: peileppe.deviantart.com)

Mathematicians are lazy
And writers are liars.

(Source: mathprofessorquotes)

(Reblogged from identitaetsdiffusion)

Convert markdown to HTML in under 5kb with micromarkdown.js.

Or take a look at the PHP translated version.

Github | Demo