Use |
|
package main
|
|
import "fmt"
import "os"
|
|
func main() {
|
|
|
defer fmt.Println("!")
|
Exit with status 3. |
os.Exit(3)
}
|
Note that unlike e.g. C, Go does not use an integer
return value from |
If you run |
$ 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 |