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 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题