An extension for VS Code which provides support for the Go language.

Go for Visual Studio Code

Slack

An extension for VS Code which provides support for the Go language.

We have moved! 🏡 🚚 🏡

As of June 2020, our new home is https://github.com/golang/vscode-go.

For more on this, please see the below blog posts

Contributing

This project welcomes contributions and suggestions. Please go through the Contributing Guide in the new repository.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

MIT

Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
Comments
  • After upgrade to Go 1.10 intellisense autocompletion stops working

    After upgrade to Go 1.10 intellisense autocompletion stops working

    I upgraded my Go distribution to 1.10 on Windows 7/amd64 and intellisense autocompletion stopped working for my custom packages. It is working for the standard library however. I've researched and tried solutions (https://github.com/Microsoft/vscode-go/issues/441) but nothing is working. I uninstalled all the Go tools and reinstalled, didn't fix it. Eventually I complete deleted all the %APPDATA% and extensions data for VS Code, uninstalled and reinstalled and this still did not fix the problem!

    My issue is pretty much like this old one: https://github.com/Microsoft/vscode-go/issues/167

    Using the example from that issue fails to work on my setup. That is, with a custom lib package:

    package lib
    
    type T struct{}
    
    func (t T) Do() {}
    

    and the following main:

    package main
    
    import "lib"
    
    type abc struct {
    	t lib.T
    }
    
    func (a abc) do() {
    	// I have intellisense for a.t, but not for the Do function
    	a.t
    }
    

    I don't get any intellisense for the lib package. FWIW the intellisense on a.t says "invalid type".

    I kept looking into this further and eventually tried running gocode directly from the command line (both from the terminal inside VS code and a powershell window outside VS code) The thing is, this works perfectly. Here's the output I get with the exact code shown above:

    PS C:\Go\workspace\src\lib\cmd> gocode -in="main.go" autocomplete c184
    Found 1 candidates:
      func Do()
    PS C:\Go\workspace\src\lib\cmd>
    

    I thought it might be GOPATH related but I only have one GOPATH I ever use and running Go: Current GOPATH from VS Code shows the correct one.

    I'm pretty much out of ideas but I think this shows that this is vscode-go related and not gocode. Please help. Thanks!

  • Support Go modules

    Support Go modules

    Now that vgo is available (https://research.swtch.com/vgo-tour), vscode-go will ~~remove imports~~ flag errors because it doesn't understand the module (go.mod) concept, assuming you've configured golint to do that.

    Other issues will come up as well and the only workaround I can think of is disable lint modules (possibly).

    I'm putting this out there since this is something we will definitely require .

  • Can't find any of the go tools?

    Can't find any of the go tools?

    I've been trying to install the plugin and not having any success, every time I start writing anything I see notifications like:

    The 'gocode' command is not available. Use 'go get -u github.com/nsf/gocode' to install.
    

    and all the other tools it needs too. Even those these tools are in fact installed.

    I've verified $GOPATH/bin is in my $PATH and I'm running on Go 1.5.1 installed with brew.

  • You are neither in a module nor in your GOPATH in latest VSCode

    You are neither in a module nor in your GOPATH in latest VSCode

    Please direct general questions to:

    Please review the Wiki before filing an issue. Helpful pages include:

    Please answer these questions before submitting your issue. Thanks!

    What version of Go, VS Code & VS Code Go extension are you using?

    • Run go version to get version of Go
      • go1.14 darwin/amd64
    • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
      • Above command didn't work but here is the version of VS Code: Version: 1.42.1 Commit: c47d83b293181d9be64f27ff093689e8e7aed054 Date: 2020-02-11T14:44:27.652Z Electron: 6.1.6 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Darwin x64 19.3.0
    • Check your installed extensions to get the version of the VS Code Go extension
      • 0.13.1
    • Run go env GOOS GOARCH to get the operating system and processor arhcitecture details
      • Darwin/AMD64

    Share the Go related settings you have added/edited

    Run Preferences: Open Settings (JSON) command to open your settings.json file. { "go.formatTool": "goimports", "go.useLanguageServer": true, "go.buildOnSave": "off", "go.gopath":"/Users/igo/go/", "go.inferGopath": true }

    Describe the bug

    Since the last few days I keep on getting the following notification in VS code: You are neither in a module nor in your GOPATH. Please see https://github.com/golang/go/wiki/Modules for information on how to set up your Go project.

    All my code runs. I did not change anything lately. It's very annoying with the pop up non-stop reminding me of having to edit my GOPATH. Even if I create a module, I get the issue. I have uninstalled and re-installed the extension and that didn't help

    Steps to reproduce the behavior:

    1. Go to '...'
    2. Click on '....'
    3. See error

    Screenshots or recordings

    If applicable, add screenshots or recordings to help explain your problem.

  • debug broken: vscode breakpoint set but not hit

    debug broken: vscode breakpoint set but not hit

    Using the Go-latest.vsix as instructed at https://github.com/Microsoft/vscode-go/issues/1203#issuecomment-337772833 has caused my debugging not working any more -- I'm setting the break point at the first line in my main, but this is the only thing that I get (in the debug console):

    ConfigurationDoneRequest
    ContinueRequest
    ContinueResponse
    ThreadsRequest
    2017/10/28 10:46:25 debugger.go:499: continuing
    continue state {"Threads":null,"NextInProgress":false,"exited":true,"exitStatus":1,"When":""}
    TerminatedEvent
    DisconnectRequest
    

    I.e., no break points works, and I simply cannot debug any more. Not using this Go-latest at least I can still do debugging. Is there any way I can go back?

    Once again, all my own code are not under GOPATH, as I want to distinct my own code from those I get from go get. That was the reason vscode-go was confused about GOPATH before and it might still be the reason that my debugging is not working, because after carefully examine the debug console log, I saw:

    Error on CreateBreakpoint: unknown file: /path/to/repo/gitwork/src/github.com/suntong/dnstools/cmd_probe.go
    Error on CreateBreakpoint: unknown file: /path/to/repo/gitwork/src/github.com/suntong/dnstools/dnstools_main.go
    All set:[null]
    All set:[null]
    SetBreakPointsResponse
    ...
    

    However, under my normal file system, the files are just fine. E.g., both ls /path/to/repo/gitwork/src/github.com/suntong/dnstools/dnstools_main.go and file /path/to/repo/gitwork/src/github.com/suntong/dnstools/dnstools_main.go works just fine.

  •  Infinite Getting code actions from ''Go', 'Go', 'Go'' on save

    Infinite Getting code actions from ''Go', 'Go', 'Go'' on save

    image

    when i'm trying to save go files, this will appear and it is infinitely running. How can I fix this? btw, auto-completion is not working.

    Thanks for your help.

  • Debugging goes into proc.go at every step

    Debugging goes into proc.go at every step

    I'm using go modules, and every debug step into or step over goes into a proc.go file gopark function and then goes back. You can see it in this gif. https://gyazo.com/adb4a54cc467ce372a4b5595b72d150f

    Steps to Reproduce:

    Have some test and try to debug them.

    launch.json

    { "name": "Test", "type": "go", "mode": "test", "request": "launch", "remotePath": "", "port": 2346, "host": "127.0.0.1", "program": "${workspaceRoot}/test", "env": { "GOPATH": "/Users/user/golang" }, "args": ["-test.short"], "showLog": false }

  • Auto-completion doesnt when using Go modules, if the pkg hasnt been imported

    Auto-completion doesnt when using Go modules, if the pkg hasnt been imported

    Using https://github.com/stamblerre/gocode and the 0.6.90 version of this extension

    In the below case we dont get any completions.

    import (
            "rsc.io/quote"
            "fmt"
    )
    
    func main() {
            fmt.Println("hello")
            quote.
    }
    

    Update the quote. above to quote.Hello(), save the file. The next time auto-completions work

    import (
            "rsc.io/quote"
            "fmt"
    )
    
    func main() {
            fmt.Println("hello")
            quote.Hello();
            quote.
    }
    

    @stamblerre Logging this issue here for tracking purposes as your fork doesnt support logging issues

  • Unverified breakpoint

    Unverified breakpoint

    When I place a breakpoint and then run delve through the IDE, the dots turn from red to "unverified". The debugger doesn't realise that the breakpoints are even there. When I exit debugger they go red again.

    Proviso: Occasionally it works as intended when I restart computer, but once it stops working, it never starts working again until a restart (which increases the chance of it working)

  • Use WSL go environment for tools

    Use WSL go environment for tools

    I would like to have my environment set in WSL (bash.exe) and not in Windows, can vscode-go exec bash.exe before running the tools (golint, goreturns, etc) ?

    I have the following settings but doesn't appear to work:

        "terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\bash.exe",
        "terminal.external.windowsExec": "C:\\WINDOWS\\sysnative\\bash.exe",
        "go.goroot": "/usr/local/go"
    

    vscode alerts with:

    Cannot find \usr\local\go\bin\go.exe
    
  • Unverified breakpoint

    Unverified breakpoint

    From @1dnmr on June 9, 2016 13:18

    • VSCode Version: 1.2.0
    • OS Version: OS X Yosemite 10.10.5

    Steps to Reproduce:

    1. Install latest version of Visual Studio Code with all necessary extension for Go lang developing according to this article https://github.com/Microsoft/vscode-go
    2. Set breakpoint and start debugging.

    Breakpoint become grey. If point cursor on them you will see "Unverified Breakpoint" hint appears. I've searched how to fix it but nothing is helped.

    Copied from original issue: Microsoft/vscode#7475

Assembly syntax that makes you feel like you're writing code in a high-level language.

shasm Assembly syntax that makes you feel like you're writing code in a high-level language. Shasm is not an Assembler. Shasm simply compiles Shasm sy

Jun 5, 2021
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent of Code 2021 Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved

Dec 2, 2021
🎅 A programming language for Advent of Code.

?? Adventlang My blog post: Designing a Programming Language for Advent of Code A strongly typed but highly dynamic programming language interpreter w

Dec 28, 2022
Jan 4, 2022
The High Code Framework (low-code for devs)

hof - the high code framework The hof tool tries to remove redundent development activities by using high level designs, code generation, and diff3 wh

Dec 24, 2022
🎄 My code for the Advent of Code of year 2021 in Go.

Advent of Code 2021 This repository contains all code that I wrote for the Advent of Code 2021. This year I chose to try and learn Go. Enjoy! Built wi

Dec 9, 2021
CoreFoundation Property List support for Go

PACKAGE package plist import "github.com/kballard/go-osx-plist" Package plist implements serializing and deserializing of property list

Mar 18, 2022
Prometheus support for go-metrics

go-metrics-prometheus This is a reporter for the go-metrics library which will post the metrics to the prometheus client registry . It just updates th

Nov 13, 2022
Support CI generation of SBOMs via golang tooling.

Software Package Data Exchange (SPDX) is an open standard for communicating software bill of materials (SBOM) information that supports accurate identification of software components, explicit mapping of relationships between components, and the association of security and licensing information with each component.

Jan 3, 2023
Library to work with MimeHeaders and another mime types. Library support wildcards and parameters.

Mime header Motivation This library created to help people to parse media type data, like headers, and store and match it. The main features of the li

Nov 9, 2022
🏆 A decentralized layer to support NFT on Mixin Messenger and Kernel.

NFO A decentralized layer to support NFT on Mixin Kernel. This MTG sends back an NFT to the receiver whenever it receives a transaction with valid min

Aug 14, 2022
Support CI generation of SBOMs via golang tooling.
Support CI generation of SBOMs via golang tooling.

SPDX Software Bill of Materials (SBOM) Generator Overview Software Package Data Exchange (SPDX) is an open standard for communicating software bill of

Jan 3, 2023
Functional Programming support for golang.(Streaming API)

Funtional Api for Golang Functional Programming support for golang.(Streaming API) The package can only be used with go 1.18. Do not try in lower vers

Dec 8, 2021
The Bhojpur BSS is a software-as-a-service product used as an Business Support System based on Bhojpur.NET Platform for application delivery.

Bhojpur BSS - Business Support System The Bhojpur BSS is a software-as-a-service product used as an Business Support System based on Bhojpur.NET Platf

Sep 26, 2022
This is a simple chat app which shows how to use Go with Hotwire.
This is a simple chat app which shows how to use Go with Hotwire.

chat-hotwire-go This is a simple chat app which shows how to use Go with Hotwire. Messages from another user are received via Turbo Streams over a web

Jul 2, 2022
Build for all Go-supported platforms by default, disable those which you don't want.

bagop Build for all Go-supported platforms by default, disable those which you don't want. Overview bagop is a simple build tool for Go which tries to

Jul 29, 2022
Geth client which picks the most profitable blocks to mine using a greedy algorithm

Greeden-Geth Greeden-Geth is a protocol-agnostic client which uses a greedy algorithm to pick the most profitable blocks to submit to the network out

Nov 16, 2022
A limited Flow Access API which runs outside of the Flow Network using the DPS

Access API Flow DPS implements the Flow Access API Specification, except for the following endpoints: SendTransaction GetLatestProtocolStateSnapshot G

Jul 28, 2022
A bin which will keep screen open by moving a mouse

Stay Awake This is a small program which will move mouse up and down to keep screen on. This stimulates like user is doing something. Motivation I had

Oct 21, 2021