mirror of
https://github.com/golang/go
synced 2024-11-26 04:47:57 -07:00
- renamed hasPostfix -> hasSuffix
- fixed printing of function literals (require separating ";") R=rsc OCL=27055 CL=27055
This commit is contained in:
parent
91238c5bfe
commit
184c623e6b
@ -658,6 +658,7 @@ func (P *Printer) DoFuncLit(x *ast.FuncLit) {
|
|||||||
P.DoFuncType(x.Type);
|
P.DoFuncType(x.Type);
|
||||||
P.separator = blank;
|
P.separator = blank;
|
||||||
P.Stmt(x.Body);
|
P.Stmt(x.Body);
|
||||||
|
P.opt_semi = false; // BUG 6g or spec
|
||||||
P.newlines = 0;
|
P.newlines = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,14 +100,14 @@ func hasPrefix(s, prefix string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func hasPostfix(s, postfix string) bool {
|
func hasSuffix(s, postfix string) bool {
|
||||||
pos := len(s) - len(postfix);
|
pos := len(s) - len(postfix);
|
||||||
return pos >= 0 && s[pos : len(s)] == postfix;
|
return pos >= 0 && s[pos : len(s)] == postfix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func isGoFile(dir *os.Dir) bool {
|
func isGoFile(dir *os.Dir) bool {
|
||||||
return dir.IsRegular() && hasPostfix(dir.Name, ".go");
|
return dir.IsRegular() && hasSuffix(dir.Name, ".go");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ var (
|
|||||||
|
|
||||||
|
|
||||||
func addFile(dirname string, filename string) {
|
func addFile(dirname string, filename string) {
|
||||||
if hasPostfix(filename, "_test.go") {
|
if hasSuffix(filename, "_test.go") {
|
||||||
// ignore package tests
|
// ignore package tests
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user