mirror of
https://github.com/golang/go
synced 2024-11-22 03:54:39 -07:00
codereview: ignore test files during 'hg gofmt'
R=golang-dev, gri CC=golang-dev https://golang.org/cl/5581047
This commit is contained in:
parent
9c497443ae
commit
deeb1b36dd
@ -895,7 +895,7 @@ def CheckFormat(ui, repo, files, just_warn=False):
|
|||||||
|
|
||||||
# Check that gofmt run on the list of files does not change them
|
# Check that gofmt run on the list of files does not change them
|
||||||
def CheckGofmt(ui, repo, files, just_warn):
|
def CheckGofmt(ui, repo, files, just_warn):
|
||||||
files = [f for f in files if (not f.startswith('test/') or f.startswith('test/bench/')) and f.endswith('.go')]
|
files = gofmt_required(files)
|
||||||
if not files:
|
if not files:
|
||||||
return
|
return
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
@ -1749,7 +1749,7 @@ def gofmt(ui, repo, *pats, **opts):
|
|||||||
return codereview_disabled
|
return codereview_disabled
|
||||||
|
|
||||||
files = ChangedExistingFiles(ui, repo, pats, opts)
|
files = ChangedExistingFiles(ui, repo, pats, opts)
|
||||||
files = [f for f in files if f.endswith(".go")]
|
files = gofmt_required(files)
|
||||||
if not files:
|
if not files:
|
||||||
return "no modified go files"
|
return "no modified go files"
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
@ -1766,6 +1766,9 @@ def gofmt(ui, repo, *pats, **opts):
|
|||||||
raise hg_util.Abort("gofmt: " + ExceptionDetail())
|
raise hg_util.Abort("gofmt: " + ExceptionDetail())
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def gofmt_required(files):
|
||||||
|
return [f for f in files if (not f.startswith('test/') or f.startswith('test/bench/')) and f.endswith('.go')]
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# hg mail
|
# hg mail
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user