joefitzgerald / go-plus

An Enhanced Go Experience For The Atom Editor
https://atom.io/packages/go-plus
Other
1.51k stars 128 forks source link

Support Strategy-Based Approach For Determining GOPATH In The Current Workspace #163

Closed hackwaly closed 5 years ago

hackwaly commented 9 years ago

https://github.com/DisposaBoy/GoSublime/blob/master/USAGE.md#per-project-settings--project-based-gopath It's useful if you want to put your projects outside of $GOPATH.

james-lawrence commented 9 years ago

https://bitbucket.org/jatone/gilo will give you this. follow the instructions.

There are instructions in the readme for the project to create the shim for the atom editor. once you've created the shim you can just go to your project directory and execute the following commands:

# only need to touch .gopath the first time.
touch .gopath
atom

only caveat is you can have only 1 project open at a time (atom attaches to the currently running process which means whatever go environment you first opened is the one you will work in)

joefitzgerald commented 9 years ago

This seems like a problem with potentially numerous solutions, each of which may be determined by the user's preferences or the state of the current package. This suits itself well to a pluggable approach which can be extended by other packages.

I plan to:

  1. Extract the core go runtime and environment detection to a separate package
  2. Add a provider model to that package for determination of GOPATH for a file or a directory
  3. Add an API to the go-runtime package that allows dependent packages (e.g. go-plus) to get at installed go's, determine the location for tool(s), install / update tool(s)
  4. Integrate go-plus with this package
  5. Auto install this package by default when you install go-plus using https://github.com/travs/atom-package-dependencies
  6. Switch to an official atom-supported approach for expressing package dependencies (over and above service-hub), when available
james-lawrence commented 9 years ago

@joefitzgerald I'll be happy to do a proof of concept integration with gilo (which supports requests for directory/filepath look ups already) for this when you have the groundwork laid out for the package depedencies.