The go get Tool
The go get
tool allows you to download and use different libraries. While Go comes with a wide range of packages by default, it is dwarfed by the number of third-party packages that are available. These provide extra functionality that you can use in your own code to enhance it. However, for your code to make use of these packages, you need to have them on your computer so that the compiler can include them when compiling your code. To download these packages, you can use the go get
tool.
Exercise 17.08: Implementing the go get Tool
In this exercise, you will learn how to download a third-party package using go get
. Let's get started:
- Create a new directory called
Exercise17.08
on your GOPATH. Within that directory, create a new file calledmain.go
. - Add the following code to the
main.go
file you created:package main import ( Â Â "fmt" Â Â "log" Â Â "net/http" Â Â "github.com/gorilla...