dphnn333971 2017-02-18 14:02
浏览 1076


One of my favorite things about go is gofmt. I like the fact that the coding style is standardized in many ways.

However there is one thing that bothers me still: line breaks. I found that if I look at my company's codebase, there is no evident consistency on the question of when to break lines.

Looking at some of the code in the stdlib, for example, the fmt code here, I'm still not sure what's the convention (if it exists at all).

For example, on fmt_integer function here, there are line breaks after if statement bodies, but on fmt_sbx here there aren't.

Is there a convention for line breaks in golang? what's considered best practice?

  • 写回答



      相关推荐 更多相似问题


      • ¥15 vue3为什么请求在这边获取不到数据呢(关键词-select)
      • ¥20 Multisim仿真设计三路智力抢答装置
      • ¥15 用UML制作简单的语音计算机
      • ¥20 用socket实现ping遇到的问题
      • ¥15 综合的类,这个类里面里面又有构造方法,重载方法,有继承,有重写,有接口
      • ¥15 电脑重置失败无法开机也进不了修复模式,如何解决?
      • ¥100 px4飞控如何设置平飞模式下飞机固定的仰角
      • ¥15 关于#python#的问题:不可以使用max ,min ,exit ,break 的情况下找出哪一年份出生率最高,以及哪一年份出生率最低
      • ¥15 WPF中使用DoDragDrop程序会崩,"FatalExecutionEngineError"
      • ¥15 C语言 堆排序 数据结构