vscode-go | VS Code which provides support
kandi X-RAY | vscode-go Summary
kandi X-RAY | vscode-go Summary
An extension for VS Code which provides support for the Go language. We have moved to
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of vscode-go
vscode-go Key Features
vscode-go Examples and Code Snippets
Community Discussions
Trending Discussions on vscode-go
QUESTION
I am trying to debug one specific unit test in VSCode with breakpoints.
On the command line, this works perfectly to execute:
...ANSWER
Answered 2022-Mar-14 at 02:27Modify the "mode"
property in your launch.json
:
QUESTION
I debug Golang application with breakpoints in VS Code. Debugger complains that can't find file, which exists.
Does anyone of you know how to enable breakpoints for Go application in VS Code?
Debugger logs:
...ANSWER
Answered 2021-Oct-21 at 12:06I found the problem. VS Code doesn't handle symbolic links well. When I set up a project in VS Code in real path debugger started to work properly.
QUESTION
Ubuntu. vscode 1.62.1. go1.17.3. vscode go extension v0.29.0. delve v1.7.1.
I'm trying to a build a small app that uses Cgo, using vscode and vscode-go. Only one module imports "C".
My project structure has the root directory containing the "go.mod" and "main.go" files, and I have subpackages in subfolders. I also have "include" and "lib" directories that contain the C artifacts.
This is what I have so far in the C module:
...ANSWER
Answered 2021-Nov-12 at 09:13The C compiler is not executed in the source directory but in a temporary directory only containing intermediate files, such as your go files compiled as static libraries (.a). Therefore, the LDFLAG -Llib/linux
points to an unexisting directory.
To solve this issue, just replace that flag with -L${SRCDIR}/lib/linux
.
Directly from the cgo docs:
When the cgo directives are parsed, any occurrence of the string ${SRCDIR} will be replaced by the absolute path to the directory containing the source file. This allows pre-compiled static libraries to be included in the package directory and linked properly.
The cgo tool will always invoke the C compiler with the source file's directory in the include path; i.e. -I${SRCDIR} is always implied.
QUESTION
How can I pass test flags (e.g. the -test.v
and -test.vet=off
flags) to the test program when debugging a single test, i.e. when I use the Go: Debug Test at Cursor
functionality?
The go.testFlags
section from the workspace settings contains these settings, too - but it seems that they only have an effect when running the test (Go: Run Test at Cursor
).
I am using Visual Studio Code 1.61.2, vscode-go v0.28.1, and the dlv-dap that is auto-installed.
...ANSWER
Answered 2021-Oct-27 at 06:23The issue might come from src/goTest.ts#_testAtCursor()
QUESTION
It works well for std
module (golang/go root directory) on VSC. However it doesn't work on cmd
module (opened from src/cmd
directory). There were no code navigation, symbol search, and even any problems/errors reported.
Version info:
vscode: 1.61.0 vscode-go: v0.28.1
Installed go tools:
gopkgs go-outline gotests gomodifytags impl goplay dlv dlv-dap staticcheck gopls
...ANSWER
Answered 2021-Oct-15 at 03:25Open VSC from $WORKSPACE/go
. Follow the instruction of https://github.com/golang/tools/blob/master/gopls/doc/advanced.md#working-on-the-go-source-distribution as @hana mentioned:
Compile the Go binary. Change working directory to
$WORKSPACE/go/src
and run./make.bash
(or./make.bat
for Windows cmd). It will generate the$WORKSPACE/go/bin
directory.Set
"go.goroot"
to"${workspaceFolder}"
and install all Go tools required.
QUESTION
I'm using vscode-go extension and reading the options I see than exist the formatting.local
option but this option seems not be working Im trying to configure like this...
settings.json
...ANSWER
Answered 2021-Aug-15 at 03:41"formatting.local" is a gopls setting. https://github.com/golang/vscode-go/blob/master/docs/settings.md#settings-for-gopls So, please add it inside the "gopls"
block for now.
QUESTION
I am using VSCode and vscode-go
to develop the Go application,but, sometime, I got this error, and can't jump to the code definination
How can I get past this error message and get back all gopls features?
...ANSWER
Answered 2021-Jun-02 at 07:45As explained in golang/vscode-go
issue 1229:
The error message indicates the go.mod file is incomplete and needs update.
Check the "
PROBLEMS
" view (Ctrl+Shift+P> "Problems: Focus On Problems View
" ), find the error-level problem (probably in thego.mod
file), and either choose the Quick Fix or check the light bulb.Or, simply open the
go.mod
file and run 'go mod tidy
' using the code lens at the top of the file.
Obviously, make sure you are using the latest versions (of Go, VSCode and vscode-go, as well as gopls)
QUESTION
I am downloading Go on my Ubuntu 16.04 computer. I am following this tutorial and I can't progress from this part on youtube https://www.youtube.com/watch?v=YS4e4q9oBaU&t=1810s:
When I created that Main.go an error on VSC console shows up:
...ANSWER
Answered 2021-Feb-26 at 03:44I am guessing the error message comes from https://github.com/golang/go/blob/release-branch.go1.16/src/cmd/go/internal/modload/init.go#L207-L210
In the last line of your ~/.bashrc, you meant export GOPATH=$GOPATH:...
, not export GOPATH=$gopath:...
. Since $gopath is not set, your GOPATH would end up being :/home/santiagoquinteros/code
. The above code doesn't like it.
As others said, you don't need to set GOROOT
. With go1.16, the module mode is the default, so you probably don't need to set GOPATH
but live with the default GOPATH
which is $HOME/go
.
Many things have changed recently. I recommend newer sets of materials like https://golang.org/doc/#getting-started, https://learn.go.dev, https://play-with-go.dev/ , ...
QUESTION
It is my first time coding in Go. I am following an example and I succesfully can run the small applcation bellow. But I can't find a reason for not been ran in Visual Studio Code. So far I can see, I follow the suggestion found in this answer saying: "... Since your package is outside of $GOPATH, you may need to create a module file. You'll need to init your go module using".
go.mod
...ANSWER
Answered 2020-Aug-25 at 12:14Thanks to discussion in Go Slack (GOPHERS), someone guided me to this solution. Hopefully it can help future readers.
1 - add program and cwd as bellow to launch
QUESTION
When I type console.lo
in a .js
file in Visual Studio Code, I can hit Enter
, and autocomplete will change my line to console.log
. However, I would also like autocomplete to add parentheses. This question was already asked using the Go programming language. I tried adding js.useCodeSnippetsOnFunctionSuggest
as well as javascript.useCodeSnippetsOnFunctionSuggest
. Neither of these work. I also tried useCodeSnippetsOnMethodSuggest
as suggested here, but that didn't work either. What am I doing wrong?
ANSWER
Answered 2020-Jul-22 at 17:57I fixed this by searching for "Complete Function Calls" in VS Code's settings, and checking JavaScript > Suggest: Complete Function Calls
. Thanks Mark for the suggestion.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install vscode-go
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page