Source file test/fixedbugs/issue15091.go

     1  // errorcheck -0 -race
     2  
     3  //go:build (linux && amd64) || (linux && ppc64le) || (darwin && amd64) || (freebsd && amd64) || (netbsd && amd64) || (windows && amd64)
     4  
     5  // Copyright 2016 The Go Authors. All rights reserved.
     6  // Use of this source code is governed by a BSD-style
     7  // license that can be found in the LICENSE file.
     8  
     9  package sample
    10  
    11  type Html struct {
    12  	headerIDs map[string]int
    13  }
    14  
    15  // We don't want to see:
    16  //    internal error: (*Html).xyzzy autotmp_3 (type *int) recorded as live on entry, p.Pc=0
    17  // or (now, with the error caught earlier)
    18  //    Treating auto as if it were arg, func (*Html).xyzzy, node ...
    19  // caused by racewalker inserting instrumentation before an OAS where the Ninit
    20  // of the OAS defines part of its right-hand-side. (I.e., the race instrumentation
    21  // references a variable before it is defined.)
    22  func (options *Html) xyzzy(id string) string {
    23  	for count, found := options.headerIDs[id]; found; count, found = options.headerIDs[id] {
    24  		_ = count
    25  	}
    26  	return ""
    27  }
    28  

View as plain text