rsk82
rsk82

Reputation: 29387

cannot compile a test program in Go

compiler: http://code.google.com/p/go/downloads/detail?name=go1.0.3.windows-386.zip&can=2&q=

I've unpacked it to d:\, then made another directory d:\testgo, where I put two files:

The code:

package main
import "fmt"

func main() {
  fmt.Println("Hello world!")
}

and the CMD file to run the compilation:

SET PATH=%PATH%;D:\go\bin
go build test.go
@pause>nul

And I got no exe but this:

test.go:3:8: import "fmt": cannot find package
package runtime: import "runtime": cannot find package

So what went wrong ?

Upvotes: 1

Views: 307

Answers (1)

lukad
lukad

Reputation: 17863

The documentations says the following:

If you chose a directory other than c:\Go, you must set the GOROOT environment variable to your chosen path.

SET GOROOT=d:\Go should do it.

Upvotes: 3

Related Questions