During our module discussion, we discussed some go commands related to go modules, let's now discuss some other important commands.
go fmt, which formats the source code and it's enforced by that language so that we can focus on how our code should work rather than how our code should look.
$ go fmt
Next, we have
go vet which reports likely mistakes in our packages.
So, if I go ahead and make a mistake in the syntax, and then run
It should notify me of the errors.
$ go vet
Next, we have
go env which simply prints all the go environment information, we'll learn about some of these build-time variable later.
Lastly, we have,
go doc which shows documentation for package or symbol, here's an example of the format package.
$ go doc -src fmt Printf
go help command to see what other commands are available.
$ go help
As we can see, we have:
go fix finds Go programs that use old APIs and rewrites them to use newer ones.
go generate is usually used for code generation.
go install compiles and install packages and dependencies.
go clean is used for cleaning files that are generated by compilers.
Some other very important commands are
go build and
go test but we will learn about them in detail later in the course.
This article is part of my open source Go Course available on Github.
Master the fundamentals and advanced features of the Go programming language
Hey, welcome to the course, and thanks for learning Go. I hope this course provides a great learning experience.
Table of contents
What is Go?
Go (also known as Golang) is a programming language developed at Google in 2007 and open-sourced in 2009.
It focuses on simplicity, reliability, and efficiency. It was designed to combine the efficacy, speed…