duanpiyao2734 2015-07-27 21:36
浏览 20
已采纳

无法通过自制程序安装在OS X上导入net / http的程序

I've installed go using Homebrew on my OS X 10.10 machine. Every time I try to compile a sample app that imports net/http, I get the following error:

load cmd/cgo: package cmd/cgo: no Go source files in /Users/bbaron/google_appengine/goroot/src/cmd/cgo

I have my GOPATH variable set correctly ($HOME/go) and my directory structure appears to be correct:

/Users/bbaron/go/src/github.com/einsteinx2/gamenotifier /Users/bbaron/go/src/github.com/einsteinx2/gamenotifier/server.go

Why does cgo seem to thing the GOPATH is $HOME/google_appengine/goroot

I previously (maybe a year ago) did some go development using App Engine, so there must be some left over garbage, but I can't figure out what I need to change to get this working.

I do have the App Engine SDK installed to $HOME/google_appengine but I don't see why that's affecting anything when I'm not importing any App Engine stuff.

Any ideas?

EDIT: It looks like the problem is my GOROOT. The following are also in go env:

GOROOT="/Users/bbaron/google_appengine/goroot" GOTOOLDIR="/Users/bbaron/google_appengine/goroot/pkg/tool/darwin_amd64"

But even if I export a correct GOROOT and check with echo $GOROOT, go env does not see the correct GOROOT

  • 写回答

1条回答 默认 最新

  • doutan1970 2015-07-27 23:22
    关注

    It turned out that my google app engine installation was clobbering these environment variables somehow. I deleted the folder google_appengine in my home directory and then uninstalled the Homebrew version of Go and reinstalled from the official OS X package and now it's working fine.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?