douju7503 2013-09-15 12:16 采纳率: 0%
浏览 222

在golang中运行`go get`时如何解决“函数没有返回语句就结束了”

I am trying to install this Cassandra driver for golang: https://github.com/tux21b/gocql

When I execute go get https://github.com/tux21b/gocql I get

root@backend:/vagrant# go get tux21b.org/v1/gocql
# tux21b.org/v1/gocql
/usr/lib/go/src/pkg/tux21b.org/v1/gocql/conn.go:280: function ends without a return statement
/usr/lib/go/src/pkg/tux21b.org/v1/gocql/conn.go:359: function ends without a return statement
/usr/lib/go/src/pkg/tux21b.org/v1/gocql/conn.go:407: function ends without a return statement
/usr/lib/go/src/pkg/tux21b.org/v1/gocql/marshal.go:1000: function ends without a return statement

How can I manage the package to be installed?

  • 写回答

1条回答 默认 最新

  • dongwei3336 2013-09-15 17:00
    关注

    The first thing to do when encountered with this particular compile error is to make sure you have upgraded from version 1.0 of Go to version 1.1 or newer.

    The reason is that Go compiler have become smarter in detecting functions that don’t return their expected return values. For example, a function like this:

    function check(n int) bool {
        if n > 10 {
            return true
        } else {
            return false
        }
    }
    

    would lead to a compile error with Go 1.0, but Go 1.1 can correctly detect that this function always return a value and is OK.

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么