path/filepath package provides path manipulation functions—for example, the
filepath.Base() function returns the basename (i.e., the filename) of the given path. After outputting the message the program terminates using the
os.Exit() function and returns
1 to the operating system. On Unix-like systems a return value of
0 is used to indicate success, with nonzero values indicating a usage error or a failure.
The use of the
filepath.Base() function illustrates a nice feature of Go: When a package is imported, no matter whether it is top-level or logically inside another package (e.g.,
path/filepath), we always refer to it usi...
- 1. An Overview in Five Examples
- from Programming in Go: Creating Applications for the 21st Century
- Publisher: Addison-Wesley Professional
- Released: May 2012
poor grammar construction. First Para introduces two concepts 1. path/filepath package and 2.os.exit. They are not related. Then the second Para elaborates on path/filepath. This should be re-organized to avoid confusion . I had to read it 3 times before I could understand the two paragraphs.
Share this highlighthttp://www.safaribooksonline.com/a/programming-in-go/462078/