Organizing Your Code
Before you start developing command-line tools, let’s talk a little about how to organize your code. Go is a relatively new programming language, so the community is still discussing different approaches for structuring Go programs. This section presents a common approach for developing command-line tools.
As you learned in Building the Basic Word Counter, Go programs are composed of packages, which consist of one or more Go source code files that can be combined into executable programs or libraries. To create an executable program, you define a package named main which contains a function named main that serves as the entry point for your executable program.
For this tool you’ll use another common Go pattern to create ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access