remove number for source

This commit is contained in:
Mark McGranaghan
2012-10-07 02:00:54 -04:00
parent beaad143c4
commit 2c4dea2b8e
134 changed files with 0 additions and 0 deletions

1
src/exit/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
exit

24
src/exit/exit.go Normal file
View File

@@ -0,0 +1,24 @@
// ## Exit
// Use `os.Exit` to immediatly exit with a given
// status.
package main
import "os"
func main() {
// `defer`s will _not_ be run when using `os.Exit`, so
// this `println` will never be called.
defer println("!")
// Exit with status 3.
os.Exit(3)
}
// Note that unlike e.g. C, Go does not use an integer
// return value from `main` to indicate exit status. If
// you'd like to exit with a non-zero status you should
// use `os.Exit`.
// todo: discuss building before getting here

13
src/exit/exit.sh Normal file
View File

@@ -0,0 +1,13 @@
# If you run `exit.go` using `go run`, the exit
# will be picked up by `go` and printed.
$ go run exit.go
exit status 3
# By building and executing a binary you can see
# the status in the terminal.
$ go build exit.go
$ ./exit
$ echo $?
3
# Note that the `!` from our program never got printed.