• Daniel Martí's avatar
    cmd/go: skip "exclude all Go files" error in fmt · e5f6051e
    Daniel Martí authored
    Otherwise, one can't run "go fmt" on a directory containing Go files if
    none of them are buildable (e.g. because of build tags). This is
    counter-intuitive, as fmt will format all Go files anyway.
    
    If we encounter such a load error, ignore it and carry on. All other
    load errors, such as when a package can't be found, should still be
    shown to the user.
    
    Add a test for the two kinds of load errors. Use fmt -n so that any
    changes to the formatting of the files in testdata don't actually get
    applied. The load errors still occur with -n, so the test does its job.
    
    Fixes #22183.
    
    Change-Id: I99d0c0cdd29015b6a3f5286a9bbff50757c78e0d
    Reviewed-on: https://go-review.googlesource.com/75930
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    e5f6051e
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...