Auto-install Go package from inside Visual Studio Code

I use visual studio code write Go,

I’ve noticed that i have to run go get package-name on the terminal to install needed go packages

My source looks like below , if i import a package without running go get package-name , an error occurs

import (
"fmt"

_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
   )

Is there a plugin or extension that can automatically download go packages for me ? The only thing i need to do is to include the package in the import section of my Go file.

Is there something that is functional that i can use for that purpose ?

The Go extension of Viual Studio Code provides a command called Go: Get Package. To use it, put your input focus on an import line, open the command prompt and execute the command.

go-get-package

This will execute go get from inside Visual Studio Code.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.