Re:Visual Studio Code for Go
by namelezz on Thursday March 03, 2016 @12:55PM
(#11218541)
For this extension to work, you need to install several Go tools in GOPATH. How did you manage your GOPATH across multiple projects? Do you have a single GOPATH for every project or each project has its own GOPATH?
[ Parent
| on HN ]
Re:Visual Studio Code for Go
by KyleBrandt on Thursday March 03, 2016 @12:58PM
(#11218570)
I set my GOPATH to my home dir, and only use a single GOPATH for all projects. This way things are where you might expect relative to your home dir (If thinking in FHS (https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard). For example, executables end up in ~/bin, everything else is in ~/src.
Never had any issues with this setup.
Re:Visual Studio Code for Go
by jzelinskie on Friday March 04, 2016 @12:26AM
(#11222192)
I have a single $GOPATH per project and always recommend doing so. If you vendor code with a tool like godep[0], having one shared $GOPATH is a nightmare. Other tools might work better, but this is basically the standard for the projects I work on. I basically just have a zsh alias[1] that combines z[2] and sets the $GOPATH to $PWD split on "src". I do share a single $GOBIN set to $HOME/bin, though.
[0]: https://github.com/tools/godep
[1]: https://github.com/jzelinskie/dotfiles/blob/04ad026f30782189...
Re:Visual Studio Code for Go
by KyleBrandt on Friday March 04, 2016 @10:13AM
(#11224215)
Using govendor with my stuff and a shared GOPATH. I haven't noticed an issue, I wonder what makes it a nightmare for you?
I have a similar setup, but I actually alias the go command itself so I don't have to type anything special.
Re:Visual Studio Code for Go
by schmichael on Thursday March 03, 2016 @01:41PM
(#11218897)
At work we have a monorepo and therefore a single GOPATH (we use a tool called glock for dependency pinning).
A monorepo a fantastic way to live, but I totally understand that it doesn't work for everyone.
> Do you have a single GOPATH for every project or each project has its own GOPATH?
Yes, a single GOPATH/workspace for all projects, as it is described here: https://golang.org/doc/code.html#Overview
Re:Visual Studio Code for Go
by blinkingled on Thursday March 03, 2016 @01:24PM
(#11218766)
Gaah, I thought this will provide me with some motivation to try writing some Go code but can't even get started with installing the analysis tools - cannot find package "golang.org/x/tools/go/types". Anyway will debug that one later but if anyone has a hint, go ahead.
If the automated install of the analysis tools doesn't work, you can always just manually install them into your GOPATH. See https://github.com/Microsoft/vscode-go#tools.
Re:Visual Studio Code for Go
by blinkingled on Thursday March 03, 2016 @05:56PM
(#11220716)
Thanks, but manual install fails with same error for golint and goreturns.
I ended up git cloning into my %GOPATH%\src\golang.org\x from https://go.googlesource.com/tools and https://go.googlesource.com/net - that seems to have fixed it.