golang


Additional packages for Go programming language

Additional packages for Go that helps you write more concisely and debug more easily.

Go language main page is http://golang.org , not to be confused with this one.

Currently available packages are:

  • dump, an utility to dump Go variables, similar to PHP's var_dump

cmd, _ := exec.Run("/bin/ls", nil, nil, exec.DevNull, exec.Pipe, exec.MergeWithStdout); e == nil dump.Dump(cmd);

Outputs: &exec.Cmd { Stdin: (*os.File) nil, Stdout: &os.File { fd: 4, name: "|0", dirinfo: (*os.dirInfo) nil, nepipe: 0 }, Stderr: &<b7ec6280 os.File>, Pid: 14340 }

  • scanner, a text scanner that parses primitive types, similar to java.util.Scanner or scanf.

sc := scanner.NewScannerString("5 Anne Bob Chad Dave Egg\nHi all!"); n := sc.NextInt(); for i := 0; i < n; i++ { fmt.Printf("%d. %s\n", i+1, sc.Next()); } fmt.Println("They say:", sc.NextLine());

Outputs: 1. Anne 2. Bob 3. Chad 4. Dave 5. Egg They say: Hi all!

You are invited to report issues or contribute to this project.

Project Information

Labels:
go pkg packages dump scanner scanf golang