Powerful Command-Line Applications in Go (Pragmatic Bookshelf)

PragmaticBookshelf
Go is a modern programming language that combines the reliability of compiled languages with the ease of use and flexibility of dynamic typed languages. With Go, you can develop cross-platform command-line tools that are fast and reliable. Work through practical examples to develop elegant and efficient tools by applying Go’s rich standard library, its built-in support for concurrency, and its expressive syntax. Use Go’s integrated testing capabilities to automatically test your tools, ensuring they work reliably even across code refactoring.

Ricardo Gerardi @rgerardi

edited by Brian P. Hogan @bphogan

Go is a modern programming language that combines the reliability of compiled languages with the ease of use and flexibility of dynamic typed languages. With Go, you can develop cross-platform command-line tools that are fast and reliable. Work through practical examples to develop elegant and efficient tools by applying Go’s rich standard library, its built-in support for concurrency, and its expressive syntax. Use Go’s integrated testing capabilities to automatically test your tools, ensuring they work reliably even across code refactoring.

Develop CLI tools that interact with your users by using common input/output patterns, including environment variables and flags. Handle files to read or persist data, and manipulate paths consistently in cross-platform scenarios. Control processes and handle signals, and use a benchmark driven approach and Go’s concurrency primitives to create tools that perform well. Use powerful external libraries such as Cobra to create modern and flexible tools that handle subcommands, and develop tools that interact with databases, APIs, and network services. Finally, leverage what you learned by tackling additional challenges at the end of each chapter.


  • Full details: Search
  • View this book’s portal and details on how to post errata and suggestions here.

Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:

Latest Threads About This Book Top

New
Siarhei
Tests on compare 2 slice of byte fail because there is a difference in the formatting we get after the parseContent() and goldenFile func...
New
bradleyscollins
@rgerardi Problem As I am working my way through the book today in August of 2024, it appears that blackfriday (v2.1.0) no longer works....
New
Chris-AF
The file produced by os.WriteFile() on Windows is not CRLF, but the golden file is very likely CRLF because Windows. Until the reader man...
New
outofphase
The book says “we instruct the scanner to read words instead by setting the Split() function of the scanner”. But what is really done is ...
New
outofphase
The book states “Upon initializing a new module, Go creates a file go.mod in the root of your module directory” but, at least in Go 1.20...
New
realtebo
@rgerardi Title: Name of book: description (page number) Powerful Command-Line Applications in Go (page 9) I am using Windows to devel...
New
crumdev
When creating the first cli client for the Todo api,the working file is hardcoded as “.todo.json”. In the main_test.go users are never in...
New
CasualPyDev
@rgerardi Title: Powerful Command-Line Applications in Go (page 35 - ebook edition) Integration test fails do to a superfluous blank in...
New
adamwoolhether
In func TestLoadNoFile , we create a temp file, delete it, and try to load it. The test is incorrectly written to expect a nil error whe...
New

Most Active This Week Top

Most Active This Month Top

Most Active This Year Top

Chris-AF
The file produced by os.WriteFile() on Windows is not CRLF, but the golden file is very likely CRLF because Windows. Until the reader man...
New
bradleyscollins
@rgerardi Problem As I am working my way through the book today in August of 2024, it appears that blackfriday (v2.1.0) no longer works....
New
Siarhei
Tests on compare 2 slice of byte fail because there is a difference in the formatting we get after the parseContent() and goldenFile func...
New
New

Most Active Last Three Years Top

CasualPyDev
@rgerardi Title: Powerful Command-Line Applications in Go (page 35 - ebook edition) Integration test fails do to a superfluous blank in...
New
crumdev
When creating the first cli client for the Todo api,the working file is hardcoded as “.todo.json”. In the main_test.go users are never in...
New
outofphase
The book says “we instruct the scanner to read words instead by setting the Split() function of the scanner”. But what is really done is ...
New
realtebo
@rgerardi Title: Name of book: description (page number) Powerful Command-Line Applications in Go (page 9) I am using Windows to devel...
New
outofphase
The book states “Upon initializing a new module, Go creates a file go.mod in the root of your module directory” but, at least in Go 1.20...
New

Most Active Over Three Years Top

PragmaticBookshelf
Go is a modern programming language that combines the reliability of compiled languages with the ease of use and flexibility of dynamic t...
New
rgerardi
Hello all. Creating this space here for general discussion and chat about Powerful Command-Line Applications In Go In particular, we ca...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
pragmoose
Title: Powerful Command Line Applications In Go (page 6) The comment in the update count func reads // A scanner is used to read text...
New
ludofischer
In chapter 8, Talking to REST APIs, section Testing the REST API Server, the following snippet in server_test.go triggers a warning from ...
New
pragmoose
Title: Powerful command line applications in Go (page 13) A method is a function that is associated to an specific type. “an specific”
New
msmagnanijr
Title: Powerful Command Line Applications in Go “CHAPTER 1 - Your First Command-Line Program in Go/Adding Command-Line Flags” there is ...
New
donncha
Paragraph 3. Before you can use these external packages in your program, you need to install them in your local machine. In Go, you inst...
New
keithmedlin
flags.Usage is introduced on page 32. On Page 35, if the reader leaves that code in their application, the ListTasks test will fail becau...
New
pragmoose
Title: Name of book: Powerful Command Line Applications in Go (page 7) Could you put the update to TestCountWords before the new TestCou...
New
New
New
matt4biz
Powerful Command-Line Applications in Go by @rgerardi (pp. 385-387) You might want to mention modernc.org/sqlite as an alternative that ...
New
danielithomas
Title: Powerful Command-Line Aplications in Go (page xiii) small typo in description of Chapter 9 Example: “You’ll external packages to ...
New
telemachus
@rgerardi On a later page, the author writes “Before running the tests, delete the file .todo.json if it exists from a previous test or ...
New

Get money off!

The Pragmatic Bookshelf

35% off any eBook

Simply use coupon code "devtalk.com" at checkout. See full details here.