Skip to content

Instantly share code, notes, and snippets.

@pote
Created October 19, 2012 13:48
Show Gist options
  • Save pote/3918320 to your computer and use it in GitHub Desktop.
Save pote/3918320 to your computer and use it in GitHub Desktop.
package main
import "fmt"
import uuid "github.com/nu7hatch/gouuid"
import (
"fmt"
uuid "github.com/nu7hatch/gouuid"
)
func main() {
// *snip*
}
if vince.IsOutOfTheToilet() {
// kill the bastard!
} else {
// stay cool...
}
// WROOOONG!
if mia.IsOverdosed()
vince.ApplyAdrenalineTo(mia)
if vince, ok := people["Vince"]; !ok {
panic "Jules is dead!"
}
const foo = 1
const (
one = iota
two
three
four
)
func IDoNothingWrong() {
}
func PrintMotherfucker(something string) {
fmt.Println(something + " motherfucker!")
}
func PrintMoreMotherfuckers(one, two string, three int) {
fmt.Printf("%s, %s, %d motherfucker!\n", one, two, three)
}
func PrintAllTheThings(args ...string) {
fmt.Println(args...)
}
func IsJulesAlive() bool {
return true
}
func SayToVince(phrase string) (bool, error) {
return nil, errors.New("Vince is dead!")
}
func SayToVince(phrase string) (ok boo, err error) {
err = errors.New("Vince is dead!")
return
}
for i := 0; i < 100; i++ {
fmt.Println(i)
}
i := 0;
for i < 1000 {
fmt.Println(i)
i++
}
for name, motherfucker := range motherfuckers {
motherfucker.Kill()
fmt.Printf("%s is fucking dead\n", name")
}
var people map[string]Person
people = make(map[string]Person)
people := make(map[string]Person)
people := map[string]Person{}
jules := people["Jules"]
delete(people, "Vince")
var people []Person
people := make([]Person, 5)
dumbNumbers := []int{1,2,3,4}
len(dumbNumbers) // => 4
cap(people) // => 5
motherfuckers := people[1:3]
dumbNumbers := append(dumbNumbers, 5)
type Vince struct {
Stoned bool
}
type Stoner struct {
Stoned bool
}
type Vince struct {
Stoner
}
var vince Vince
var vince = Vince{true}
var vince = &Vince{true}
func NewVince() *Vince {
return &Vince{stoned: true}
}
var (
name string
age int = 32
)
func IDoNothingWrong() {
var name string
age := 32
// *snip*
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment