Debian Codegraph @

cover/profile.go

raw symbols SCIP
1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package cover provides support for parsing coverage profiles
6 // generated by "go test -coverprofile=cover.out".
7 package coverscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ // import "golang.org/x/tools/cover"
8
9 import (
10 "bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/"
11 "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/"
12 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
13 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
14 "mathscip-go gomod github.com/golang/go/src go1.25.0 math/"
15 "osscip-go gomod github.com/golang/go/src go1.25.0 os/"
16 "sortscip-go gomod github.com/golang/go/src go1.25.0 sort/"
17 "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/"
18 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
19 )
20
21 // Profile represents the profiling data for a specific file.
22 type Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile# struct {
23 FileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#FileName. string
24 Modescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Mode. string
25 Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks. []ProfileBlockscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#
26 }
27
28 // ProfileBlock represents a single block of profiling data.
29 type ProfileBlockscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock# struct {
30 StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine., StartColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartCol. int
31 EndLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndLine., EndColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndCol. int
32 NumStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#NumStmt., Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count. int
33 }
34
35 type byFileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName# []*Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#
36
37 func (p byFileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName#) Lenscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName#Len().() int { return len(p) }
38 func (p byFileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName#) Lessscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName#Less().(i, j int) bool { return p[i].FileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#FileName. < p[j].FileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#FileName. }
39 func (p byFileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName#) Swapscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName#Swap().(i, j int) { p[i], p[j] = p[j], p[i] }
40
41 // ParseProfiles parses profile data in the specified file and returns a
42 // Profile for each source file described therein.
43 func ParseProfilesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ParseProfiles().(fileName string) ([]*Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#, error) {
44 pf, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Openscip-go gomod github.com/golang/go/src go1.25.0 os/Open().(fileName)
45 if err != nil {
46 return nil, err
47 }
48 defer pf.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().()
49 return ParseProfilesFromReaderscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ParseProfilesFromReader().(pf)
50 }
51
52 // ParseProfilesFromReader parses profile data from the Reader and
53 // returns a Profile for each source file described therein.
54 func ParseProfilesFromReaderscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ParseProfilesFromReader().(rd ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Readerscip-go gomod github.com/golang/go/src go1.25.0 io/Reader#) ([]*Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#, error) {
55 // First line is "mode: foo", where foo is "set", "count", or "atomic".
56 // Rest of file is in the format
57 // encoding/base64/base64.go:34.44,37.40 3 1
58 // where the fields are: name.go:line.column,line.column numberOfStatements count
59 files := make(map[string]*Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#)
60 s := bufioscip-go gomod github.com/golang/go/src go1.25.0 bufio/.NewScannerscip-go gomod github.com/golang/go/src go1.25.0 bufio/NewScanner().(rd)
61 mode := ""
62 for s.Scanscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Scan().() {
63 line := s.Textscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Text().()
64 if mode == "" {
65 const p = "mode: "
66 if !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(line, p) || line == p {
67 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("bad mode line: %v", line)
68 }
69 mode = line[len(p):]
70 continue
71 }
72 fn, b, err := parseLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/parseLine().(line)
73 if err != nil {
74 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("line %q doesn't match expected format: %v", line, err)
75 }
76 p := files[fn]
77 if p == nil {
78 p = &Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#{
79 FileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#FileName.: fn,
80 Modescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Mode.: mode,
81 }
82 files[fn] = p
83 }
84 p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks. = append(p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks., b)
85 }
86 if err := s.Errscip-go gomod github.com/golang/go/src go1.25.0 bufio/Scanner#Err().(); err != nil {
87 return nil, err
88 }
89 for _, p := range files {
90 sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Sortscip-go gomod github.com/golang/go/src go1.25.0 sort/Sort().(blocksByStartscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart#(p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.))
91 // Merge samples from the same location.
92 j := 1
93 for i := 1; i < len(p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.); i++ {
94 b := p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.[i]
95 last := p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.[j-1]
96 if b.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine. == last.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine. &&
97 b.StartColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartCol. == last.StartColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartCol. &&
98 b.EndLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndLine. == last.EndLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndLine. &&
99 b.EndColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndCol. == last.EndColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndCol. {
100 if b.NumStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#NumStmt. != last.NumStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#NumStmt. {
101 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("inconsistent NumStmt: changed from %d to %d", last.NumStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#NumStmt., b.NumStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#NumStmt.)
102 }
103 if mode == "set" {
104 p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.[j-1].Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count. |= b.Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count.
105 } else {
106 p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.[j-1].Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count. += b.Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count.
107 }
108 continue
109 }
110 p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.[j] = b
111 j++
112 }
113 p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks. = p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.[:j]
114 }
115 // Generate a sorted slice.
116 profiles := make([]*Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#, 0, len(files))
117 for _, profile := range files {
118 profiles = append(profiles, profile)
119 }
120 sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Sortscip-go gomod github.com/golang/go/src go1.25.0 sort/Sort().(byFileNamescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/byFileName#(profiles))
121 return profiles, nil
122 }
123
124 // parseLine parses a line from a coverage file.
125 // It is equivalent to the regex
126 // ^(.+):([0-9]+)\.([0-9]+),([0-9]+)\.([0-9]+) ([0-9]+) ([0-9]+)$
127 //
128 // However, it is much faster: https://golang.org/cl/179377
129 func parseLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/parseLine().(l string) (fileName string, block ProfileBlockscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#, err error) {
130 end := len(l)
131
132 b := ProfileBlockscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#{}
133 b.Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count., end, err = seekBackscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/seekBack().(l, ' ', end, "Count")
134 if err != nil {
135 return "", b, err
136 }
137 b.NumStmtscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#NumStmt., end, err = seekBackscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/seekBack().(l, ' ', end, "NumStmt")
138 if err != nil {
139 return "", b, err
140 }
141 b.EndColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndCol., end, err = seekBackscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/seekBack().(l, '.', end, "EndCol")
142 if err != nil {
143 return "", b, err
144 }
145 b.EndLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndLine., end, err = seekBackscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/seekBack().(l, ',', end, "EndLine")
146 if err != nil {
147 return "", b, err
148 }
149 b.StartColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartCol., end, err = seekBackscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/seekBack().(l, '.', end, "StartCol")
150 if err != nil {
151 return "", b, err
152 }
153 b.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine., end, err = seekBackscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/seekBack().(l, ':', end, "StartLine")
154 if err != nil {
155 return "", b, err
156 }
157 fn := l[0:end]
158 if fn == "" {
159 return "", b, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("a FileName cannot be blank")
160 }
161 return fn, b, nil
162 }
163
164 // seekBack searches backwards from end to find sep in l, then returns the
165 // value between sep and end as an integer.
166 // If seekBack fails, the returned error will reference what.
167 func seekBackscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/seekBack().(l string, sep byte, end int, what string) (value int, nextSep int, err error) {
168 // Since we're seeking backwards and we know only ASCII is legal for these values,
169 // we can ignore the possibility of non-ASCII characters.
170 for start := end - 1; start >= 0; start-- {
171 if l[start] == sep {
172 i, err := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.25.0 strconv/Atoi().(l[start+1 : end])
173 if err != nil {
174 return 0, 0, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("couldn't parse %q: %v", what, err)
175 }
176 if i < 0 {
177 return 0, 0, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("negative values are not allowed for %s, found %d", what, i)
178 }
179 return i, start, nil
180 }
181 }
182 return 0, 0, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("couldn't find a %s before %s", string(sep), what)
183 }
184
185 type blocksByStartscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart# []ProfileBlockscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#
186
187 func (b blocksByStartscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart#) Lenscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart#Len().() int { return len(b) }
188 func (b blocksByStartscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart#) Swapscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart#Swap().(i, j int) { b[i], b[j] = b[j], b[i] }
189 func (b blocksByStartscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart#) Lessscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/blocksByStart#Less().(i, j int) bool {
190 bi, bj := b[i], b[j]
191 return bi.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine. < bj.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine. || bi.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine. == bj.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine. && bi.StartColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartCol. < bj.StartColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartCol.
192 }
193
194 // Boundary represents the position in a source file of the beginning or end of a
195 // block as reported by the coverage profile. In HTML mode, it will correspond to
196 // the opening or closing of a <span> tag and will be used to colorize the source
197 type Boundaryscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary# struct {
198 Offsetscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Offset. int // Location as a byte offset in the source file.
199 Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Start. bool // Is this the start of a block?
200 Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Count. int // Event count from the cover profile.
201 Normscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Norm. float64 // Count normalized to [0..1].
202 Indexscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Index. int // Order in input file.
203 }
204
205 // Boundaries returns a Profile as a set of Boundary objects within the provided src.
206 func (p *Profilescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#) Boundariesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Boundaries().(src []byte) (boundaries []Boundaryscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#) {
207 // Find maximum count.
208 max := 0
209 for _, b := range p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks. {
210 if b.Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count. > max {
211 max = b.Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count.
212 }
213 }
214 // Divisor for normalization.
215 divisor := mathscip-go gomod github.com/golang/go/src go1.25.0 math/.Logscip-go gomod github.com/golang/go/src go1.25.0 math/Log().(float64(max))
216
217 // boundary returns a Boundary, populating the Norm field with a normalized Count.
218 index := 0
219 boundary := func(offset int, start bool, count int) Boundaryscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary# {
220 b := Boundaryscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#{Offsetscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Offset.: offset, Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Start.: start, Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Count.: count, Indexscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Index.: index}
221 index++
222 if !start || count == 0 {
223 return b
224 }
225 if max <= 1 {
226 b.Normscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Norm. = 0.8 // Profile is in"set" mode; we want a heat map. Use cov8 in the CSS.
227 } else if count > 0 {
228 b.Normscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Norm. = mathscip-go gomod github.com/golang/go/src go1.25.0 math/.Logscip-go gomod github.com/golang/go/src go1.25.0 math/Log().(float64(count)) / divisor
229 }
230 return b
231 }
232
233 line, col := 1, 2 // TODO: Why is this 2?
234 for si, bi := 0, 0; si < len(src) && bi < len(p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.); {
235 b := p.Blocksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Profile#Blocks.[bi]
236 if b.StartLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartLine. == line && b.StartColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#StartCol. == col {
237 boundaries = append(boundaries, boundary(si, true, b.Countscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#Count.))
238 }
239 if b.EndLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndLine. == line && b.EndColscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndCol. == col || line > b.EndLinescip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/ProfileBlock#EndLine. {
240 boundaries = append(boundaries, boundary(si, false, 0))
241 bi++
242 continue // Don't advance through src; maybe the next block starts here.
243 }
244 if src[si] == '\n' {
245 line++
246 col = 0
247 }
248 col++
249 si++
250 }
251 sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Sortscip-go gomod github.com/golang/go/src go1.25.0 sort/Sort().(boundariesByPosscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos#(boundaries))
252 return
253 }
254
255 type boundariesByPosscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos# []Boundaryscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#
256
257 func (b boundariesByPosscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos#) Lenscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos#Len().() int { return len(b) }
258 func (b boundariesByPosscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos#) Swapscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos#Swap().(i, j int) { b[i], b[j] = b[j], b[i] }
259 func (b boundariesByPosscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos#) Lessscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/boundariesByPos#Less().(i, j int) bool {
260 if b[i].Offsetscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Offset. == b[j].Offsetscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Offset. {
261 // Boundaries at the same offset should be ordered according to
262 // their original position.
263 return b[i].Indexscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Index. < b[j].Indexscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Index.
264 }
265 return b[i].Offsetscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Offset. < b[j].Offsetscip-go gomod golang.org/x/tools . `golang.org/x/tools/cover`/Boundary#Offset.
266 }