Skip to content
Browse files

prog, pkg/compiler: fix warnings

gometalinter says:

pkg/compiler/consts.go:192:⚠️ internal error: no range for "n" (vetshadow)
pkg/compiler/consts.go:197:⚠️ internal error: no range for "n" (vetshadow)
prog/encoding.go:862:⚠️ declaration of "v" shadows declaration at prog/encoding.go:852 (vetshadow)

This somehow happens only with Go1.11 but not 1.12 so wasn't detected locally.
The prog warnings looks legit.
The pkg/compiler warning was amusingly introduced to please golangci-lint checker,
revert that fix for now.
  • Loading branch information...
dvyukov committed Mar 29, 2019
1 parent babbf71 commit c35ee0ea6d7ad386409ff5092d11361169886eef
Showing with 4 additions and 3 deletions.
  1. +2 −1 pkg/compiler/consts.go
  2. +2 −2 prog/encoding.go
@@ -164,9 +164,10 @@ func (comp *compiler) assignSyscallNumbers(consts map[string]uint64) {
// Updates desc and returns set of unsupported syscalls and flags.
func (comp *compiler) patchConsts(consts map[string]uint64) {
for _, decl := range comp.desc.Nodes {
switch n := decl.(type) {
switch decl.(type) {
case *ast.IntFlags:
// Unsupported flag values are dropped.
n := decl.(*ast.IntFlags)
var values []*ast.Int
for _, v := range n.Values {
if comp.patchIntConst(&v.Value, &v.Ident, consts, nil) {
@@ -859,11 +859,11 @@ func (p *parser) deserializeData() ([]byte, error) {
case 'x':
hi := p.consume()
lo := p.consume()
v, ok := hexToByte(lo, hi)
b, ok := hexToByte(lo, hi)
if !ok {
return nil, fmt.Errorf("invalid hex \\x%v%v in data arg", hi, lo)
data = append(data, v)
data = append(data, b)
case 'a':
data = append(data, '\a')
case 'b':

0 comments on commit c35ee0e

Please sign in to comment.
You can’t perform that action at this time.