title: package code.google.com/p/go.example/hello: exec: "hg": executable file not found in %PATH%. How to get remote golang packages?
body: <p>I do as written an the Golang tutorial <a href="http://golang.org/doc/code.html#remote" rel="noreferrer">http://golang.org/doc/code.html#remote</a></p>
  
  <p>My env settings:</p>
  
  <pre><code>C:\sbox\go\example&gt;set go
      GOPATH=C:\sbox\go\example
      GOROOT=C:\Go
  </code></pre>
  
  <p>The <code>example/</code> folder has only <code>src/</code> folder:</p>
  
  <pre><code>C:\sbox\go\example\
               |
               --src\
  </code></pre>
  
  <p>Now I call <code>go get</code> as described and get an error:</p>
  
  <pre><code>C:\sbox\go\example&gt;go get code.google.com/p/go.example/hello
  # cd .; hg clone -U https://code.google.com/p/go.example C:\sbox\go\example\src\code.google.com\p\go.example
  package code.google.com/p/go.example/hello: exec: "hg": executable file not found in %PATH%
  </code></pre>
  
  <p>After calling <code>go get</code>, though, my <code>example/</code> folder becomes like this:</p>
  
  <pre><code>C:\sbox\go\example\
               |
               --src\
                  |
                  code.google.com\
                         |
                         --p\
  </code></pre>
  
  <p>And that's all. Nothing more installed.</p>
  
  <p>Then I add a code to my directory structure and it becomes like this:</p>
  
  <pre><code>C:\sbox\go\example\
               |
               --src\
                  |
                  ---code.google.com\
                  |        |
                  |        --p\
                  |
                  ---github.com\
                         |
                         --user\
                             |
                             --hello\
                             |   |
                             |   --hello.go
                             |
                             --newmath\
                                  |
                                  --sqrt.go
  </code></pre>
  
  <p><code>hello.go</code> is like this:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "github.com/user/newmath"
      //"code.google.com/p/go.example/newmath"
  )
  
  func main() {
      fmt.Printf("Hello, world.  Sqrt(2) = %v\n", newmath.Sqrt(2))
  }
  </code></pre>
  
  <p><code>sqrt.go</code> is like this:</p>
  
  <pre><code>// Package newmath is a trivial example package.
  package newmath
  
  // Sqrt returns an approximation to the square root of x.
  func Sqrt(x float64) float64 {
      z := 0.0
      for i := 0; i &lt; 1000; i++ {
          z -= (z*z - x) / (2 * x)
      }
      return z
  }
  </code></pre>
  
  <p>I just cope/paste them. All as written in the tutorial. Then I do <code>go install</code> and run the project. All works fine:</p>
  
  <pre><code>C:\sbox\go\example\src\github.com\user\hello&gt;go install
  
  C:\sbox\go\example\bin&gt;hello
  Hello, world.  Sqrt(2) = 1.414213562373095
  </code></pre>
  
  <p>Now I again run <code>go get</code> and get the same error:</p>
  
  <pre><code>C:\sbox\go\example&gt;go get code.google.com/p/go.example/hello
  # cd .; hg clone -U https://code.google.com/p/go.example C:\sbox\go\example\src\code.google.com\p\go.example
  package code.google.com/p/go.example/hello: exec: "hg": executable file not found in %PATH%
  </code></pre>
  
  <p>Ok, I add <code>bin/</code> directory to the PATH and run <code>go get</code> again but get the same error:</p>
  
  <pre><code>C:\sbox\go\example&gt;set PATH=%PATH%;C:\sbox\go\example\bin
  
  C:\sbox\go\example&gt;go get code.google.com/p/go.example/hello
  # cd .; hg clone -U https://code.google.com/p/go.example C:\sbox\go\example\src\code.google.com\p\go.example
  package code.google.com/p/go.example/hello: exec: "hg": executable file not found in %PATH%
  </code></pre>
  
  <p>What do I need to do get the result as described in the tutorial - remote packages are installed and I can use them?</p>