摘要:
Sometimes we'd like our Go programs to intelligently handle Unix signals. For example, we might want a server to gracefully shutdown when it receives ... 阅读全文
摘要:
In the previous example we looked at spawning external processes. We do this when we need an external process accessible to running Go process. Someti... 阅读全文
摘要:
Sometimes our Go programs need to spawn other, non-Go process. For example, the syntax highlighting on this site is implemented by spawning a pygmenti... 阅读全文
摘要:
Environment variables are a univerial mechanism for conveying configuration information to Unix programs. Let's look at how to set, get, and list envi... 阅读全文
摘要:
Command-line flags are a common way to specify options for command-line programs. For eample, in wc -l the -l is a command-line flagpackage mainimport... 阅读全文
摘要:
Command-line arguments are a common way to parameterize execution of programs. For example, go run hello.go uses run and hello.go arguments to the go ... 阅读全文
摘要:
A line filter is a common type of program that reads input on stdin, processes it, and then prints some derived result to stdout. grep and sed are com... 阅读全文
摘要:
Reading and writing files are basic tasks needed for many Go programs. First we'll look at some examples of reading filespackage mainimport ( "bufi... 阅读全文