Becoming a GoPHPer

Paddy Foran

Software Engineer, DramaFever

@paddyforan //

I hate PHP

… is what you expect me to say.

Let’s Talk About Tribalism

What are we doing?

Please be nice

My PHP skillz are not leet.

Let’s Break This Down

Part 1

What’s Go?

Part 2

Why is Go gonna be weird?

Part 3

Why is Go gonna be great?

Part 4

Why is Go gonna be hard?

Part 1

What’s Go?

Go is C…

…if C were invented today.

(…and C had unicorns and magic…)

(…and C had decades of programming languages to pilfer shamelessly from…)

Manifests are baad.

Code should be self-documenting!

Clarity is King

Go code does exactly what it says on the page.

Write A Little, Say A Lot

Be as concise as possible without sacrificing clarity.

Automate With Tools

Go has a regular syntax that is easy to parse.

See and

“Go is not meant to innovate programming theory. It’s meant to innovate programming practice.”

Part 2

Why is Go gonna be weird?

Go is Compiled

But veeeeeery quickly.

Go is not a web language

The request is no longer your only or default context.

Go has packages

Files don’t matter, packages do.

package fmt

“main” is a special package

package main

Packages are imported

package main

import ""

We Aren’t as classy as you.

class Everything
    public $status = 'awesome!';

    public function getStatus() {
        echo 'everything is '.$this->status;
type Everything struct {
    status string

func (e Everything) GetStatus() {
    fmt.Printf("Everything is %s", e.status)

But we are more composed.

type Lego struct {
    Length int
    Width  int
type Person struct {
    Name string
type LegoPerson struct {

benny := new(LegoPerson)
benny.Length = 1
benny.Width = 2
benny.Name = "Benny"

Types are static

var thisWillAlwaysBeAString string

Initialization is not assignment

var masterBuilder bool
masterBuilder = true
batmansFavouriteColour := "black"
batmansFavouriteColour = "black and sometimes gray"

Scope is much more a thing

i := 0
for i := 0; i < 3; i++ {
fmt.Printf("outside for loop: %d", i)
outside for loop: 0

Visibility is Lexicographic

class Kragle
    public $public = 'Public';
    protected $protected = 'Protected';
    private $private = 'Private';
var ThisIsTotallyPublic string
var onlyICanSeeThis int

No, Seriously, Lexicographic

type myAwesomeType struct {
    SuperCoolAttribute string

func NewAwesomeType() myAwesomeType {
    return myAwesomeType{SuperCoolAttribute:"This is so cool!"}

Syntax Stuff

for _, x := range []string{"this", "is", "so", "cool!"} {


(Even pointers)

type Gophers struct {
    Count int

func Convert(g Gophers) {

gophers := Gophers{}

Zeroes all the way down

type Gophers struct {
    Count int

func Convert(g *Gophers) {

gophers := Gophers{}
fmt.Println(gophers.Count) // 1
fmt.Println(gophers.Count) // 2

Part 3

Why is Go gonna be great?

Our tools are pretty great

  • Bring your own code editor
  • go build, go test, go fmt, go get
  • race detector, test coverage, memory/cpu profilers…

Go is built for open source

Sharing and reusing code is a single command

import ""

Deployment is easy

Our runtime environment is the operating system

The stdlib HTTP server is production‑ready.

And really, really easy to build with.

func HandleRequest(w http.ResponseWriter, r http.Request)

Interfaces are amazing

type ThingDoer interface{
    DoTheThing() bool

type ThingDoerImplementation struct{}

func (t ThingDoerImplementation) DoTheThing() bool {
    fmt.Println("Did the thing!")
    return true

Concurrency is fun

Goroutines are “threads”

Channels let you communicate between goroutines.

You can think of channels as really lightweight queues.

func Get(url string, resp chan *http.Response, wg *sync.WaitGroup) {
    defer wg.Done()
    r, _ := http.Get(url)
    resp <- r

func WaitAndClose(wg *sync.WaitGroup, resp chan *http.Response) {
resp := make(chan *http.Response)
wg := new(sync.WaitGroup)
urls := []string{"", "",
    "", ""}

for _, u := range urls {
    go Get(u, resp, wg)

go WaitAndClose(wg, resp)

for r := range resp {

Part 4

Why is Go gonna be hard?

Static Typing

Just a new way of thinking.


We have some really good ones, but most[citation needed] Gophers just use net/http directly with a couple tools on top.

Hard to Slack Off

XKCD #303: Compiling

Next Steps

  • Go Tour:
  • Go By Example:
  • Effective Go:
  • GopherAcademy:
  • golang-nuts:
  • IRC: #go-nuts

Shameless Plug

DramaFever is hiring. Frontend, backend, whatever. Come find me, or

Thank You

I’m out of things to talk about.