2019-04-02 09:12
浏览 706


I am new a Golang programmer and I see code snippets were functions return err as last argument a lot of time.

f, err := strconv.ParseFloat(asciiFloat, 64)

Question is must all functions be made to return err even if no error handling is involved in the function implementation. And how will I know a function is or is not returning an err value?

Must I checkout docs every time I need to use a function?

图片转代码服务由CSDN问答提供 功能建议

我是Golang程序员的新手,我看到代码片段是函数最后返回 err 的函数

  f,err:= strconv.ParseFloat(asciiFloat,64)

问题是即使函数实现中没有错误处理,也必须使所有函数都返回err。 我怎么知道一个函数是否正在返回 err 值?


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题