In Go, you manage dependencies as modules that contain the packages you import.
- Create a project from a GO template.
- Open a terminal and type
go mod init example.com/app
to init your Go project.
- Install dependency using the proposed search menu or install it later using the command:
go get github.com/fatih/color
- Update your code to use autoloader:
package main
import "github.com/fatih/color"
func main() {
color.Red("Prints text in red.")
}
- Tap the Run button and check out the result, or run it manually from a console with the following command:
go run app.go