segmentio / golines

A golang formatter that fixes long lines
MIT License
903 stars 56 forks source link

Fix line break removal before package directive #111

Closed matthewhughes934 closed 10 months ago

matthewhughes934 commented 10 months ago

Due to an upstream bug[1] if golines were to reformat (i.e. it actually found a line that was too long) a file with a block comment before the package directive, the newline before the package directive would be stripped, e.g.

/*
this is a comment
*/
package foo

Would become

/*
this is a comment
*/ package foo

The underlying issue has been fixed upstream, so fix here by bumping the version of github.com/dave/dst to include that fix. Here's a summary of the changes in that package from the previously used version:

$ git log --no-merges --format='%h %s' v0.27.0..v0.27.3
5fa8d6e Fixes #69
bc71a76 Upgrade golang.org/x/tools to v0.1.12
b6f3447 decorator: make an error more verbose

[1] https://github.com/dave/dst/issues/69