diff --git a/00-notes.txt b/00-notes.txt index d0d0691..445053d 100644 --- a/00-notes.txt +++ b/00-notes.txt @@ -1,9 +1,10 @@ = distribution * leading blog posts * a new kind of programming book - * minimize text, maximize examples - * focus on working programs - * syntax highlighting + * programmers learn by examples - minimize text, maximize code + * programmers want to ship software - focus on working programs, toolchain + * design matters - syntax highlighting, typography + * marketing matters - twitter, * select, actors, threads, and event loops * small go programming examples * newsletter @@ -32,3 +33,41 @@ * compilation * ruby and nodejs stdlib * ruby and nodejs killer apps + +* gzip +* random numbers +* sending email +* subprocesses +* listing files +* regular expressions +* json parsing/unparsing +* tls server +* tls client +* https server +* https client +* buffered io +* atomic ints +* wait group +* tcp proxy +* http streaming server +* http streaming client +* http proxy +* postgres, redis +* templating +* web app +* hipache port +* templating +* scatter-gather +* ssh +* environment variables +* dns +* timers +* url +* tty +* iota +* apps with multiple named binaries + +http://code.google.com/p/go-wiki/wiki/GithubCodeLayout +http://code.google.com/p/go-wiki/wiki/PackagePublishing +http://blog.golang.org/2012/08/organizing-go-code.html +http://golang.org/doc/code.html diff --git a/xx-args.go b/xx-args.go new file mode 100644 index 0000000..1fb98e5 --- /dev/null +++ b/xx-args.go @@ -0,0 +1,12 @@ +package main + +import ("os"; "fmt") + +func main() { + argsWithProgram := os.Args + argsWithoutProgram := os.Args[1:] + arg := os.Args[3] + fmt.Println(argsWithProgram) + fmt.Println(argsWithoutProgram) + fmt.Println(arg) +} diff --git a/xx-exec.go b/xx-exec.go new file mode 100644 index 0000000..486f141 --- /dev/null +++ b/xx-exec.go @@ -0,0 +1,14 @@ +package main + +import ("syscall"; "os"; "os/exec") + +func main() { + binary, lookErr := exec.LookPath("ls") + if lookErr != nil { + panic(lookErr) + } + execErr := syscall.Exec(binary, []string{"-a", "-l", "-h"}, os.Environ()) + if execErr != nil { + panic(execErr) + } +} diff --git a/xx-spawn.go b/xx-spawn.go new file mode 100644 index 0000000..8ad69f6 --- /dev/null +++ b/xx-spawn.go @@ -0,0 +1,13 @@ +package main + +import ("os/exec"; "fmt") + +func main() { + cmd := exec.Command("ls", "-a" "-l", "-h") + out, err := cmd.Output() + if err != nil { + panic(err) + } + fmt.Println("====== Output") + fmt.Print(string(out)) +} diff --git a/xx-users.go b/xx-users.go new file mode 100644 index 0000000..4cc3a6c --- /dev/null +++ b/xx-users.go @@ -0,0 +1,10 @@ +package main + +import ("fmt"; "os/user") + +func main() { + me, _ := user.Current() + fmt.Println(me) + root, _ := user.Lookup("root") + fmt.Println(root) +}