Go in VSCode: Must-have extensions and some limitations
Tags: go, vscode
Published: 2019-10-18 05:35:56


If you want to be the best on VSCode instead use Goland, you can try!

But, please keep in your mind that you're trying to use VSCode, an open-source software, it might be unstable/not really optimal/not really minimalistic in some cases, and you get it free and you can contribute for helping a lot of developers in the world do the development process better.


## Dependencies

Firstly, you should ensure that you already installed all dependencies of Go to help VScode can get thing done. Read it please https://github.com/Microsoft/vscode-go/wiki/Go-tools-that-the-Go-extension-depends-on

## Go

Rich Go language supports for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go

- After installed, VSCode will notify all needed dependencies, then just click on Install button.

- If the notification was not shown, please take a look on this one and install it manually https://github.com/Microsoft/vscode-go/wiki/Go-tools-that-the-Go-extension-depends-on

- Note: *gometalinter* will be deprecated in future, so it should be an optional. The alternative is *golangci-lint*, take a look in their github to see how to setting up it.

- Otherwise, let's go to extension description, it explained well about many things you're needing for make your deveploment process works smoothly.

## Go Outliner

![Go Outliner](https://github.com/766b/vscode-go-outliner/raw/master/images/preview.png)

Outline explorer for showing struct, methods in struct, types, functions, constants, testcases, benchmarks...
https://marketplace.visualstudio.com/items?itemName=766b.go-outliner

- Although, VSCode explorer has its own outliner, it has the limitation that you couldn't get full of list struct methods when you seeing in a specific file of Go package.

- I wish I can disable temporarily Testing explorer of Go Outliner! You can see the reason in the next extension! And I assume that I could remove Go Outliner when this issue is closed https://github.com/microsoft/vscode-go/issues/2370 

## Go Test Explorer

![Go Test Explorer](https://github.com/ppparihar/gotestexplorer/raw/master/media/gotest.gif)

Testcases explorer for project. It helps to run single test, file tests, all tests
https://marketplace.visualstudio.com/items?itemName=premparihar.gotestexplorer

- But, wait, I've installed Go Outliner and isn't it enough?
> Yes! **Go Outliner** is actually doing testing unwell. The execution of testing feature in Go Outliner provided wrong command, then it can't found my tests.


```cmd
// Go Outliner
go test -run ^(TestRouteGroup)$
> ?       github.com/myproject     [no test files]
```

Meanwhile, Go Test Explorer providing the right path, so the test can be completed with the result. That's all.


```cmd
// Go Test Explorer
/Users/MY_USERNAME/.gvm/gos/go1.12.5/bin/go test -timeout 30s github.com/myproject/controllers/event -run ^(TestRouteGroup)$ -count=1 -coverprofile=/var/folders/b9/fc04ql552lg3wf_rtsdnqvnc0000gq/T/vscode-goMGfN9Z/go-code-cover

FAIL	github.com/myproject/controllers/event [build failed]
Error: Tests failed.
```

If **Go Outliner** fixed this error, then I would say that Go Test Explorer might be removed on my VSCode for simplicity.