Mac下golang编译出错
bogon:golang zhaoqiaohua$ go build helloworld.go
go build runtime: exec: "/Users/zhaoqiaohua/go/pkg/tool/darwin_386/8g": stat /Users/zhaoqiaohua/go/pkg/tool/darwin_386/8g: no such file or directory
在Mac下编译报错,我的golang安装包直接从 http://code.google.com/p/go下载安装的 ,哪位能帮忙看一下什么问题啊
Answers
我是使用brew 安装的,步骤如下,供你参考:
- brew install go
- brew link go
- 设置GOROOT 环境变量 //go的目录,我的目录是:/usr/local/Cellar/go/1.0.3/
- 设置GOPATH 环境变量 //任意一个有权限的目录,用来存放go 的包神马的,包放到里面的src 目录
我的:
➜ tree $GOPATH
/Users/shiweifu/go/
├── pkg
│ └── darwin_amd64
│ └── yaml.a
└── src
└── yaml
├── Makefile
├── config.go
├── config_test.go
├── doc.go
├── parser.go
├── parser_test.go
├── types.go
└── types_test.go
4 directories, 9 files
➜ ~GOROOT git:(master) ✗ tree $GOROOT -d -L 2
/usr/local/Cellar/go/1.0.3
├── api
├── bin
├── doc
│ ├── articles
│ ├── codewalk
│ ├── devel
│ ├── gopher
│ ├── play
│ └── progs
├── etc
│ └── bash_completion.d
├── lib
│ ├── godoc
│ └── time
├── misc
│ ├── IntelliJIDEA
│ ├── arm
│ ├── bbedit
│ ├── cgo
│ ├── chrome
│ ├── dashboard
│ ├── dist
│ ├── emacs
│ ├── fraise
│ ├── goplay
│ ├── kate
│ ├── notepadplus
│ ├── osx
│ ├── swig
│ ├── vim
│ └── xcode
├── pkg
│ ├── darwin_amd64
│ └── tool
├── share
│ └── zsh
├── src
│ ├── cmd
│ ├── lib9
│ ├── libbio
│ ├── libmach
│ └── pkg
└── test
├── bench
├── bugs
├── chan
├── dwarf
├── fixedbugs
├── interface
├── ken
├── safe
└── syntax
52 directories
执行:
go run a.go go build a.go