Does GO GET require to install git on Windows?

8,840 views
Skip to first unread message

Fred Janon

unread,
Aug 9, 2012, 12:39:42 PM8/9/12
to golang-nuts
Hi,

I am trying to install gocode and I get this error:

C:\Users\Fred>go get -u github.com/nsf/gocode
# cd .; git clone https://github.com/nsf/gocode C:\Go\src\pkg
\github.com\nsf\gocode
package github.com/nsf/gocode: exec: "git": executable file not found
in %PATH%

Which indicates that I need to install git. I don't see any reference
anywhere in the GoLang install instructions that git is required.

Is git really required?

Note: I had the go-gae SDK installed before I installed go with the
installer. I removed the gae path from the path before running the go
get command.

C:\Users\Fred>go version
go version go1.0.2

C:\Users\Fred>path
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:
\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:
\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows
\System32\WindowsPowerShell\v1.0\;C:\Program Files\ThinkPad\Bluetooth
Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:
\Program Files (x86)\Common Files\Lenovo;C:\Program Files (x86)\Common
Files\Ulead Systems\MPEG;C:\Program Files (x86)\Windows Live\Shared;C:
\SWTOOLS\ReadyApps;C:\jdk1.6.0_31\bin;C:\XgoogleappenginegoX\;C:\Go
\bin

Thanks

Fred

Patrick Mylund Nielsen

unread,
Aug 9, 2012, 12:44:00 PM8/9/12
to Fred Janon, golang-nuts
git isn't "required" by go get, but it's used to clone git repositories. Similarly with Mercurial (hg) and Subversion for Bitbucket/Google Code repos.

I think implementing these barebones proto in Go have been suggested a few times, but IMO it would be a major pain for very little gain.

You can get git set up and in your path quickly and easily with http://windows.github.com/ 

Fred Janon

unread,
Aug 9, 2012, 12:59:04 PM8/9/12
to Patrick Mylund Nielsen, golang-nuts
Thanks for the quick answer.

I installed git, svn and mercurial before, I just think that everything required should be mentioned in the install guide. Actually it looks like git the git protocol is supported by go get. Nothing mentions git or hg or svn as launched external commands.

Fred

Carlos Castillo

unread,
Aug 10, 2012, 4:44:31 AM8/10/12
to golan...@googlegroups.com, Patrick Mylund Nielsen
We should always endeavour to make the go installation instructions (http://golang.org/doc/install) as concise as possible. Adding extra instructions on how to find, get, install, and setup version control tools to allow users to access external code repositories would only serve to complicate the installation procedure with little gain and and the potential to drive away potential new users with instructions about features they will not use for some time (if ever).

These tools can be installed at any time with respect to the installation of go, the only time a given tool is "required", is on an invocation to go get that needs to fetch a repository that doesn't exist locally. For users familiar at all with the command line, and who have even the slightest idea what git/hg/bzr/svn are for should be able to figure out what needs to be done from the error message 'exec: "git": executable file not found 
in %PATH%'

However since we do need to support Windows and other Command Line Illiterate users, however, there are opportunities to improve the documentation. For example:
  1. The "What's Next" section of the installer instructions (http://golang.org/doc/install#next) could have a link to an article about using go get, or the documentation for go get
  2. The Documentation for go get (go help get, go help remote) could be more explicit about needing external tools
  3. The Error message given by go get could be friendlier and tell the user what to do, or direct them to the appropriate doc
There might be some value also in providing a feature for go get, exposed by a flag (ie: not a default), which attempts to download the code through alternate (go native) means. Many code hosting sites like github provide the ability to download repositories as zip files or compressed tarballs using HTTP, both operations (download from HTTP, extract zip/tgz/tbz2) which are natively supported by go. Since there's already logic in place to recognize the URLs for these repositories it might not be too difficult to hook in behaviour to achieve this. This would be a benefit to all users who don't have the appropriate VCS installed, and would probably be more manageable, albeit less useful in general, than adding git/hg/svn/bzr support to go, since it would be a less complicated target (which generally moves less). This change could also accompany a documentation and/or error message modification to make the situation more obvious.

Jan Mercl

unread,
Aug 10, 2012, 5:01:44 AM8/10/12
to Carlos Castillo, golan...@googlegroups.com, Patrick Mylund Nielsen
On Fri, Aug 10, 2012 at 10:44 AM, Carlos Castillo <cook...@gmail.com> wrote:
However since we do need to support Windows and other Command Line Illiterate users, however, there are opportunities to improve the documentation.

These docs are, AFAICS, for developers. "Command Line Illiterate users" are mutually exclusive with "developers", I believe and hope (across all of the supported OS).

-j

Carlos Castillo

unread,
Aug 10, 2012, 8:40:35 AM8/10/12
to golan...@googlegroups.com, Patrick Mylund Nielsen
Unfortunately, simply making that assumption doesn't prevent the complaints. Better documentation could.

AFAIK, the only place where it is explicitly stated that go get uses an external git command, is in the error message. No documentation about go get that I could readily find stated explicitly that it needed git to be installed to access git repositories, so it wasn't possible to respond with RTFM <link>.

I'm sorry if my playful jab made my reply harder to parse, I probably should have left it out.

val...@emotorwerks.com

unread,
Nov 19, 2014, 8:03:11 PM11/19/14
to golan...@googlegroups.com, pat...@patrickmylund.com
this kind of arrogant BS is why a lot of people are on the fence about using google solutions...

aaronzim...@gmail.com

unread,
Jan 14, 2015, 7:51:08 PM1/14/15
to golan...@googlegroups.com, pat...@patrickmylund.com
I am a new user to Golang. I read here that when installing a new package the dependencies are also installed but I found this wasn't the case and only after confusion and googling around did I learn that I had to install extra things.

Dave Cheney

unread,
Jan 14, 2015, 8:12:49 PM1/14/15
to golan...@googlegroups.com, pat...@patrickmylund.com, aaronzim...@gmail.com
If the section on remote packages were amended to mention something along the lines of "to download packages stored on remote code hosting services like github you may also need to install DVCS tools like git or mercurial", would that suffice ?

Benjamin Measures

unread,
Jan 16, 2015, 2:58:45 PM1/16/15
to golan...@googlegroups.com, pat...@patrickmylund.com, aaronzim...@gmail.com
On Thursday, 15 January 2015 00:51:08 UTC, aaronzim...@gmail.com wrote:
I am a new user to Golang. I read here that when installing a new package the dependencies are also installed

Note the term "dependencies" as used here refers to "source-code package dependencies" and not tooling dependencies.

but I found this wasn't the case and only after confusion and googling around did I learn that I had to install extra things.

If a command is missing it'll print error:
go: missing %s command. See http://golang.org/s/gogetcmd

Linked resource explains what's needed quite clearly. I don't think there's much more to be said.

Reply all
Reply to author
Forward
0 new messages