You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Choose a folder where you will be having the Go projects
Add env variable GOPATH with value as the above folder path
Create 3 folders "src", "bin" and "pkg"
Run go get github.com/golang/example/hello
Sideload the Go extension and open the folder $GOPATH/src/GitHub.com/golang/example in VS Code
Open any Go file. You will see "Analysis Tools Missing" in the status bar. Click on it to install the Go tools that the extension needs.
Fix installation when goimports is the chosen formatting tool
Make a change in any of the Go file (hello.go), format the document, ensure formatting works
Add this in the User Settings: "go.formatTool": "goimports" and repeat the above
You should see an info box pop up saying that "goimports" was not found. Ensure that the command it asks you to use is go get -v golang.org/x/tools/cmd/goimports
Click on Install
Try formatting again. This time it should work.
Fix installation in Windows when goreturns is the chosen formatting tool
If you have goreturns installed already, then delete the exe
Remove any customized setting you have for go.formatTool
Make a change in any of the Go file (hello.go), format the document
You should see an info box pop up saying that "goreturns" was not found. Ensure that the command it asks you to use is go get -v sourcegraph.com/sqs/goreturns
Click on Install
Try formatting again. This time it should work.
Add configurable flags for formatting
See PR 444 for testing steps
Use diff output from gorename to allow undo on rename operation
Rename a local variable in any Go file (hello.go), using F2 or right-click -> Rename Symbol
Rename should be a success, file should be in an unsaved state and Undo should work
Rename a function that is used across files. Ensure not all files that should be affected are open.
Rename should be a success, all affected files should be open and in unsaved state and Undo should work
Auto-complete for package names that are not imported.
Set "go.autocompleteUnimportedPackages" in user settings
Open a Go file that doesn't have the math import
Type m, the auto-complete should give math as an option. Choose this option, the word will get completed and an import to math will be added to your go file
Auto-complete for methods from packages that are not yet imported.
Set "go.autocompleteUnimportedPackages" in user settings
Open a Go file that doesn't have the math import
Type math., the auto-complete will give all methods from math package as options. Choose any, the word gets completed and an import to math will be added to your go file
Updates to running Go tests
Refer to PRs #478 and #499 to get testing steps
Generate Unit Tests
Run below commands on hello.go and ensure a hello_test.go with test skeletons gets created.
* Go: Generate unit tests for current file
* Go: Generate unit tests for current function
* Go: Generate unit tests for current package
Changes to GOROOT and GOPATH in setting take effect immediately
Remove GOPATH env var. Launch VS Code. You should see the "GOPATH" not set message in the status bar
Set GOPATH in User setting. You should be able to use all the Go extension features without needing to reload/restart VS Code
Do not allow to import already imported packages
Open hello.go and run the command Go: Add Import
Ensure the already imported packages like fmt and stringutil do not appear in the quick open
The text was updated successfully, but these errors were encountered:
Pre-requisites for testing Go extension if you don't already have Go installed and the extension set up
go get github.com/golang/example/hello
Fix installation when goimports is the chosen formatting tool
"go.formatTool": "goimports"
and repeat the abovego get -v golang.org/x/tools/cmd/goimports
Fix installation in Windows when goreturns is the chosen formatting tool
goreturns
installed already, then delete the exego.formatTool
go get -v sourcegraph.com/sqs/goreturns
Add configurable flags for formatting
See PR 444 for testing steps
Use diff output from gorename to allow undo on rename operation
Auto-complete for package names that are not imported.
math
importm
, the auto-complete should givemath
as an option. Choose this option, the word will get completed and an import tomath
will be added to your go fileAuto-complete for methods from packages that are not yet imported.
math
importmath.
, the auto-complete will give all methods frommath
package as options. Choose any, the word gets completed and an import tomath
will be added to your go fileUpdates to running Go tests
Refer to PRs #478 and #499 to get testing steps
Generate Unit Tests
Run below commands on
hello.go
and ensure ahello_test.go
with test skeletons gets created.*
Go: Generate unit tests for current file
*
Go: Generate unit tests for current function
*
Go: Generate unit tests for current package
Changes to GOROOT and GOPATH in setting take effect immediately
Do not allow to import already imported packages
hello.go
and run the commandGo: Add Import
fmt
andstringutil
do not appear in the quick openThe text was updated successfully, but these errors were encountered: