DEV Community

vuong ⛈️
vuong ⛈️

Posted on

Go in VSCode: Must-have extensions and some limitations

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.


Firstly, you should ensure that you already installed all dependencies of Go to help VScode can get thing done. Read it please


Rich Go language supports for Visual Studio Code

  • 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

  • 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

Outline explorer for showing struct, methods in struct, types, functions, constants, testcases, benchmarks...

  • 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

Go Test Explorer

Go Test Explorer

Testcases explorer for project. It helps to run single test, file tests, all tests

  • 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.
// Go Outliner
go test -run ^(TestRouteGroup)$
> ?     [no test files]
Enter fullscreen mode Exit fullscreen mode

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

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

FAIL [build failed]
Error: Tests failed.
Enter fullscreen mode Exit fullscreen mode

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

Top comments (1)

devfor profile image
Devfor acgency

Devfor'll help you grow awareness, connect with your target customers and generate more sales for your business with proven marketing tactics!
how a web development agency can help your business reach new heights in 2023