dqcd84732 2014-01-09 05:10
浏览 78
已采纳

继续-无法找到“ appengine”软件包

I have followed this guide in installing the AppEngine SDK. https://developers.google.com/appengine/docs/go/gettingstarted/introduction

I have originally installed Go 1.2 with Brew (on OSX). I've set my paths:

export GOPATH=$HOME/Documents/go
export PATH=$GOPATH/bin:$PATH
export PATH=$HOME/Documents/go/go_appengine:$PATH

I copy/pasted hello world app, and ran it with goapp serve. All good.

Now, as soon as I try to use appengine:

import (
    "appengine"
)

I get compile time error:

api.go:5:5: cannot find package "appengine" in any of:
    /usr/local/Cellar/go/1.2/libexec/src/pkg/appengine (from $GOROOT)
    /Users/jan/Documents/go/src/appengine (from $GOPATH)

The starting guide documentation doesn't say anything about this. It seems like the SDK has its own $GOPATH like dir with /src, /pkg and /bin. I assume I would have to manually switch the $GOPATH between SDK and native Go all the time, which doesn't make any sense and doesn't even work for me (as I mostly work on non-appengine stuff).

I am clearly doing something wrong here. What am I missing?

EDIT: It seems like the actual appengine server is compiling and running fine, however my entire setup is broken (testing, Vim...). Is there any workaround?

  • 写回答

5条回答 默认 最新

  • duanfan8699 2014-01-09 12:59
    关注

    As provided by alpe1, the following lines solve the vim compiler go:

    ln -s $APPENGINE_SDK/goroot/src/pkg/appengine $GOROOT/src/pkg/ 
    ln -s $APPENGINE_SDK/goroot/src/pkg/appengine_internal $GOROOT/src/pkg/
    mkdir -p $GOROOT/src/pkg/code.google.com/p/
    ln -s $APPENGINE_SDK/goroot/src/pkg/code.google.com/p/goprotobuf
    $GOROOT/src/pkg/code.google.com/p/
    

    and I needed to update gocode lib-path (cf Options) to have the autocompletion for appengine:

    gocode set lib-path "$APPENGINE_SDK/goroot/pkg/linux_amd64_appengine"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line