Right, let’s get our hands dirty. You’ve got Go installed, which means you also got its primary delivery mechanism: the go command. This isn’t just a compiler; it’s your entire project manager, build system, dependency fetcher, and code quality enforcer, all rolled into one brutally efficient binary. Forget sprawling XML configuration files or a tower of bash scripts. The go command is the benevolent dictator of your workflow, and it has Opinions.

The Big Three: build, run, and test

These are your daily drivers. You’ll use them constantly.

go build is your workhorse. It compiles the packages named by the import paths, along with their dependencies, but it doesn’t install the results. It leaves the executable in your current directory. The genius (and sometimes frustration) is its simplicity. It doesn’t need a Makefile to know what to do. It just looks at your source code.

# Compile the package in the current directory
go build

# Compile a specific package
go build github.com/you/yourproject/cmd/yourtool

go run is the impatient cousin of go build. It compiles the code and immediately executes the resulting binary. It’s perfect for quick, one-file experiments. The catch? It’s really only meant for a single main package. Don’t try to get clever and pass it a list of packages; it will sigh at you.

# Run the main.go file in the current directory
go run main.go

# You can also pass arguments to your program!
go run main.go --help

go test is where Go’s culture of testing is baked right into the toolchain. It compiles and runs the files in your package that end in _test.go. It’s lightning fast because it’s already compiled all your dependencies. The output is satisfyingly terse: a pass/fail with a bit of narrative if things go wrong.

# Run all tests in the current package
go test

# Run tests verbosely, showing which tests are passing/failing
go test -v

# Run tests with race detector enabled (CRITICAL for concurrency)
go test -race

Your Code’s Stylist: go fmt

This might be the most important command in the entire toolchain. go fmt reformats your code to match the official, canonical Go style. This isn’t a suggestion; it’s the law. And it’s brilliant. It ends all holy wars about tabs vs. spaces, brace placement, and indentation. Before you commit code, before you push it, just run it. Your colleagues will thank you. I run it on save in my editor.

# Format all Go files in the current directory and subdirectories
go fmt ./...

The why? Consistency. You can read any Go code in the world and it will look familiar. It removes entire classes of pointless code review comments. The tool that does the actual work is gofmt, but go fmt is a convenience wrapper that runs it on packages.

Your Code’s Therapist: go vet

If go fmt is your stylist, go vet is your therapist. It doesn’t fix your problems, but it points out the ones you didn’t know you had. It examines your source code for suspicious constructs that the compiler can’t catch—things that are syntactically correct but almost certainly logically wrong.

Common things it finds: printf-style functions with arguments that don’t match the format string, incorrect string(int) conversions, unreachable code, and common misuse of mutexes.

# Vet the package in the current directory
go vet

This is non-optional. Run it. Integrate it into your editor. A clean go vet run should be a prerequisite for committing code. It’s not linters-that-shall-not-be-named level of pedantic; it’s just straightforward, accurate, “hey, you’re probably about to shoot yourself in the foot” advice.

Your Built-in Documentation: go doc

Quick, what’s the signature of time.Parse? Instead of frantically tabbing over to a browser, just ask the toolchain.

# Show documentation for a package
go doc time

# Show documentation for a specific function or type
go doc time.Parse

It’s fast, it’s offline, and it’s always accurate for the version of Go you’re using. It’s a fantastic way to quickly check the specifics of a standard library package without the cognitive overhead of a web search.

The ./… Wildcard and Why You’ll Love It

You’ll see me use ./... above. This isn’t a shell glob; it’s a special Go package wildcard that means “this directory and all packages beneath it.” It’s the standard way to run any go command (build, test, vet, fmt) across your entire project. It’s incredibly powerful and consistent.

# Run all tests in your project
go test ./...

# Vet everything
go vet ./...

# Format everything
go fmt ./...

The go command is a masterclass in tool design. It trades infinite configurability for sheer, unadulterated velocity. You might occasionally chafe against its constraints, but 95% of the time, you’ll be profoundly grateful that it just works, consistently, and quickly. Now use it.