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.

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

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试