Giter VIP home page Giter VIP logo

go-plus's Introduction

Greenkeeper badge

An Improved Go Experience For The Atom Editor

image

Overview

This package includes the following functionality:

  • Display information about your current go installation, by running go version and go env
  • Autocomplete using gocode
  • Format your code with gofmt, goimports, or goreturns; optionally run one of these tools on save of any .go file
  • Run go install . and go test -c -o {tempdir} . to verify your code compiles and to keep gocode suggestions up to date
  • Run a variety of linters (e.g. golint, vet, etc.) against your code using gometalinter, revive or golangci-lint
  • Run tests, display test output, and display test coverage using go test -coverprofile
  • Display documentation for identifiers in source code using gogetdoc
  • Rename the symbol under your cursor using gorename
  • Go to definition using guru or godef
  • Highlight occurrences of an identifier using guru
  • Find usages of an identifier using guru

You can add debug functionality to Atom by installing the following package:

Builds

How Are The Builds Performed?

The following commands are run for the directory of the current file:

  • go install . (for normal .go files)
  • go test -o {tmpdir} -c . (for _test.go files)

Why Are You Running go install Instead Of go build?

gocode (and a few other tools, like gotype) work on .a files (i.e. the package object archive), and the way to keep these up to date is to run go install periodically. This ensures your autocomplete suggestions are kept up to date.

Platforms

The package has CI for OS X, Windows and Ubuntu.

Installing Missing Tools

If you are missing any required tools, you may be prompted to install them. You can also manually install the required tools in your terminal:

go get -u golang.org/x/tools/cmd/goimports
go get -u golang.org/x/tools/cmd/gorename
go get -u github.com/sqs/goreturns
go get -u github.com/mdempsky/gocode
go get -u github.com/alecthomas/gometalinter
go get -u github.com/mgechev/revive
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u github.com/zmb3/gogetdoc
go get -u github.com/zmb3/goaddimport
go get -u github.com/rogpeppe/godef
go get -u golang.org/x/tools/cmd/guru
go get -u github.com/fatih/gomodifytags
go get -u github.com/tpng/gopkgs
go get -u github.com/ramya-rao-a/go-outline

Having Issues?

Please consult the FAQ prior to opening an issue: https://github.com/joefitzgerald/go-plus/wiki/FAQ

If you have an issue with debugging, file an issue with go-debug here.

Maintainers

Contributors

A list of contributors can be found at https://github.com/joefitzgerald/go-plus/graphs/contributors. Thank you so much to everyone has contributed to the package ❀️. You are awesome!

Contributing

Contributions are greatly appreciated. Please fork this repository, make your changes, and open a pull request. See Contributing for detailed instructions.

go-plus's People

Contributors

danielchatfield avatar db47h avatar dependabot-preview[bot] avatar dependabot-support avatar derekperkins avatar dhaavi avatar fourcube avatar gitter-badger avatar greenkeeper[bot] avatar greenkeeperio-bot avatar greensnark avatar hansrodtang avatar joefitzgerald avatar johannweging avatar joncalhoun avatar kamilszymanski avatar lloiser avatar lukescott avatar ma314smith avatar michellescripts avatar miguel250 avatar philk avatar simurai avatar skibum55 avatar soygul avatar tucnak avatar vanackere avatar veger avatar xpressivecode avatar zmb3 avatar

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

go-plus's Issues

Feature request, yellow warning optional

I am having problems re producing this "error" but last night (I think before I downloaded 2.0.1) Go-plus was giving me yellow warnings about the fmt package.

I didn't really understand what the problem was but my go file ran just fin with go run.

I think the yellow warnings are meant to say that this is not good but it probably won't crash your code or something similar. I was wondering if it was possible make them optional to appear at the bottom window.

For example, it doesn't want me to use underscore in a package name, but going through all the source code already written just to change that is not something my team can do right now, having the yellow arrows optional might be useful. So I thought it might be useful to have this feature (maybe not).

display failed test output

Hi,

i'm not sure if this is intentional or a bug but when running go test fails there is no output of any kind only the abscensce of the coverage hints at something beeing wrong.

Would be nice to have a pane display the output. Extra awesomeness would be to parse that output to jump to where it failed.

Getting missing tools not working automatically?

I just updated to 2.0.1 and I was getting a formatting error. Go-plus said:

Format Tool Missing

How do i install the missing tools (manually at least)?

I did research that question

I did notice that this should be enabled automatically:

Defaults

By default, the package has the following preferences enabled:

...
Get Missing Tools: run go get -u on startup for all missing tools
...

I checked the settings for the package and it does I have it selected. Then, why is the gofmt not running on save then? Is it a problem with the Go-plus update?

Show Test Coverage

Overhead from @soundcloud at @gophercon, gocov looks worthy of integration.

  • Allow a single test to be run
  • Allow all tests in a package to be run
  • Allow all tests in an app or a library to be run
  • Display coverage information
  • Show a go gopher when you have awesome coverage? πŸ˜‰

Could also investigate integrating directly against go using:

  • go test -cover -coverprofile cover.out
  • go tool cover -func=cover.out

Is go-plus not suppose to analyze your code if its open on a different pane?

Is go-plus not suppose to analyze your code if its open on a different pane?

I had a different file open on a right pane and when I saved, it didn't do syntax analysis or anything like that. Is that expected behaviour?

Also, when I save only with one file, two little windows at the bottom with the same message open, even though there is only one file open. These bugs are happening only after the update to 2.0.1, not sure if I should open a new gitissue...

Format Tool Missing

Hi,

I was wondering how to resolve an issue where go-plus isn't picking up the gofmt tool. It's definitely installed and available on my system.

☁  teamstats [update-readme] which gofmt
/usr/local/go/bin/gofmt

Any ideas?

GOPATH problem in Windows

When i press Ctrl+s, i get the warning:
Warning: GOPATH [c] does not exist

My enveroment:

c:>echo %GOPATH%
C:\Users\samsung\workspace

c:>cd %GOPATH%

C:\Users\samsung\workspace>dir

14.07.2014 17:20

.
14.07.2014 17:20 ..
14.07.2014 17:20 bin
16.07.2014 12:56 pkg
16.07.2014 12:55 src

What's wrong?

find definition?

Can we get some kind of ctrl-left-elbow function for finding the definition of the identifier I have selected? like func refs, vars refs, etc?

Add 'Go To Definition' Support

It would be nice to have a keyboard shortcut / right click menu item / menu item to go to definition for the current cursor position.

Goimports removing needed import

Hey there, love this package but having a weird issue with goimports running on save and removing a needed import. When I run goimports directly from the command line I don't have this issue. See the GIF below.

goimports

GOPATH with multiple directories (possible regression)

For some reason, I can't copy the output of the go-plus error window, but it's basically telling me that my GOPATH ("/Users/mreynolds/Desktop/Projects/:/usr/local/opt/go") doesn't exist, which is correct, since it's a PATH, not a single directory.

I'm using 1.0.10 with Brew installed go. I haven't tried manually overriding my env vars in settings.

Add go lint Support

Add support for golint to display warnings (suggested by @darkhelmet).

  • Allow GOPATH to be configured in Preferences
  • Allow override of GOPATH in preferences by current environment
  • Warn when GOPATH is not set in preferences or environment
  • Add preferences for golint path and the ability to enable / disable its use
  • Execute golint
  • Collect warnings from golint
  • Display warnings alongside errors

Ensure Package Works On Windows

... Because it's pretty obvious the current package won't work due to paths and the environment.

  • Get Atom Running On Windows
  • Manually Test
  • Update Tests For Windows
  • Handle Paths Correctly
  • Set Up Windows CI

Support Debugging

Breakpoints, code stepping, the works...
That would be awesome, please.

HTML Template support

Apologies if this is covered elsewhere, I couldn't see it.

I use "gohtml" as my extension for html templates, and use [[ and ]] to delimit the template instructions to avoid clashing with Angular.

I don't want to create a new Atom package to deal with this... it'd be fantastic if go-plus could support this. Of course, it would need to understand the template library and tell me when I got a template instruction wrong.

Totally not an actual issue, just a feature request. Ignore at will, and keep up the amazing work :)

Go is not a valid go

Using Atom 0.121.0 on Mac OX 10.9 with Go 1.3. Built Go from source and installed in /usr/local/go. Set following settings:

screen shot 2014-08-14 at 2 51 38 pm

Receive this message in the console:
go [/usr/local/opt/go] is not a valid go

Go install is valid:
➜ /usr/local/opt/go/bin/go version
go version go1.3 darwin/amd64

go-plus fails to install on Atom 0.75.0

...with the following error

Installing β€œ[email protected]” failed. Less…

npm http GET https://registry.npmjs.org/fs-plus
npm http GET https://registry.npmjs.org/underscore-plus
npm http GET https://registry.npmjs.org/temp
npm http GET https://registry.npmjs.org/emissary
npm http 304 https://registry.npmjs.org/emissary
npm http 304 https://registry.npmjs.org/underscore-plus
npm http 304 https://registry.npmjs.org/temp
npm http 304 https://registry.npmjs.org/fs-plus
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/mixto
npm http GET https://registry.npmjs.org/property-accessors
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/property-accessors
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/mixto
npm http 304 https://registry.npmjs.org/graceful-fs
npm ERR! Failed resolving git HEAD (https://github.com/Benvie/harmony-collections.git) fatal: bad object e81b4b808359e2def9eeeabfdee69c2989e1fe96
npm ERR! Failed resolving git HEAD (https://github.com/Benvie/harmony-collections.git) 
npm ERR! Error: Command failed: fatal: bad object e81b4b808359e2def9eeeabfdee69c2989e1fe96
npm ERR! 
npm ERR!     at ChildProcess.exithandler (child_process.js:637:15)
npm ERR!     at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR!     at maybeClose (child_process.js:743:16)
npm ERR!     at Socket.<anonymous> (child_process.js:956:11)
npm ERR!     at Socket.EventEmitter.emit (events.js:95:17)
npm ERR!     at Pipe.close (net.js:465:12)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.1.0
npm ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/bin/node_darwin_x64" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/bin/npm-cli.js" "--userconfig" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/.apmrc" "install" "/Users/piotr/.atom/.node-gyp/.atom/.apm/go-plus/0.5.2/package.tgz" "--target=0.11.10" "--arch=x64"
npm ERR! cwd /private/var/folders/j6/mx2fn8_s555d2fcxtzdzt4540000gn/T/apm-install-dir-114222-51964-zh6vy2
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! code 128
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/folders/j6/mx2fn8_s555d2fcxtzdzt4540000gn/T/apm-install-dir-114222-51964-zh6vy2/npm-debug.log
npm ERR! not ok code 0

Put temporary files in a temporary directory.

Currently saving a file causes the tree-view to flicker because a temporary file is created and then removed. Is there any chance this file could be located in /tmp or be hidden somehow?

This is a minor detail and time is probably better spent integrating geocode but thought I should mention it while your available πŸ˜„

Error message interaction failing

With the 2.0.2 release of go-plus and atom 0.120, I seem to be unable to click on any of the error messages to navigate to that line. I assume this is due to the changes made to close issue #44.

Integrate With Godep (https://github.com/tools/godep)

This was mentioned by mrwong here earlier today, but it might not get noticed in a closed issue.

The request is to have a file (like .goplus) that defines what the GOPATH (and other env variables) are per-project. While having multiple go paths is not necessarily idiomatic, many people do use this approach. Having the option to change to a different GOPATH based on the project would be incredibly helpful.

Hide panel at startup

I think startup info (Using Go: go1.2.1 linux/amd64 (@/usr/bin/go)...) should be hidden at startup. Especially when there is no error and Show Panel When No Issues Exist is unchecked.

PS: Thanks for this nice plugin!

Issues with errors in multiple files

I noticed gofmt did not detect an obvious error in my code that is used to detect just fine. Wondering why I went around my files to see if this was the case for all my files, and in all of my files except one it said nothing. When I fixed the error in this file gofmt worked properly again in my original file.

Is there any way to let the user know if there is an error somewhere else in your project directory? Placing markers/colors in the sidebar maybe? Or is something like this not possible with how gofmt works?

Upgrading go-plus Or Disabling / Enabling It Causes Multiple Message Panels To Be Visible

Steps to reproduce:

  1. Install the go-plus package
  2. Restart Atom
  3. Save a .go file with an obvious syntax error; notice that there is only one message panel showing with any issues
  4. Open Atom Preferences
  5. Disable the go-plus package; enable the go-plus package
  6. Save the same .go file again
  7. Observe multiple message panels

I'm not sure if this is an issue with atom-message-panel or go-plus use of it.

Originally reported in #44.

Handle GOPATH With Multiple Entries (2)

#18
Does not seem be be fixed in 1.1.4

I have a composed GOPATH="/home/user/.go:/home/user/go-project" and Go-Plus seems to ignore the second. The following error occurs importing a package from the second path:

cannot find package "xyz" in any of: /opt/google/go/src/pkg/xyz (from $GOROOT) /home/user/.go/src/xyz (from $GOPATH)

in a file go-project/src/xyz/abc/file.go which imports "xyz".

Note that I need /home/user/.go to be the first element in $GOPATH because I want dependencies (with go get) and binaries to be installed there.

Enhance Autocomplete

Dependent on atom-archive/autocomplete#18, or the inclusion of some of the core autocomplete functionality in this plugin.

  • Hope the autocomplete plugin is made more extensible
  • In the meantime, determine how to override it for .go source
  • Hook into gocode using #2
  • Hook into error / warning aggregation using #3

Make Configuration For Homebrew Installed Go Seamless

We could do a better job of:

  • Detecting if a user has a brew-installed version of go
  • Alerting the user that we have found a brew-installed version of go instead of a package-installed version of go
  • Modifying defaults for a user of brew-installed go in one step

This is inspired by comments from @mreynolds.

  • Detect if go is available at /usr/local/go/bin/go (indicating package or binary installed go)
  • Detect if go is available at /usr/local/opt/go/bin/go (indicating brew-installed go)
  • Detect if go is available at C:\Go\bin\go (hello, Windows!)
  • Execute which go (except on Windows) to determine if go from the PATH is the same as a detected go
  • Execute go env and inspect values for GOROOT and GOPATH to determine the location of the go and gofmt executables
  • Display some list of detected go installations and allow the user to select one
  • Allow the user to update preferences for their selected go installation
  • Warn brew-installed users that cover needs to be manually installed
  • Warn brew-installed users that vet needs to be manually installed
  • Warn brew-installed users that godoc needs to be manually installed
  • Offer to install cover
  • Offer to install vet
  • Offer to install godoc
  • Warn when $GOPATH/bin in $PATH is not before $GOROOT/bin, if $GOROOT/bin is in $PATH

Note: This is now a mega-issue and needs to be broken up into smaller, achievable chunks.

After updating to go 1.3.1

Using Go: (@/usr/local/bin/go)
GOPATH: /Users/user/src/go
Cover Tool: Not Found
Vet Tool: Not Found
Format Tool: /Users/user/src/go/bin/goimports
Lint Tool: /Users/user/src/go/bin/golint
Oracle Tool: /Users/user/src/go/bin/oracle

Go build not working OSX

Hello,

I just installed Atom and Go Plus and it isn't allowing me to build from the command palette. It simply just does nothing. I am hitting Cmd+Shift+P and typing "go build". It finds a "Golang: Go build" command and when I select it nothing happens.

Is there something else I am supposed to be doing to build my Go code in Atom with Go Plus? Everything else works - I can confirm that gofmt and govet work fine on save.. so I can safely assume that Go Plus is finding my Go binaries fine (they are in /usr/local/go).

Any help would be great. If you need any other system information or anything let me know.

Cheers,

Simon

Go cover doesn't appear to work on Windows

I'm trying to get test coverage to work on my machine and it doesn't seem to be doing anything. I'm not getting any error messages or popups of any kind. I also don't see the temp file coverage.out that is supposed to be created, so I'm wondering if that's the culprit. I've tried running Atom in both administrator and normal modes. What's the best way to debug what's happening?

Handle GOPATH With Multiple Entries

https://code.google.com/p/go-wiki/wiki/GOPATH

Since the $GOPATH variable can be a list, the rest of this document will use $GOPATH to mean the first element unless otherwise specified.

  • Use regexp to split GOPATH if required
  • Provide array of GOPATH elements to components
  • Use first element of GOPATH when replacing $GOPATH in Gofmt Path and Golint Path preferences

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.