Giter Site home page Giter Site logo

microsoft / vscode-go Goto Github PK

View Code? Open in Web Editor NEW
5.9K 227.0 651.0 92.08 MB

An extension for VS Code which provides support for the Go language. We have moved to https://github.com/golang/vscode-go

License: Other

TypeScript 99.35% Shell 0.42% Dockerfile 0.24%

vscode-go's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-go's Issues

debug console scrollable horizontally, just like code

would make debugging much smoother is the debug console window was scrollable horizontally.
in a code window its nice that i can scroll easily to see long longs.

If there is a way to maybe force the debug console window to flow onto the next line that would be also good.

Some Go analysis tools are missing.....

I have Go working fine in Atom and thought I'd try VSCode. As soon as I open VSCode I see this.

a) What does it mean?
b) Do you think it should tell users what its going to install?

screen shot 2015-11-18 at 17 53 27

Analysis tool install broken

When I select "install analysis tools" it does nothing. I think the issue is

   var p = cp.exec("go get -u -v " + tool, { cwd: process.env['GOPATH'], env: process.env });  

In my case GOPATH is multi-path, therefore the cwd is invalid when running go get -u ... In this case, couldn't the cwd be left empty? Or perhaps set to the home dir if empty isn't desirable for some reason?

Add contributing and style guide

I would like to contribute and fix some of the issues but since this is a Microsoft project is there anything I need to be made aware of?

Code could be a little more consistent in style. Sometimes strings are single quoted, other times double quoted. Sometimes properties are accessed like process.env["GOPATH"], other times process.env.GOPATH.

Willing to help in any way I can to make this more awesome.

Provide feedback to user when missing Delve

Currently debugging silently fails when Delve is not installed. Since Delve requires somewhat complex installation at least on OS X we cannot install it automatically for the user, but we should identify when it is missing and provide guidance on installing it.

Go fmt on save workflow

Coming from working with Go in sublime I'm used to a workflow where every save runs go fmt. In my particular case, I also have save on loss of focus (but seems like VSCode's autosave fulfills this). That way if I switch to a terminal it is saved before I do something in the terminal.

I use this workflow in two main different ways I can think of now:

  • I've got lazy to the point where I might not even indent code when typing it, since once it saves it will fmt.
  • I use the change in formatting as a signal that there are no syntax errors in my code, because the format won't run otherwise.

So fmt as a commit hook is later than I would like in the workflow I'm used to. Is it possible to get the fmt on save workflow in VSCode as it stands? If not maybe this could be a feature? Or do you think I'm just "doing it wrong"?.

I've also seen this come up in /r/golang and it was a comment on the recent HN post: 'Awesome! Last time I tried VSC it had no gofmt-on-save functionality which I consider mandatory. Now that it does have that and much more, I'm very much looking forward to trying it again.'

could not launch process

my environment is Mac OS X and I have already signed dlv, when i click the build button, the debug console shows
2015/11/22 01:52:35 debugger.go:56: launching process with args: [./debug]
could not launch process: could not fork/exec

my launch.json is

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch main.go",
            "type": "go",
            "request": "launch",
            "program": "main.go",
            "stopOnEntry": false,
            "env": {},
            "args": [],
            "cwd": "."
        }
    ]
}

Getting error when trying to use alt+shift+f

I have my

"go.formatTool": "gofmt"

but when I try to press alt+shift+f I get:

The 'goreturns' command is not available. Use 'go get -u sourcegraph.com/sqs/goreturns' to install.

running on Mac OS X, it doesn't seem to be trying to use my setting unless alt-shift-f is strictly bound to goreturns, I can't find the keybindings anywhere. Thanks.

Add format-on-save support (instead of requiring use of explicit Format Document command)

The gopath seems to be correctly set because typing errors ('Undefined: ...') en vet messages ('exported function should have comment') are reported correctly.
However, the formatting is not corrected ? Not on disk and not in the editor. I tried to override the default goreturns with goimports and then with gofmt, but that does not seems to matter.
Any ideas ?

Oracle/guru tool integration

The Oracle tool provides a number of features which would be nice to expose in Code, including at least:

  • Callees
  • Callers
  • Implements
  • Referrers

These may be good candidates for exposing via CodeLens as well as through editor commands.

Support for multiple paths in GOPATH (especially for vendoring)

In order to provide support for dependency management tools like gb it's necessary to support colon-seperated GOPATH like this:

/home/foo/gotools:/home/foo/dev/myproject:/home/foo/dev/myproject/vendor

The Go tools are working correctly with this kind of GOPATH, but vscode-go seems to be confused (since it's simply ignoring this GOPATH).

Better error message when non-signed Delve is installed

I can

sudo dlv debug main.go

But no dice from VSCode. Any thoughts?

I did code sign dlv and all the dlv tools work as running sudo

Result

When using a main.go with a very simple 3 line program which outputs a string to stdout, a breakpoint can be set, but when running, the only feedback I get is that the debug bar shows and appears to be running, but the breakpoint isn't fired and the blue bar at the bottom of Code turns to orange.

launch.json options (args,cwd) may not effective

When I debug my go program, I want to change workdir and pass some args to program and modify launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch main.go",
            "type": "go",
            "request": "launch",
            "program": "main.go",
            "stopOnEntry": false,
            "env": {},
            "args": ["../sample"],
            "cwd": "build"
        }
    ]
}

and start debugging. But I couldn't find args is passed to it and its' work dir was different from I specified. I run ps aux|grep myprogram and got

yuntan    9879 18.5  0.3 383580 27368 ?        Sl   12:19   0:01 /home/yuntan/Workspace/go/bin/dlv debug --headless=true --listen=127.0.0.1:2345 --log /home/yuntan/Workspace/go/src/github.com/passto/myprogram/main.go
yuntan    9941  0.0  0.1 201576 11940 ?        tl   12:19   0:00 ./debug /home/yuntan/Workspace/go/src/github.com/passto/myprogram/main.go

It seems debug is debug binary of my program built by delve and vscode passes invalid argument. When I run dlv debug -- somearg in project dir and run ps aux|grep somearg I got

yuntan   14269  1.2  0.3 505404 31268 pts/4    Sl+  12:25   0:00 dlv debug -- somearg
yuntan   14329  0.0  0.1 137356 10996 pts/4    Sl   12:26   0:00 ./debug somearg

argument I specified is passed to debug binary.

VS Code 0.10.1 Go Extension 0.6.7 on Linux

Error while setting up on environment on windows 10 - Help needed

HI I have download latest version of GO, Code and vscode-go and installed it in my machine windows 10.

Here is the my user settings file.
{
"editor.fontFamily": "Consolas",
"editor.fontSize": 20,
"go.buildOnSave": true,
"go.lintOnSave": true,
"go.vetOnSave": true,
"go.formatTool": "goreturns",
"go.gopath": "F:\Data\Projects\GO\src"
}
and this is my go environment.

goenv

Now I have setup 3 folders in my go directory like following as we are doing for each go project.

goenv2

I have downloaded the all the package of go to make all the things working in go code extension. You can specially gocode and godef is already installed and available.

goenv3

The project I have opened under "F:\Data\Projects\GO\src\MyWebApp" folder where its a simple web app created in go . But whenever I tried to modify I am getting error
golint is not installed like following.

error

But if you see in above screenshots golint is already there. So am I doing anything wrong here or is there a bug in vscode. Please help me resolve this issue. This setup works fine with other editors like intellij idea or webstorm. I am getting error in vs code only.

Please suggest what's need to be there. Any help will be appreciated.

where is console output (stdout)

Hi here,
not sure it is an issue, probably more a question.
Where is the stdout console ? where we can see all the log.Print...
The logs are not in the terminal that launched VSCode
I'm on MacOSX.

Thanks
Jerome

gocode.exe does not close when VS Code exits

On Windows, gocode.exe continues to run even after VS code is completely closed. I am not sure of the behavior on other platforms. Is there a way to automatically close gocode.exe when the editor itself is exited?

"Format Code" did the import wrong

I added a fmt.Println() to a file, which should have added "fmt" to the imports. When I right-clicked "Format Code" it did this instead:

import (fmt"io/ioutil"
    "log"
    "os"
    "os/signal"
    "syscall"
)

and kind of mashed the "fmt" improperly into the beginning of the list.

Did I do it wrong? ๐Ÿ˜„ Also, can it run gofmt on save?

running the debugger against test suite

This might be a feature request but I didn't figure out how to change the launch.json config to start dlv test and debug my test suite instead of my actual code. This is very useful when writing Go libs.

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.

Extension process makes Macbook Air fan goes crazy!

From @Totoajax on November 20, 2015 17:9

Since the new update (0.10.1) my Macbook Airs fan sounds like a jet engine!!! If this isn't a bug, please make an option to disable some of the new things to make it quiet again. I REALY REALY loves Visual Code, so please fix this!

Copied from original issue: microsoft/vscode#364

Show Method Type in Symbol Browser

When using the symbol browser, I have methods that are bound to different types of the same name:

image

It would be nice to see which type each of those methods are for in that view.

Analysis Tools Missing

I get the message that the analysis tools are missing but they are certainly not; the first time I used the extension I got this message and chose Install and some missing tools were installed. The extension seems to work fine with the go analysis tools. After restarting Code, however, it's again complaining about the analysis tools. Am I missing something here?

Please advice.

Should Go tools be installed to a separate GOPATH from what user has set?

Currently, Go tools are located and acquired based on the currently active GOPATH. This has a few downsides:

  1. Go tools clutter up the users actual GOPATH even if they don't plan to use them outside of the editor
  2. For users with multiple workspaces, or with isolated GODEP setups per project, tools need to be downloaded into each of the workspaces

Instead, the plugin could automatically install these to it's own private GOPATH and use the binaries from that location. This could also allow the plugin to control versioning of these tools more precisely.

Additional feedback from offline discussion:

So if the plugin could grab them and everything just works out of the box with all these things installed, it actually might be pretty cool. It can also manage updates for those tools in a centralized place, rather than having them compiled at $GOPATH/bin of 10 different projects and eventually getting out of date independently.

Thoughts?

Format code corrupts imports

I've been working a fair bit with the plugin today and have noticed that the format code command sometimes corrupts my imports. I use "goimports" as my formatter. I've been using this for months with vim-go so I don't think it is the fault directly of goimports.

For example, I got this import

import (
   "encoding/jsonfmtio/ioutil"
)

which should have been:

import (
   "encoding/json"
   "fmt"
   "io/ioutil"
)

Optionally enable go-metalinter support?

Currently, Metalinter is extremely useful linter.
Go Vet, Go Lint and other highly useful tools are included
As it provides massaged output of composite linters, is it possible to use it as (optional) replacement/enchancement for aforementioned Vet and Lint tools?

Add support for Symbol Search

I could not get it working for any go project so far.

image

Repro:

git clone https://github.com/ahmetalpbalkan/wagl.git $HOME/gopath-wagl/src/github.com/ahmetalpbalkan/wagl
export GOPATH=$HOME/gopath-wagl
cd $HOME/gopath-wagl/src/github.com/ahmetalpbalkan/wagl
export GO15VENDOREXPERIMENT=1
code .

then โŒ˜T, type stuff, no results.

Should Find References show implementations of interfaces

I have an interface with a method on it.

That method is called in another file.

I have several files that implement or conform to that interface which have the method in them.

Should Find References show those implementations or only those where its called and defined like it does currently?

Activating extension `lukehoban.Go` failed: Cannot find module '/Users/jonathan/vscode-go/out/src/goMain'.

Following the building and debugging instructions, when I open go source files in the Exntesion Development Host I get this:

Activating extension `lukehoban.Go` failed:  Cannot find module '/Users/jonathan/vscode-go/out/src/goMain'
Here is the error stack:  Error: Cannot find module '/Users/jonathan/vscode-go/out/src/goMain'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Function.n._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/pluginHostProcess.js:18:17333)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Function.t [as __$__nodeRequire] (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:5:1298)
    at u (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/pluginHostProcess.js:12:20550)
    at t._loadPluginModule (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/pluginHostProcess.js:12:24382)
    at t.e._actualActivatePlugin (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/pluginHostProcess.js:11:29061)
    at t._actualActivatePlugin (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/pluginHostProcess.js:12:24874)

Intellisense case-sensitive?

I have a pkg called rcode contains exported constants RcodeXxxxx however if I type rcode it does not bring up autocomplete items.

image

Vs

image

Should packages be auto-imported / removed & grouped?

Just asking, because I recently moved from Atom and the go package made specifically for it does:

  • auto import core packages when they are referenced from code (+ also the 3rd party ones)
  • auto removes packages that are no longer used (currently we print error about unused one)
  • automatically groups packages (first core packages, then after blank line 3rd parties). Not sure if that works, since I am having issues with imports described in another issue.

If answer to any of these questions is Not yet, I am happy to contribute. It's quite a deal breaker for me, since after working with Atom for a couple of weeks I constantly forget about jumping onto the beginning of the file and editing that import section.

Thanks! Apart from that, all works pretty well, really happy with the autocompletion & hints.

Repository Description Seems to Have a Typo

The current description says "An extension for VS Code with provides support for the Go language."
I don't think its suppose to be "with" but rather "which".
It should read "An extension for VS Code which provides support for the Go language."

Errors always reported in currently opened file

To reproduce:

  1. Create two empty files: main.go and second.go.

  2. Launch vscode and open main.go

  3. Make main.go a minimally valid go program, e.g.:

package main

func main() {
}
  1. Save main.go

What happens: we get an error: "expected 'package', found 'EOF' in main(1,1)".

What should happen: the error message is correct but the error is in second.go (empty) file, not main.go. It looks like all errors are attributed to file that was saved (and triggered error check), not necessarily the file that contains an error.

Debugger not working, no feedback on what is wrong.

Using the instructions provided in the readme, I have installed the delve debugger on Mac and create a launch.json as in the example. However, when I start the debugging on a (working) application, nothing happens. The statusbar turns orange, but no breakpoints are hit, no output is generated. I don't get any errors, also not in the console of the developer tools.

I've updated the plugin to the latest version yesterday evening. Any advice on how to find out what exactly my problem is?

(Other than the issue I have above, my experience so far is very positive. Nice work!)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.