Skip to content
Branch: master
Commits on May 23, 2019
Commits on May 13, 2019
  1. Don't add whitespace to //extern comments

    tklauser authored and mvdan committed May 13, 2019
    When using gccgo, the //extern comment can be used to declare C
    functions to call from Go, see
    These comments shouldn't have a whitespace added.
Commits on May 10, 2019
Commits on May 4, 2019
  1. replace "var name = value" with "name := value"

    mvdan committed May 4, 2019
    Thanks to the new astutil.Apply API.
    Fixes #14.
  2. rewrite using astutil.Apply

    mvdan committed May 4, 2019
    It's not particularly necessary for the current code, but in the next
    commits we want to be able to replace the current node. We can't do that
    easily with ast.Inspect.
    This API is also more powerful, as it lets us use both pre and post
    funcs, and also allows deleting the current node and querying its
Commits on Apr 27, 2019
  1. remove empty lines before simple error checks

    mvdan committed Apr 27, 2019
    Fixes #13.
  2. join all standard library imports

    mvdan committed Apr 25, 2019
    This code is a bit tricky since we have to be careful to not break other
    imports, and to not move comments around too much.
    Fixes #8.
Commits on Apr 16, 2019
  1. Update

    klaidliadon authored and mvdan committed Apr 16, 2019
  2. Don't add whitespace to sys/sysnb syscall function wrapper comments

    tklauser authored and mvdan committed Apr 16, 2019
    The syscall and packages use //sys and //sysnb comments
    to declare system call function wrapper prototypes. Those get read by
    mksyscall.go to generate the actual syscall wrappers and it expects the
    comments without a whitespace.
Commits on Apr 12, 2019
  1. simplify addNewline

    mvdan committed Apr 12, 2019
  2. README: add short case clause example

    mvdan committed Apr 12, 2019
    For #3.
Commits on Apr 11, 2019
  1. add a //TODO: test case as well

    mvdan committed Apr 11, 2019
  2. don't break //export and //foo:bar directives

    mvdan committed Apr 11, 2019
    Fixes #7.
  3. collapse case clauses if they fit in a short line

    mvdan committed Apr 10, 2019
    For now, a short line is one which can be printed in under sixty bytes,
    including any inline comment.
    We don't take indentation into account, which will be problematic. For
    that reason, keep the limit small. We'll fix that in a better way in a
    later commit.
    Fixes #3.
Commits on Apr 9, 2019
  1. separate gofumpt code into an importable package

    mvdan committed Apr 9, 2019
    To allow offering a drop-in replacement for goimports.
  2. don't space comments which start with symbols

    mvdan committed Apr 9, 2019
    For example, ASCII art in comments is not uncommon, and we don't want to
    be too aggressive. In reality, we only care about the comments which
    look to be read by humans.
    As a follow-up to the comments on #6.
  3. non-directive comments should start with a space

    mvdan committed Apr 9, 2019
    Documentation comments should definitely be spaced, for readability and
    Directives shouldn't, to not break them.
    The only grey area is commented out code. Some people prefer space, and
    some editors don't add that space. For the sake of consistency, enforce
    the whitespace in this case too. It also makes spotting commented out
    code easier during reviews.
    Fixes #6.
Commits on Apr 5, 2019
  1. don't break comments when simplifying decls

    mvdan committed Apr 5, 2019
    Before, we'd reformat:
    	const (
    		// verbose is verbose.
    		verbose = "bar"
    Into the following, which is wrong:
    	// verbose is verbose.
    	verbose = "bar"
  2. reduce the verbosity of lone declarations

    mvdan committed Apr 5, 2019
    As suggested by @mmcloughlin.
Commits on Apr 4, 2019
  1. separate the license files

    mvdan committed Apr 4, 2019
    Someone pointed out that, even though they're both BSD 3-clause, the
    files are different. In particular, the copyright line, and the entity
    in the third clause.
Commits on Mar 31, 2019
  1. separate multiline top-level declarations

    mvdan committed Mar 31, 2019
    gofmt only does this when the kinds are different (e.g. func and var).
    For now, don't separate two declarations when only one is multiline.
    Fixes #1.
  2. clarify that the tools' name is gofumpt

    mvdan committed Mar 31, 2019
    Since it may be used to replace gofmt itself, ensure that the two
    binaries can't be confused for one another.
  3. relax the composite rule under some scenarios

    mvdan committed Mar 31, 2019
    If a composite literal has many elements but they all immediately follow
    each other, and neither brace has a newline, that's fine.
  4. binary search comments instead of using a map

    mvdan committed Mar 31, 2019
    A comment map works more or less fine, but ultimately it's not what we
    want. We simply want to know which comments are between two positions.
Commits on Mar 30, 2019
You can’t perform that action at this time.