more
This commit is contained in:
parent
33bbe945d5
commit
983d7f7383
45
00-notes.txt
45
00-notes.txt
@ -1,9 +1,10 @@
|
|||||||
= distribution
|
= distribution
|
||||||
* leading blog posts
|
* leading blog posts
|
||||||
* a new kind of programming book
|
* a new kind of programming book
|
||||||
* minimize text, maximize examples
|
* programmers learn by examples - minimize text, maximize code
|
||||||
* focus on working programs
|
* programmers want to ship software - focus on working programs, toolchain
|
||||||
* syntax highlighting
|
* design matters - syntax highlighting, typography
|
||||||
|
* marketing matters - twitter,
|
||||||
* select, actors, threads, and event loops
|
* select, actors, threads, and event loops
|
||||||
* small go programming examples
|
* small go programming examples
|
||||||
* newsletter
|
* newsletter
|
||||||
@ -32,3 +33,41 @@
|
|||||||
* compilation
|
* compilation
|
||||||
* ruby and nodejs stdlib
|
* ruby and nodejs stdlib
|
||||||
* ruby and nodejs killer apps
|
* 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
12
xx-args.go
Normal 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
14
xx-exec.go
Normal 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
13
xx-spawn.go
Normal 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
10
xx-users.go
Normal 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)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user