This commit is contained in:
Mark McGranaghan 2012-09-17 11:52:20 -07:00
parent 33bbe945d5
commit 983d7f7383
5 changed files with 91 additions and 3 deletions

View File

@ -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

12
xx-args.go Normal file
View File

@ -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)
}

14
xx-exec.go Normal file
View File

@ -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)
}
}

13
xx-spawn.go Normal file
View File

@ -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))
}

10
xx-users.go Normal file
View File

@ -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)
}