vscode-go | Go extension for Visual Studio Code

 by   golang TypeScript Version: v0.39.0 License: Non-SPDX

kandi X-RAY | vscode-go Summary

kandi X-RAY | vscode-go Summary

vscode-go is a TypeScript library typically used in Plugin, Visual Studio Code applications. vscode-go has no bugs, it has no vulnerabilities and it has medium support. However vscode-go has a Non-SPDX License. You can download it from GitHub.

Go extension for Visual Studio Code
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              vscode-go has a medium active ecosystem.
              It has 3426 star(s) with 690 fork(s). There are 72 watchers for this library.
              There were 2 major release(s) in the last 12 months.
              There are 312 open issues and 1944 have been closed. On average issues are closed in 60 days. There are 17 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of vscode-go is v0.39.0

            kandi-Quality Quality

              vscode-go has no bugs reported.

            kandi-Security Security

              vscode-go has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              vscode-go has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              vscode-go releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of vscode-go
            Get all kandi verified functions for this library.

            vscode-go Key Features

            No Key Features are available at this moment for vscode-go.

            vscode-go Examples and Code Snippets

            No Code Snippets are available at this moment for vscode-go.

            Community Discussions

            QUESTION

            Error loading workspace: err: exit status 1: stderr: go: updates to go.sum needed, disabled by -mod=readonly : packages.Load error
            Asked 2021-Jun-02 at 07:46

            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:45

            As 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 the go.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)

            Source https://stackoverflow.com/questions/67800641

            QUESTION

            Issue on ~/.bashrc, written file PATH is not correct
            Asked 2021-Mar-02 at 15:08

            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:44

            I 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/ , ...

            Source https://stackoverflow.com/questions/66358407

            QUESTION

            Simple Go code running straight from command line but causing "Not able to determine import path" on VS Code
            Asked 2020-Aug-25 at 12:14

            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:14

            Thanks 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

            Source https://stackoverflow.com/questions/63513324

            QUESTION

            Visual Studio Code Autocomplete Add Parentheses After Method in .js File
            Asked 2020-Jul-22 at 17:57

            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:57

            I 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.

            Source https://stackoverflow.com/questions/63038349

            QUESTION

            Debugging Go code in Visual Studio Code WSL
            Asked 2020-Apr-16 at 16:14

            I have a Visual Studio Code environment with the Linux Subsystem for windows running and it's compiling and running a Go project just fine.

            Now I'm trying to get the delve debugger running following this link:

            https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code

            But I can't get it running, neither remote nor local.

            Tried all kind of configurations in launch.json but breakpoints just arent hit and no error message is printed.

            Has anyone got go debugging running on VSCode using the WSL?

            ...

            ANSWER

            Answered 2019-Nov-08 at 07:12

            Old post, but its not possible to get delve to work on WSL

            https://github.com/go-delve/delve/issues/1235

            There was a better resource that explains fully why it doesnt work, cant find it now

            Apparently it has something to do with WSL not implementing Linux fully...but it will in WSL2!

            https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

            Source https://stackoverflow.com/questions/56868227

            QUESTION

            In VS Code (Go extension), where do I run commands?
            Asked 2020-Apr-03 at 06:01

            From here: https://github.com/Microsoft/vscode-go/wiki/GOPATH-in-the-VS-Code-Go-extension

            At any point in time, you can run the command Go: Current GOPATH to see the GOPATH being used by the extension.

            But... WHERE do I type that command?

            Is there a specific command pane I need to open or something?

            (I'm on the Mac client, if that's relevant.)

            ...

            ANSWER

            Answered 2020-Apr-03 at 06:01

            Press Shift Command P, that is the command palette.

            From there, type that command.

            But, GOPATH is a lot less important with recent Go versions that support Go modules.

            Source https://stackoverflow.com/questions/61000048

            QUESTION

            Unable to get local variables in vscode while debugging golang executable
            Asked 2020-Mar-25 at 04:13

            I create a sample project in Golang:

            ...

            ANSWER

            Answered 2020-Mar-25 at 04:13

            I could reproduce your issue initially but after I upgrade to VSCode Version 1.35.1 (I am on MacOSX), the issue is gone. I can see the variable values during debug with "Launch exec"

            I think the compiler optimisation made it problematic. Should works fine for executable built with go build -gcflags=all="-N -l"

            -N: disable optimization -l: disable inlining

            Golang officially suggested it as well: https://golang.org/doc/gdb

            Source https://stackoverflow.com/questions/56414356

            QUESTION

            Breakpoints in vscode (Win 10) "unverified" and not hit when remote debugging Go app in Linux Docker container (Hyper-V)
            Asked 2020-Mar-19 at 20:59

            I am developing a Go (1.12.0) api-server using vscode (1.34.0 insider and stable builds) for Windows 10. The source code is located on the Windows machine in the defined %GOPATH%. Delve (dlv.exe - version 1.2.0) is also installed in %GOPATH%\bin and %GOPATH%\bin is also in the Windows %PATH%.

            The go app is then built in a Docker (Docker Desktop Version 2.0.0.3 (31259)) container with docker-compose (as some other services such as Database and web-server are running in other containers). The final go app binary is then copied to an Alpine-Linux container together with the delve executable and the delve server is started in headless mode. No source code is copied over to the Alpine-Linux container, just the binaries.

            I have not managed to get remote debugging set up properly in vscode with this set-up. The debugger does start my app but any breakpoints immediately turn grey and become "unverified". They are also not hit when the app (api server) runs.

            Debugging with this set-up works perfectly (debugger starts, breakpoints can be set and are hit) when using the Goland IDE from Jetbrains for remote debugging.

            I have tried to find a solution over the last couple of days, finding forum posts with similar problems for Chrome debugging, Node.js debugging etc. and this post on Go, specifically:

            Remote debugging - Unverified breakpoint

            I also found this sample config:

            https://github.com/lukehoban/webapp-go/blob/debugging/.vscode/launch.json

            I think the main problem I had is that nowhere could I find any examples of how to properly set the path of the program in launch.json for the remote debug config on a Windows machine (nor could I find any documentation referring to this). The source code is only on the Windows machine in GOPATH, not in the final container the app and delve run in (and this, again, works fine with Goland debugger)

            My project path/directory structure (simplified):

            ...

            ANSWER

            Answered 2019-May-09 at 11:09

            I have finally found a bug report on this, so it appears to be an open bug for now. Leaving this here for anybody searching as this bug was not easy to find (for me at least).

            Source https://stackoverflow.com/questions/56037313

            QUESTION

            Golang code coverage for re-executing process?
            Asked 2020-Mar-07 at 23:34

            In order to discover Linux namespaces under certain conditions my open source Golang package lxkns needs to re-execute the application it is used in as a new child process in order to be able to switch mount namespaces before the Golang runtime spins up. The way Linux mount namespaces work makes it impossible to switch them from Golang applications after the runtime has spun up OS threads.

            This means that the original process "P" re-runs a copy of itself as a child "C" (reexec package), passing a special indication via the child's environment which signals to the child to only run a specific "action" function belonging to the included "lxkns" package (see below for details), instead of running the whole application normally (avoiding endless recursively spawning children).

            ...

            ANSWER

            Answered 2020-Mar-07 at 23:34

            After @Volker's comment on my Q I knew I had to take the challenge and went straight for the source code of Go's testing package. While @marco.m's suggestion is helpful in many cases, it cannot handle my admittedly slightly bizare usecase. testing's mechanics relevant to my original question are as follows, heavily simplified:

            • cover.go: implements coverReport() which writes a coverage data file (in ASCII text format); if the file already exists (stale version from a previous run), then it will be truncated first. Please note that coverReport() has the annoying habit of printing some “statistics” information to os.Stdout.
            • testing.go:
              • gets the CLI arguments -test.coverprofile= and -test.outputdir= from os.Args (via the flags package). If also implements toOutputDir(path) which places cover profile files inside -test.outputdir if specified.
              • But when does coverReport() get called? Simply spoken, at the end of testing.M.Run().

            Now with this knowledge under the belt, a crazy solutions starts to emerge, kind of "Go-ing Bad" ;)

            • Wrap testing.M in a special re-execution enabled version reexec.testing.M: it detects whether it is running with coverage enabled:
              • if it is the "parent" process P, then it runs the tests as normal, and then it collects coverage profile data files from re-executed child processes C and merges them into P's coverage profile data file.
              • while in P and when just about to re-execute a new child C, a new dedicated coverage profile data filename is allocated for the child C. C then gets the filename via its "personal" -test.coverprofile= CLI arg.
              • when in C, we run the desired action function. Next, we need to run an empty test set in order to trigger writing the coverage profile data for C. For this, the re-execution function in P adds a test.run= with a very special "Bielefeld test pattern" that will most likely result in an empty result. Remember, P will -- after it has run all its tests -- pick up the individual C coverage profile data files and merge them into P's.
            • when coverage profiling isn't enabled, then no special actions need to be taken.

            The downside of this solution is that it depends on some un-guaranteed behavior of Go's testing with respect to how and when it writes code coverage reports. But since a Linux-kernel namespace discovery package already pushes Go probably even harder than Docker's libnetwork, that's just a quantum further over the edge.

            To a test developer, the whole enchilada is hidden inside an "enhanced" rxtst.M wrapper.

            Source https://stackoverflow.com/questions/60458049

            QUESTION

            Installed 'Microsoft VS code' in custom directory now I can't use Go support
            Asked 2020-Jan-17 at 15:21

            I've installed Microsoft VS Code in another partition (Drive D) on my Windows 10 system. I prefer to keep Microsoft VS Code in another partition away from Windows.

            My goal is to install the GO extension from Microsoft. The link to the extension is here.

            Click here to visit the source of the repository to the go extension.

            The following error occurs when I attempt to install the GO extension through the Extension dialog in the Microsoft VS Code application.

            The Error:

            Failed to run "go env" to find GOPATH as the "go" binary cannot be found in either GOROOT(undefined) or PATH (

            C:\Windows\system32;

            C:\Windows;

            C:\Windows\System32\Wbem;

            C:\Windows\System32\WindowsPowerShell\v1.0\;

            C:\Windows\System32\OpenSSH\;

            C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;

            C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;

            C:\Users\ My username left out \AppData\Local\Microsoft\WindowsApps;

            )

            I suspect that the cause is the fact that I installed Microsoft VS Code in another partition. I've also mentioned this at the beginning of my question. I've explained the steps that I took to find the solution below:

            First I examined the location of the go resource. It seems that my resource is placed in the right folder (the folder of my installation.

            D:\Program Files\Microsoft VS Code\resources\app\extensions\go

            Than I tried a simple command through the commands by pressing ctrl+shift+p and then typing go:Current GOPATH. the error message

            command go.goroot not found

            Then I thought of testing out if I can run a basic go file. I searched for a simple example and came across this site.. So, I've created a project folder and added the file Hello.go in the folder D:\VS_Projects\GO_Helloworld Then I placed the hello world program in it. The program is shown below

            ...

            ANSWER

            Answered 2020-Jan-17 at 15:21

            The answer can be found on superuser. Also, I like to clearify why my post was originally closed according to the guidelines of stackoverflow. I Quote:

            Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming.

            I'm not sure to why the user who spotted the mistake removed his comment.

            He said: What do you mean by 'Microsoft'?

            It was helpful though. Anyway, I'll close this post now.

            Source https://stackoverflow.com/questions/59694910

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install vscode-go

            Welcome! 👋🏻 Whether you are new to Go or an experienced Go developer, we hope this extension fits your needs and enhances your development experience. You are ready to Go :-)    🎉🎉🎉. Please be sure to learn more about the many features of this extension, as well as how to customize them. Take a look at Troubleshooting and Help for further guidance. If you are new to Go, this article provides the overview on Go code organization and basic go commands. Watch "Getting started with VS Code Go" for an explanation of how to build your first Go application using VS Code Go.
            Step 1. If you haven't done so already, install Go and the VS Code Go extension. Go installation guide. This extension works best with Go 1.14+. Managing extensions in VS Code.
            Step 2. To activate the extension, open any directory or workspace containing Go code. Once activated, the Go status bar will appear in the bottom left corner of the window and show the recognized Go version.
            Step 3. The extension depends on a set of extra command-line tools. If they are missing, the extension will show the "⚠️ Analysis Tools Missing" warning. Click the notification to complete the installation.
            Go modules are how Go manages dependencies in recent versions of Go. Modules replace the GOPATH-based approach to specifying which source files are used in a given build, and they are the default build mode in go1.16+. While this extension continues to support both Go modules and GOPATH modes, we highly recommend Go development in module mode. If you are working on existing projects, please consider migrating to modules. Unlike the traditional GOPATH mode, module mode does not require the workspace to be located under GOPATH nor to use a specific structure. A module is defined by a directory tree of Go source files with a go.mod file in the tree's root directory. Your project may involve one or more modules. If you are working with multiple modules or uncommon project layouts, you will need to configure your workspace by using Workspace Folders. Please see this documentation about supported workspace layouts.

            Support

            If the extension isn't working as you expect, you can take a look at our troubleshooting guides. There is one for general troubleshooting, and another specifically for troubleshooting the debugging feature.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular TypeScript Libraries

            developer-roadmap

            by kamranahmedse

            vscode

            by microsoft

            angular

            by angular

            TypeScript

            by microsoft

            ant-design

            by ant-design

            Try Top Libraries by golang

            go

            by golangGo

            dep

            by golangGo

            groupcache

            by golangGo

            protobuf

            by golangGo

            mock

            by golangGo