问答详情
源自:2-4 实现错误处理

编译错误,求助

.\app.go:43:35: cannot use StatusError literal (type StatusError) as type error in argument to respondWrithError:

StatusError does not implement error (Error method has pointer receiver)

.\app.go:48:35: cannot use StatusError literal (type StatusError) as type error in argument to respondWrithError:

StatusError does not implement error (Error method has pointer receiver)


提问者:慕设计7486976 2019-08-14 12:30

个回答

  • 徐徐运维
    2019-10-26 17:44:23

    StatusError 方法需要一个指针的receiver ?   方法定义的时候返回值看下

  • 鲲t
    2019-08-19 14:53:45

    错误说明说的很清楚了的嘛,  如果要用StatusError 就必须要实现error方法才行