| 10 | ) |
| 11 | |
| 12 | func main() { |
| 13 | // package os, fmt |
| 14 | fmt.Println("stdin: ", os.Stdin.Name()) |
| 15 | fmt.Println("stdout:", os.Stdout.Name()) |
| 16 | fmt.Println("stderr:", os.Stderr.Name()) |
| 17 | |
| 18 | // Package syscall, this mostly checks whether the calls don't trigger an error. |
| 19 | syscall.Getuid() |
| 20 | syscall.Geteuid() |
| 21 | syscall.Getgid() |
| 22 | syscall.Getegid() |
| 23 | syscall.Getpid() |
| 24 | syscall.Getppid() |
| 25 | |
| 26 | // package math/rand |
| 27 | fmt.Println("pseudorandom number:", rand.New(rand.NewSource(1)).Int31()) |
| 28 | |
| 29 | // package strings |
| 30 | fmt.Println("strings.IndexByte:", strings.IndexByte("asdf", 'd')) |
| 31 | fmt.Println("strings.Replace:", strings.Replace("An example string", " ", "-", -1)) |
| 32 | |
| 33 | // package time |
| 34 | time.Sleep(time.Millisecond) |
| 35 | time.Sleep(-1) // negative sleep should return immediately |
| 36 | time.LoadLocation("UTC") |
| 37 | |
| 38 | // Exit the program normally. |
| 39 | os.Exit(0) |
| 40 | } |