An Overview of Important Go Commands and Flags
One of the contributing factors to Go’s popularity is its toolset that supports developer productivity.
Thegocommand has many subcommands and options to work with your go source code. It lets you build and run programs, manage dependencies, and more besides.

Getting an Overview of Go Commands and Configuration
You can view the list of available Go commands using thehelpcommand:
With no further arguments, this command lists all commands, describing what each one does. It also displays topics which are additional help pages that don’t refer directly to commands:

it’s possible to use thehelpcommand with any other Go command or topic to see an overview of what the command does:
You can use theenvcommand to view your Go environment variables:

You can use Go environment variables to reconfigure the Go runtime along with other important settings.
You can access a specific environment variable by specifying the variable name after theenvcommand. For example, to print the current value of theGOPATHvariable:

GOPATH is the root folder of a Go workspace, and other Go workspaces refer to the GOPATH. Setting the GOPATH environment is a prerequisite for using some Go packages.
By default, the GOPATH is set to$HOME/goor%USERPROFILE%\godepending on your operating system. You can change the GOPATH by adding it to the shell configuration file.

The command changes the GOPATH to the specified path.
Installing and Building Packages in Go
You’ll need to install and manage external dependencies as youwork with Go.
it’s possible to use thegetcommand to download dependencies of your packages. You’ll need to specify the resource location as an argument to thegetcommand:
These commands install the popular GORM ORM package forSQL databasesand the Cobra package for building CLIs. You can import the package in your program by specifying their resource path:
Go provides abuildcommand to build your programs. The build command compiles packages into binary executables:
The command above compiles your package into an executable in your working directory.
You can specify a path with thebuildcommand to save the executable to a specified directory.
You can use theinstallcommand to compile and install Go modules. Like thebuildcommand,installbuilds your program. But it also adds an executable package to your Go binaries in your$GOPATH/bininstallation directory.
The install command installs the packages in your working directory without additional arguments. you’re able to specify an optional resource location to install external dependencies.
This command installs the specified Go package, and you can execute the package as a command line tool.
Managing Dependencies in Go
Dependency management commands are some of the most common commands you’ll use with any language. You’ll need to download, update, and view your application’s dependencies through your development phase.
Themodcommand provides access to operations on Go modules and dependency management.
You’ll need an additional subcommand with the mod command depending on your operation.
Theinitsubcommand initializes a Go modules file in the current working directory:
On running the command, you’ll find ago.modfile in your working directory with a list of your app’s dependencies.
You can use thetidysubcommand to add missing modules and remove unused modules:
This command is useful when you have Go files and you need to download the dependencies to your package.
Thegraphsubcommand returns a list of a module’s requirements:
This command is useful for retrieving an overview of your dependencies.
You may need to check the packages and modules in your current workspace for various reasons. Thelistcommand lists all the packages and modules in a specified format.
Run this command to list all packages and modules in a workspace.
The command also lists direct and indirect dependencies in the working directory.
Go Testing Commands
Testing is another important aspect of Go development. Thetestcommand automates testing packages named by their import paths and outputs a summary of test results.
On running thetestcommand, the Go compiler checks for Go test files, runs the tests, and outputs the results. The typical naming convention for Go test files is to use a_testsuffix:
This command creates a Go test file on Unix-based systems. it’s possible to proceed to write your Go tests and run them with thetestcommand.
You don’t necessarily need additional commands or arguments to run your Go test.
Without additional parameters, thetestcommand outputs test results in this form.
The first column is the test’s status, the second is the package, and the third is the test duration.
Adding the-vflag returns a verbose output of the test results:
The-vflag returns the status of each test function along with the results of running thetestcommand without the flag.
You can calculate the test coverage of your package with the–coverflag.
The–coverflag returns the percentage of code the tests cover in your package.
you may add an optional directory parameter before the–coverflag to access the test coverage in a specific directory.
You Can Build Similar Command Line Tools in Go
Command line applications can make certain tasks much faster, particularly repetitive ones. They also tend to be more lightweight since they don’t involve more complex graphical operations.
One of the intended use cases of Go is to build performant interactive command line applications. Many popular CLI apps, from Docker to Hugo, are built in Go.
Go provides aflagspackage for building interactive CLI tools like the Go CLI in the standard library. You can use external packages like Cobra, Viper, and many others in Go’s ecosystem to build fast, interactive command line applications in Go.
Need more control over your computer? Maybe you want to improve your user efficiency? If so, you should learn to use CLI.
Don’t let aging hardware force you into buying expensive upgrades.
You’re not getting the most out of what you pay for iCloud+.
Make sure you don’t miss these movies and shows before Netflix removes them.
These are the best free movies I found on Tubi, but there are heaps more for you to search through.
Goodbye sending links via other apps.