github.com/BurntSushi/xgb@v0.0.0-20210121224620-deaf085860bc/STYLE (about)

     1  I like to keep all my code to 80 columns or less. I have plenty of screen real 
     2  estate, but enjoy 80 columns so that I can have multiple code windows open side 
     3  to side and not be plagued by the ugly auto-wrapping of a text editor.
     4  
     5  If you don't oblige me, I will fix any patch you submit to abide 80 columns.
     6  
     7  Note that this style restriction does not preclude gofmt, but introduces a few
     8  peculiarities. The first is that gofmt will occasionally add spacing (typically 
     9  to comments) that ends up going over 80 columns. Either shorten the comment or 
    10  put it on its own line.
    11  
    12  The second and more common hiccup is when a function definition extends beyond 
    13  80 columns. If one adds line breaks to keep it below 80 columns, gofmt will 
    14  indent all subsequent lines in a function definition to the same indentation 
    15  level of the function body. This results in a less-than-ideal separation 
    16  between function definition and function body. To remedy this, simply add a 
    17  line break like so:
    18  
    19    func RestackWindowExtra(xu *xgbutil.XUtil, win xproto.Window, stackMode int,
    20      sibling xproto.Window, source int) error {
    21  
    22      return ClientEvent(xu, win, "_NET_RESTACK_WINDOW", source, int(sibling),
    23        stackMode)
    24    }
    25  
    26  Something similar should also be applied to long 'if' or 'for' conditionals, 
    27  although it would probably be preferrable to break up the conditional to 
    28  smaller chunks with a few helper variables.
    29