英文:
cannot compile a test program in Go
问题
我已经将它解压到d:\
,然后创建了另一个目录d:\testgo
,在其中放置了两个文件:
代码:
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
以及用于运行编译的CMD文件:
SET PATH=%PATH%;D:\go\bin
go build test.go
@pause>nul
但是我没有得到exe文件,而是得到了以下错误信息:
test.go:3:8: import "fmt": cannot find package
package runtime: import "runtime": cannot find package
那么出了什么问题?
英文:
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 ?
答案1
得分: 3
SET GOROOT=d:\Go
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论