From 2152cfbcb2be527366289e08536f7acce254d3f5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 18 Apr 2020 17:43:49 +0200 Subject: all: fix liner errors pkg/compiler/compiler.go:182: line is 125 characters func (comp *compiler) parseAttrs(descs map[string]*attrDesc, parent ast.Node, attrs []*ast.Type) (res map[*attrDesc]uint64) { sys/targets/common.go:47:21: unnecessary conversion makeMmap(^uint64(target.PageSize)+1, target.PageSize, 0), ^ sys/targets/common.go:61: File is not `gofmt`-ed with `-s` &prog.Call{ sys/windows/init.go:35: File is not `gofmt`-ed with `-s` &prog.Call{ --- pkg/compiler/compiler.go | 16 ++++++++-------- sys/targets/common.go | 4 ++-- sys/windows/init.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index 5c5df9f04..a9146305b 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -179,37 +179,37 @@ func (comp *compiler) structIsVarlen(name string) bool { return varlen } -func (comp *compiler) parseAttrs(descs map[string]*attrDesc, parent ast.Node, attrs []*ast.Type) (res map[*attrDesc]uint64) { +func (comp *compiler) parseAttrs(descs map[string]*attrDesc, parent ast.Node, attrs []*ast.Type) map[*attrDesc]uint64 { _, parentType, parentName := parent.Info() - res = make(map[*attrDesc]uint64) + res := make(map[*attrDesc]uint64) for _, attr := range attrs { if unexpected, _, ok := checkTypeKind(attr, kindIdent); !ok { comp.error(attr.Pos, "unexpected %v, expect attribute", unexpected) - return + return res } if len(attr.Colon) != 0 { comp.error(attr.Colon[0].Pos, "unexpected ':'") - return + return res } desc := descs[attr.Ident] if desc == nil { comp.error(attr.Pos, "unknown %v %v attribute %v", parentType, parentName, attr.Ident) - return + return res } if _, ok := res[desc]; ok { comp.error(attr.Pos, "duplicate %v %v attribute %v", parentType, parentName, attr.Ident) - return + return res } val := uint64(1) if desc.HasArg { val = comp.parseAttrArg(attr) } else if len(attr.Args) != 0 { comp.error(attr.Pos, "%v attribute has args", attr.Ident) - return + return res } res[desc] = val } - return + return res } func (comp *compiler) parseAttrArg(attr *ast.Type) uint64 { diff --git a/sys/targets/common.go b/sys/targets/common.go index d7ee71983..beac7004d 100644 --- a/sys/targets/common.go +++ b/sys/targets/common.go @@ -44,7 +44,7 @@ func MakePosixMmap(target *prog.Target, exec, contain bool) func() []*prog.Call return func() []*prog.Call { if contain { return []*prog.Call{ - makeMmap(^uint64(target.PageSize)+1, target.PageSize, 0), + makeMmap(^target.PageSize+1, target.PageSize, 0), makeMmap(0, size, protRW), makeMmap(size, target.PageSize, 0), } @@ -58,7 +58,7 @@ func MakeSyzMmap(target *prog.Target) func() []*prog.Call { size := target.NumPages * target.PageSize return func() []*prog.Call { return []*prog.Call{ - &prog.Call{ + { Meta: meta, Args: []prog.Arg{ prog.MakeVmaPointerArg(meta.Args[0], 0, size), diff --git a/sys/windows/init.go b/sys/windows/init.go index 6a245cdba..54d93777f 100644 --- a/sys/windows/init.go +++ b/sys/windows/init.go @@ -32,7 +32,7 @@ func (arch *arch) makeMmap() []*prog.Call { meta := arch.virtualAllocSyscall size := arch.target.NumPages * arch.target.PageSize return []*prog.Call{ - &prog.Call{ + { Meta: meta, Args: []prog.Arg{ prog.MakeVmaPointerArg(meta.Args[0], 0, size), -- cgit mrf-deployment