@@ -71,10 +71,10 @@ import (
7171// InterfaceSlice is a helper type for sorting interface
7272// slices according to some slice-specific sort criteria.
7373
74- type comparer func (x , y interface {} ) bool
74+ type comparer func (x , y any ) bool
7575
7676type interfaceSlice struct {
77- slice []interface {}
77+ slice []any
7878 less comparer
7979}
8080
@@ -87,7 +87,7 @@ type interfaceSlice struct {
8787// runs. For instance, a RunList containing pairs (x, y) may be compressed
8888// into a RunList containing pair runs (x, {y}) where each run consists of
8989// a list of y's with the same x.
90- type RunList []interface {}
90+ type RunList []any
9191
9292func (h RunList ) sort (less comparer ) {
9393 sort .Sort (& interfaceSlice {h , less })
@@ -99,7 +99,7 @@ func (p *interfaceSlice) Swap(i, j int) { p.slice[i], p.slice[j] = p.slice[
9999
100100// Compress entries which are the same according to a sort criteria
101101// (specified by less) into "runs".
102- func (h RunList ) reduce (less comparer , newRun func (h RunList ) interface {} ) RunList {
102+ func (h RunList ) reduce (less comparer , newRun func (h RunList ) any ) RunList {
103103 if len (h ) == 0 {
104104 return nil
105105 }
@@ -143,10 +143,10 @@ func (k KindRun) Less(i, j int) bool { return k[i].Lori() < k[j].Lori() }
143143func (k KindRun ) Swap (i , j int ) { k [i ], k [j ] = k [j ], k [i ] }
144144
145145// FileRun contents are sorted by Kind for the reduction into KindRuns.
146- func lessKind (x , y interface {} ) bool { return x .(SpotInfo ).Kind () < y .(SpotInfo ).Kind () }
146+ func lessKind (x , y any ) bool { return x .(SpotInfo ).Kind () < y .(SpotInfo ).Kind () }
147147
148148// newKindRun allocates a new KindRun from the SpotInfo run h.
149- func newKindRun (h RunList ) interface {} {
149+ func newKindRun (h RunList ) any {
150150 run := make (KindRun , len (h ))
151151 for i , x := range h {
152152 run [i ] = x .(SpotInfo )
@@ -214,7 +214,7 @@ type FileRun struct {
214214}
215215
216216// Spots are sorted by file path for the reduction into FileRuns.
217- func lessSpot (x , y interface {} ) bool {
217+ func lessSpot (x , y any ) bool {
218218 fx := x .(Spot ).File
219219 fy := y .(Spot ).File
220220 // same as "return fx.Path() < fy.Path()" but w/o computing the file path first
@@ -224,7 +224,7 @@ func lessSpot(x, y interface{}) bool {
224224}
225225
226226// newFileRun allocates a new FileRun from the Spot run h.
227- func newFileRun (h RunList ) interface {} {
227+ func newFileRun (h RunList ) any {
228228 file := h [0 ].(Spot ).File
229229
230230 // reduce the list of Spots into a list of KindRuns
@@ -257,12 +257,12 @@ func (p *PakRun) Less(i, j int) bool { return p.Files[i].File.Name < p.Files[j].
257257func (p * PakRun ) Swap (i , j int ) { p .Files [i ], p .Files [j ] = p .Files [j ], p .Files [i ] }
258258
259259// FileRuns are sorted by package for the reduction into PakRuns.
260- func lessFileRun (x , y interface {} ) bool {
260+ func lessFileRun (x , y any ) bool {
261261 return x .(* FileRun ).File .Pak .less (y .(* FileRun ).File .Pak )
262262}
263263
264264// newPakRun allocates a new PakRun from the *FileRun run h.
265- func newPakRun (h RunList ) interface {} {
265+ func newPakRun (h RunList ) any {
266266 pak := h [0 ].(* FileRun ).File .Pak
267267 files := make ([]* FileRun , len (h ))
268268 for i , x := range h {
@@ -280,7 +280,7 @@ func newPakRun(h RunList) interface{} {
280280type HitList []* PakRun
281281
282282// PakRuns are sorted by package.
283- func lessPakRun (x , y interface {} ) bool { return x .(* PakRun ).Pak .less (y .(* PakRun ).Pak ) }
283+ func lessPakRun (x , y any ) bool { return x .(* PakRun ).Pak .less (y .(* PakRun ).Pak ) }
284284
285285func reduce (h0 RunList ) HitList {
286286 // reduce a list of Spots into a list of FileRuns
@@ -325,10 +325,10 @@ type AltWords struct {
325325}
326326
327327// wordPairs are sorted by their canonical spelling.
328- func lessWordPair (x , y interface {} ) bool { return x .(* wordPair ).canon < y .(* wordPair ).canon }
328+ func lessWordPair (x , y any ) bool { return x .(* wordPair ).canon < y .(* wordPair ).canon }
329329
330330// newAltWords allocates a new AltWords from the *wordPair run h.
331- func newAltWords (h RunList ) interface {} {
331+ func newAltWords (h RunList ) any {
332332 canon := h [0 ].(* wordPair ).canon
333333 alts := make ([]string , len (h ))
334334 for i , x := range h {
@@ -1159,7 +1159,7 @@ func (x *Index) WriteTo(w io.Writer) (n int64, err error) {
11591159 return 0 , err
11601160 }
11611161 if fulltext {
1162- encode := func (x interface {} ) error {
1162+ encode := func (x any ) error {
11631163 return gob .NewEncoder (w ).Encode (x )
11641164 }
11651165 if err := x .fset .Write (encode ); err != nil {
@@ -1199,7 +1199,7 @@ func (x *Index) ReadFrom(r io.Reader) (n int64, err error) {
11991199 x .opts = fx .Opts
12001200 if fx .Fulltext {
12011201 x .fset = token .NewFileSet ()
1202- decode := func (x interface {} ) error {
1202+ decode := func (x any ) error {
12031203 return gob .NewDecoder (r ).Decode (x )
12041204 }
12051205 if err := x .fset .Read (decode ); err != nil {
0 commit comments