mirror of
https://github.com/golang/go.git
synced 2025-11-09 13:11:03 +00:00
codereview: don't run gofmt with an empty file list
R=gri CC=golang-dev https://golang.org/cl/1678054
This commit is contained in:
parent
4c0de303ce
commit
ad665e4fde
1 changed files with 2 additions and 0 deletions
|
|
@ -694,6 +694,8 @@ def CheckGofmt(ui, repo, files, just_warn=False):
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
files = [RelativePath(repo.root + '/' + f, cwd) for f in files]
|
files = [RelativePath(repo.root + '/' + f, cwd) for f in files]
|
||||||
files = [f for f in files if os.access(f, 0)]
|
files = [f for f in files if os.access(f, 0)]
|
||||||
|
if not files:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
cmd = subprocess.Popen(["gofmt", "-l"] + files, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
cmd = subprocess.Popen(["gofmt", "-l"] + files, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
||||||
cmd.stdin.close()
|
cmd.stdin.close()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue