- Shiva Poudel
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 in the next tutorial.
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 is pretty much it on go commands, feel free to experiment with them! And I'll see you in the next tutorial.