diff --git a/README b/README index 6723ec3..f631bcb 100644 --- a/README +++ b/README @@ -1,10 +1,4 @@ = next -get web presence in good enough shape to point to from blog post - gbe-web - basic design / brand - basic copy - sign up form - blog post on Go on Heroku write review with Keith @@ -14,10 +8,17 @@ blog post on Postgres review with Keith ship & market +get web presence in good enough shape to point to from blog post + gbe-web + basic design / brand + basic copy - landing, post-subscribe, post-confirm + subscription management + validate book style in editor validate book style in web mockup +join Google+ and claim website = vision must-have book for hackers interested in Go diff --git a/src/22-varargs.go b/src/22-varargs.go index de2c0b4..42a4434 100644 --- a/src/22-varargs.go +++ b/src/22-varargs.go @@ -1,17 +1,21 @@ + // Varadic functions can be called with any number of + // trailing arguments. + package main import "fmt" -func add(nums ...int) int { - total := 0 - for _, num := range nums { - total += num - } - return total -} - -func main() { - fmt.Println(add(1, 2, 3, 4)) - nums := []int{1, 2, 3, 4, 5} - fmt.Println(add(nums...)) +func add(nums ...int) int { // Varadic args are declared with `...type` and passed in as + for _, num := range nums { // a slice. + total += num + } + return total +} + +func main() { + fmt.Println(add(1, 2)) // Varadic functions can be called in the usual way. + fmt.Println(add(1, 2, 3, 4)) + + nums := []int{2, 3, 4, 5} // If you already have multiple args in a `slice`, apply + fmt.Println1(add(1, nums...)) // them to a varadic function using `func(arg, slice...)`. } diff --git a/www/landing.txt b/www/landing.txt index d4f945e..aaf923c 100644 --- a/www/landing.txt +++ b/www/landing.txt @@ -1,13 +1,23 @@ - + - - +--------------+ - | | - | | Your practical guide to Go. - | Go | - | by | Sign up to hear when it's ready: - | Example | [ (Your Email) ] {Go} - | | - | | - | | - +--------------+ + + + + +---------------------------------------------------------------+ + | | + | | + | | + | +--------------+ | + | | | | + | | | Your practical guide to Go. | + | | Go | | + | | by | Get updates about the book: | + | | Example | [ (Your Email) ] {Subscribe} | + | | | | + | | | | + | | | | + | +--------------+ | + | | + | | + | | + +---------------------------------------------------------------+ +