From 522e9f29bae4eb0a75043dfbba364f91f5560317 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Wed, 22 Aug 2018 14:32:42 +0200 Subject: [PATCH] all: apply gofmt simplify --- compile/compile.go | 4 ++-- parser/y.go | 4 ++-- py/string.go | 2 +- symtable/symtable_test.go | 2 +- time/time.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compile/compile.go b/compile/compile.go index dbec118b..dc8851cf 100644 --- a/compile/compile.go +++ b/compile/compile.go @@ -604,7 +604,7 @@ func (c *compiler) compileFunc(compilerScope compilerScopeType, Ast ast.Ast, Arg c.makeClosure(newC.Code, args, newC, newC.qualname) // Call decorators - for _ = range DecoratorList { + for range DecoratorList { c.OpArg(vm.CALL_FUNCTION, 1) // 1 positional, 0 keyword pair } } @@ -653,7 +653,7 @@ func (c *compiler) class(Ast ast.Ast, class *ast.ClassDef) { c.callHelper(2, class.Bases, class.Keywords, class.Starargs, class.Kwargs) /* 6. apply decorators */ - for _ = range class.DecoratorList { + for range class.DecoratorList { c.OpArg(vm.CALL_FUNCTION, 1) // 1 positional, 0 keyword pair } diff --git a/parser/y.go b/parser/y.go index 846b3f2d..086b0969 100644 --- a/parser/y.go +++ b/parser/y.go @@ -1652,7 +1652,7 @@ yydefault: case 130: //line grammar.y:946 { - yyVAL.aliases = []*ast.Alias{&ast.Alias{Pos: yyVAL.pos, Name: ast.Identifier("*")}} + yyVAL.aliases = []*ast.Alias{{Pos: yyVAL.pos, Name: ast.Identifier("*")}} } case 131: //line grammar.y:950 @@ -2661,7 +2661,7 @@ yydefault: yyVAL.call = &ast.Call{} test := yyS[yypt-2].expr if name, ok := test.(*ast.Name); ok { - yyVAL.call.Keywords = []*ast.Keyword{&ast.Keyword{Pos: name.Pos, Arg: name.Id, Value: yyS[yypt-0].expr}} + yyVAL.call.Keywords = []*ast.Keyword{{Pos: name.Pos, Arg: name.Id, Value: yyS[yypt-0].expr}} } else { yylex.(*yyLex).SyntaxError("keyword can't be an expression") } diff --git a/py/string.go b/py/string.go index ea680573..f63b9c91 100644 --- a/py/string.go +++ b/py/string.go @@ -388,7 +388,7 @@ func (a String) M__imod__(other Object) (Object, error) { // returns end of string if not found func (s String) pos(n int) int { characterNumber := 0 - for i, _ := range s { + for i := range s { if characterNumber == n { return i } diff --git a/symtable/symtable_test.go b/symtable/symtable_test.go index 0e15c8b8..8fd8e66f 100644 --- a/symtable/symtable_test.go +++ b/symtable/symtable_test.go @@ -72,7 +72,7 @@ func EqSymbols(t *testing.T, name string, a, b Symbols) { t.Errorf("%s[%s] not found", name, ka) } } - for kb, _ := range b { + for kb := range b { if _, ok := a[kb]; ok { // Checked already } else { diff --git a/time/time.go b/time/time.go index fa531f94..84eb8288 100644 --- a/time/time.go +++ b/time/time.go @@ -998,7 +998,7 @@ func init() { py.MustNewMethod("get_clock_info", time_get_clock_info, 0, get_clock_info_doc), } globals := py.StringDict{ - //"version": py.Int(MARSHAL_VERSION), + //"version": py.Int(MARSHAL_VERSION), } py.NewModule("time", module_doc, methods, globals)