errors
This commit is contained in:
parent
ebcadd96c3
commit
cdcb3e1c00
26
README
26
README
@ -44,9 +44,14 @@ gobyexample.com signups
|
||||
* ruby and nodejs killer apps
|
||||
|
||||
= topics
|
||||
* gzip
|
||||
* listing files
|
||||
* regular expressions
|
||||
* time
|
||||
* connection pool
|
||||
* typed json parse/unparse
|
||||
* web app
|
||||
* gzip
|
||||
* base64 encoding
|
||||
* listing files
|
||||
* tls server
|
||||
* tls client
|
||||
* https server
|
||||
@ -57,28 +62,19 @@ gobyexample.com signups
|
||||
* http streaming client
|
||||
* http proxy
|
||||
* templating
|
||||
* web app
|
||||
* hipache port
|
||||
* templating
|
||||
* ssh
|
||||
* dns
|
||||
* timers
|
||||
* tty
|
||||
* iota
|
||||
* apps with multiple named binaries
|
||||
* versioned transitive libraries and pegging
|
||||
* creating and distributing packages, putting on github
|
||||
* distributing go binary programs
|
||||
* deploying to heroku
|
||||
* sort-by
|
||||
* errors
|
||||
* compilation
|
||||
* time
|
||||
* oauth for google domains
|
||||
* connection pool
|
||||
* typed json parse/unparse
|
||||
* testing
|
||||
|
||||
* setting up go env, hello world
|
||||
* deploying to heroku
|
||||
* distributing go binary programs
|
||||
* apps with multiple named binaries
|
||||
* shipping a package (structure, github, docs)
|
||||
|
||||
* blackfriday
|
||||
|
7
src/xx-dns.go
Normal file
7
src/xx-dns.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import ("net/dns", "fmt")
|
||||
|
||||
func main() {
|
||||
// https://github.com/miekg/dns/blob/master/ex/q/q.go
|
||||
}
|
19
src/xx-errors.go
Normal file
19
src/xx-errors.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import ("fmt"; "errors")
|
||||
|
||||
func myFun(arg int) (int, error) {
|
||||
if arg == 42 {
|
||||
return -1, errors.New("Can't work with 42")
|
||||
|
||||
}
|
||||
return arg + 3, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
r, _ := myFun(7)
|
||||
fmt.Println(r)
|
||||
|
||||
_, e := myFun(42)
|
||||
fmt.Println(e)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user