duanfen1992 2013-06-14 13:21
浏览 41
已采纳

Go代码无法编译:未定义:revel.EmptyPlugin

Me and a few friends are writing a server using golang (revel) and had a database implemented just a few weeks ago. Then suddenly everything just stopped working and the go compiler can't find my import files. That includes EmptyPlugin as well as RegisterPlugin.

We are all pretty new so this is probably a pretty simple fix. I have checked my github.com/robfig/revel folder, and there is no file called EmptyPlugin. But that is probably a misunderstanding from my side :P.

By commenting the lines revel.EmptyPlugin and revel.RegisterPlugin(DbPlugin{}) everything works as it should.

package controllers

import (
    "database/sql"
    "fmt"
    _ "github.com/bmizerany/pq"
    "github.com/robfig/revel"
    "log"
    "time"
    //"strconv"
)

type DbPlugin struct {
    revel.EmptyPlugin
}



func init() {
    revel.RegisterPlugin(DbPlugin{})
}


var db *sql.DB 
var err error
  • 写回答

1条回答 默认 最新

  • donglian4770 2013-06-14 16:39
    关注

    You appear to compiling using the latest and recently updated version of Revel: https://github.com/robfig/revel.

    However, it appears that your code was written for this older version of Revel: https://github.com/robfig/revel/tree/dev.

    Update your code to the latest version of Revel.

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

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度