From 1477993e1b6aae37085eb2ead17aae4ab827c0b5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 31 Jul 2018 20:47:36 +0200 Subject: pkg/compiler: work around vet crash vetshadow not works, so enable it. Update https://github.com/golang/go/issues/26725 Update #538 --- pkg/compiler/check.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pkg') diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go index 04c934c2d..a0d0f7fed 100644 --- a/pkg/compiler/check.go +++ b/pkg/compiler/check.go @@ -85,12 +85,13 @@ func (comp *compiler) checkNames() { name, typ, prev.Pos) continue } - if res, ok := decl.(*ast.Resource); ok { - comp.resources[name] = res - } else if n, ok := decl.(*ast.TypeDef); ok { + switch n := decl.(type) { + case *ast.Resource: + comp.resources[name] = n + case *ast.TypeDef: comp.typedefs[name] = n - } else if str, ok := decl.(*ast.Struct); ok { - comp.structs[name] = str + case *ast.Struct: + comp.structs[name] = n } case *ast.IntFlags: name := n.Name.Name -- cgit mrf-deployment