]> Cypherpunks.ru repositories - gostls13.git/blob - src/go/build/deps_test.go
[dev.boringcrypto] all: merge master (2f0da6d) into dev.boringcrypto
[gostls13.git] / src / go / build / deps_test.go
1 // Copyright 2012 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 // This file exercises the import parser but also checks that
6 // some low-level packages do not have new dependencies added.
7
8 package build
9
10 import (
11         "bytes"
12         "fmt"
13         "go/token"
14         "internal/testenv"
15         "io/fs"
16         "os"
17         "path/filepath"
18         "runtime"
19         "sort"
20         "strings"
21         "testing"
22 )
23
24 // depsRules defines the expected dependencies between packages in
25 // the Go source tree. It is a statement of policy.
26 //
27 // DO NOT CHANGE THIS DATA TO FIX BUILDS.
28 // Existing packages should not have their constraints relaxed
29 // without prior discussion.
30 // Negative assertions should almost never be removed.
31 //
32 // The general syntax of a rule is:
33 //
34 //              a, b < c, d;
35 //
36 // which means c and d come after a and b in the partial order
37 // (that is, c and d can import a and b),
38 // but doesn't provide a relative order between a vs b or c vs d.
39 //
40 // The rules can chain together, as in:
41 //
42 //              e < f, g < h;
43 //
44 // which is equivalent to
45 //
46 //              e < f, g;
47 //              f, g < h;
48 //
49 // Except for the special bottom element "NONE", each name
50 // must appear exactly once on the right-hand side of a rule.
51 // That rule serves as the definition of the allowed dependencies
52 // for that name. The definition must appear before any uses
53 // of the name on the left-hand side of a rule. (That is, the
54 // rules themselves must be ordered according to the partial
55 // order, for easier reading by people.)
56 //
57 // Negative assertions double-check the partial order:
58 //
59 //              i !< j
60 //
61 // means that it must NOT be the case that i < j.
62 // Negative assertions may appear anywhere in the rules,
63 // even before i and j have been defined.
64 //
65 // Comments begin with #.
66 //
67 // All-caps names are pseudo-names for specific points
68 // in the dependency lattice.
69 //
70 var depsRules = `
71         # No dependencies allowed for any of these packages.
72         NONE
73         < container/list, container/ring,
74           internal/cfg, internal/cpu,
75           internal/goversion, internal/nettrace,
76           unicode/utf8, unicode/utf16, unicode,
77           unsafe;
78
79         # These packages depend only on unsafe.
80         unsafe
81         < internal/abi;
82
83         # RUNTIME is the core runtime group of packages, all of them very light-weight.
84         internal/abi, internal/cpu, unsafe
85         < internal/bytealg
86         < internal/unsafeheader
87         < runtime/internal/sys
88         < runtime/internal/atomic
89         < runtime/internal/math
90         < runtime
91         < sync/atomic
92         < internal/race
93         < sync
94         < internal/reflectlite
95         < errors
96         < internal/oserror, math/bits
97         < RUNTIME;
98
99         RUNTIME
100         < sort
101         < container/heap;
102
103         RUNTIME
104         < io;
105
106         syscall !< io;
107         reflect !< sort;
108
109         RUNTIME, unicode/utf8
110         < path;
111
112         unicode !< path;
113
114         # SYSCALL is RUNTIME plus the packages necessary for basic system calls.
115         RUNTIME, unicode/utf8, unicode/utf16
116         < internal/syscall/windows/sysdll, syscall/js
117         < syscall
118         < internal/syscall/unix, internal/syscall/windows, internal/syscall/windows/registry
119         < internal/syscall/execenv
120         < SYSCALL;
121
122         # TIME is SYSCALL plus the core packages about time, including context.
123         SYSCALL
124         < time/tzdata
125         < time
126         < context
127         < TIME;
128
129         TIME, io, path, sort
130         < io/fs;
131
132         # MATH is RUNTIME plus the basic math packages.
133         RUNTIME
134         < math
135         < MATH;
136
137         unicode !< math;
138
139         MATH
140         < math/cmplx;
141
142         MATH
143         < math/rand;
144
145         MATH
146         < runtime/metrics;
147
148         MATH, unicode/utf8
149         < strconv;
150
151         unicode !< strconv;
152
153         # STR is basic string and buffer manipulation.
154         RUNTIME, io, unicode/utf8, unicode/utf16, unicode
155         < bytes, strings
156         < bufio;
157
158         bufio, path, strconv
159         < STR;
160
161         # OS is basic OS access, including helpers (path/filepath, os/exec, etc).
162         # OS includes string routines, but those must be layered above package os.
163         # OS does not include reflection.
164         io/fs
165         < internal/testlog
166         < internal/poll
167         < os
168         < os/signal;
169
170         io/fs
171         < embed;
172
173         unicode, fmt !< os, os/signal;
174
175         os/signal, STR
176         < path/filepath
177         < io/ioutil, os/exec;
178
179         io/ioutil, os/exec, os/signal
180         < OS;
181
182         reflect !< OS;
183
184         OS
185         < golang.org/x/sys/cpu;
186
187         # FMT is OS (which includes string routines) plus reflect and fmt.
188         # It does not include package log, which should be avoided in core packages.
189         strconv, unicode
190         < reflect;
191
192         os, reflect
193         < internal/fmtsort
194         < fmt;
195
196         OS, fmt
197         < FMT;
198
199         log !< FMT;
200
201         OS, FMT
202         < internal/execabs;
203
204         OS, internal/execabs
205         < internal/goroot;
206
207         # Misc packages needing only FMT.
208         FMT
209         < flag,
210           html,
211           mime/quotedprintable,
212           net/internal/socktest,
213           net/url,
214           runtime/debug,
215           runtime/trace,
216           text/scanner,
217           text/tabwriter;
218
219         # encodings
220         # core ones do not use fmt.
221         io, strconv
222         < encoding;
223
224         encoding, reflect
225         < encoding/binary
226         < encoding/base32, encoding/base64;
227
228         fmt !< encoding/base32, encoding/base64;
229
230         FMT, encoding/base32, encoding/base64
231         < encoding/ascii85, encoding/csv, encoding/gob, encoding/hex,
232           encoding/json, encoding/pem, encoding/xml, mime;
233
234         # hashes
235         io
236         < hash
237         < hash/adler32, hash/crc32, hash/crc64, hash/fnv, hash/maphash;
238
239         # math/big
240         FMT, encoding/binary, math/rand
241         < math/big;
242
243         # compression
244         FMT, encoding/binary, hash/adler32, hash/crc32
245         < compress/bzip2, compress/flate, compress/lzw
246         < archive/zip, compress/gzip, compress/zlib;
247
248         # templates
249         FMT
250         < text/template/parse;
251
252         net/url, text/template/parse
253         < text/template
254         < internal/lazytemplate;
255
256         encoding/json, html, text/template
257         < html/template;
258
259         # regexp
260         FMT
261         < regexp/syntax
262         < regexp
263         < internal/lazyregexp;
264
265         # suffix array
266         encoding/binary, regexp
267         < index/suffixarray;
268
269         # executable parsing
270         FMT, encoding/binary, compress/zlib
271         < debug/dwarf
272         < debug/elf, debug/gosym, debug/macho, debug/pe, debug/plan9obj, internal/xcoff
273         < DEBUG;
274
275         # go parser and friends.
276         FMT
277         < go/token
278         < go/scanner
279         < go/ast
280         < go/parser;
281
282         go/parser, text/tabwriter
283         < go/printer
284         < go/format;
285
286         go/parser, internal/lazyregexp, text/template
287         < go/doc;
288
289         math/big, go/token
290         < go/constant;
291
292         container/heap, go/constant, go/parser, regexp
293         < go/types;
294
295         FMT
296         < go/build/constraint;
297
298         go/doc, go/parser, internal/goroot, internal/goversion
299         < go/build;
300
301         DEBUG, go/build, go/types, text/scanner
302         < go/internal/gcimporter, go/internal/gccgoimporter, go/internal/srcimporter
303         < go/importer;
304
305         # databases
306         FMT
307         < database/sql/internal
308         < database/sql/driver
309         < database/sql;
310
311         # images
312         FMT, compress/lzw, compress/zlib
313         < image/color
314         < image, image/color/palette
315         < image/internal/imageutil
316         < image/draw
317         < image/gif, image/jpeg, image/png;
318
319         # cgo, delayed as long as possible.
320         # If you add a dependency on CGO, you must add the package
321         # to cgoPackages in cmd/dist/test.go as well.
322         RUNTIME
323         < C
324         < runtime/cgo
325         < CGO
326         < runtime/race, runtime/msan;
327
328         # Bulk of the standard library must not use cgo.
329         # The prohibition stops at net and os/user.
330         C !< fmt, go/types;
331
332         CGO, OS
333         < plugin;
334
335         CGO, FMT
336         < os/user
337         < archive/tar;
338
339         sync
340         < internal/singleflight;
341
342         os
343         < golang.org/x/net/dns/dnsmessage,
344           golang.org/x/net/lif,
345           golang.org/x/net/route;
346
347         # net is unavoidable when doing any networking,
348         # so large dependencies must be kept out.
349         # This is a long-looking list but most of these
350         # are small with few dependencies.
351         CGO,
352         golang.org/x/net/dns/dnsmessage,
353         golang.org/x/net/lif,
354         golang.org/x/net/route,
355         internal/nettrace,
356         internal/poll,
357         internal/singleflight,
358         internal/race,
359         os
360         < net;
361
362         fmt, unicode !< net;
363         math/rand !< net; # net uses runtime instead
364
365         # NET is net plus net-helper packages.
366         FMT, net
367         < net/textproto;
368
369         mime, net/textproto, net/url
370         < NET;
371
372         # logging - most packages should not import; http and up is allowed
373         FMT
374         < log;
375
376         log !< crypto/tls, database/sql, go/importer, testing;
377
378         FMT, log, net
379         < log/syslog;
380
381         NET, log
382         < net/mail;
383
384         NONE < crypto/internal/boring/sig;
385         sync/atomic < crypto/internal/boring/fipstls;
386
387         encoding/binary, golang.org/x/sys/cpu, hash,
388         FMT, math/big,
389         CGO, crypto/internal/boring/sig, crypto/internal/boring/fipstls
390         < crypto
391         < crypto/subtle
392         < crypto/internal/subtle
393         < crypto/cipher
394         < encoding/asn1
395         < crypto/internal/boring
396         < crypto/aes, crypto/des, crypto/hmac, crypto/md5, crypto/rc4,
397           crypto/sha1, crypto/sha256, crypto/sha512
398         < crypto/rand
399         < crypto/internal/randutil
400         < crypto/ed25519/internal/edwards25519
401         < crypto/ed25519
402         < golang.org/x/crypto/cryptobyte/asn1
403         < golang.org/x/crypto/cryptobyte
404         < golang.org/x/crypto/curve25519
405         < crypto/dsa, crypto/elliptic, crypto/rsa
406         < crypto/ecdsa
407         < CRYPTO-BORING;
408
409         net !< CRYPTO-BORING;
410
411         # TLS, Prince of Dependencies.
412         CRYPTO-BORING, NET, container/list, encoding/hex, encoding/pem
413         < golang.org/x/crypto/internal/subtle
414         < golang.org/x/crypto/chacha20
415         < golang.org/x/crypto/poly1305
416         < golang.org/x/crypto/chacha20poly1305
417         < golang.org/x/crypto/hkdf
418         < crypto/x509/internal/macos
419         < crypto/x509/pkix
420         < crypto/x509
421         < crypto/tls;
422
423         crypto/internal/boring/sig, crypto/internal/boring/fipstls
424         < crypto/tls/fipsonly;
425
426         crypto/internal/boring
427         < crypto/boring;
428
429         # crypto-aware packages
430
431         NET, crypto/rand, mime/quotedprintable
432         < mime/multipart;
433
434         crypto/tls
435         < net/smtp;
436
437         # HTTP, King of Dependencies.
438
439         FMT
440         < golang.org/x/net/http2/hpack, net/http/internal;
441
442         FMT, NET, container/list, encoding/binary, log
443         < golang.org/x/text/transform
444         < golang.org/x/text/unicode/norm
445         < golang.org/x/text/unicode/bidi
446         < golang.org/x/text/secure/bidirule
447         < golang.org/x/net/idna
448         < golang.org/x/net/http/httpguts, golang.org/x/net/http/httpproxy;
449
450         NET, crypto/tls
451         < net/http/httptrace;
452
453         compress/gzip,
454         golang.org/x/net/http/httpguts,
455         golang.org/x/net/http/httpproxy,
456         golang.org/x/net/http2/hpack,
457         net/http/internal,
458         net/http/httptrace,
459         mime/multipart,
460         log
461         < net/http;
462
463         # HTTP-aware packages
464
465         encoding/json, net/http
466         < expvar;
467
468         net/http
469         < net/http/cookiejar, net/http/httputil;
470
471         net/http, flag
472         < net/http/httptest;
473
474         net/http, regexp
475         < net/http/cgi
476         < net/http/fcgi;
477
478         # Profiling
479         FMT, compress/gzip, encoding/binary, text/tabwriter
480         < runtime/pprof;
481
482         OS, compress/gzip, regexp
483         < internal/profile;
484
485         html, internal/profile, net/http, runtime/pprof, runtime/trace
486         < net/http/pprof;
487
488         # RPC
489         encoding/gob, encoding/json, go/token, html/template, net/http
490         < net/rpc
491         < net/rpc/jsonrpc;
492
493         # System Information
494         internal/cpu, sync
495         < internal/sysinfo;
496
497         # Test-only
498         log
499         < testing/iotest
500         < testing/fstest;
501
502         FMT, flag, math/rand
503         < testing/quick;
504
505         FMT, flag, runtime/debug, runtime/trace, internal/sysinfo
506         < testing;
507
508         internal/testlog, runtime/pprof, regexp
509         < testing/internal/testdeps;
510
511         OS, flag, testing, internal/cfg
512         < internal/testenv;
513
514         OS, encoding/base64
515         < internal/obscuretestdata;
516
517         CGO, OS, fmt
518         < os/signal/internal/pty;
519
520         NET, testing, math/rand
521         < golang.org/x/net/nettest;
522
523         FMT, container/heap, math/rand
524         < internal/trace;
525 `
526
527 // listStdPkgs returns the same list of packages as "go list std".
528 func listStdPkgs(goroot string) ([]string, error) {
529         // Based on cmd/go's matchPackages function.
530         var pkgs []string
531
532         src := filepath.Join(goroot, "src") + string(filepath.Separator)
533         walkFn := func(path string, d fs.DirEntry, err error) error {
534                 if err != nil || !d.IsDir() || path == src {
535                         return nil
536                 }
537
538                 base := filepath.Base(path)
539                 if strings.HasPrefix(base, ".") || strings.HasPrefix(base, "_") || base == "testdata" {
540                         return filepath.SkipDir
541                 }
542
543                 name := filepath.ToSlash(path[len(src):])
544                 if name == "builtin" || name == "cmd" {
545                         return filepath.SkipDir
546                 }
547
548                 pkgs = append(pkgs, strings.TrimPrefix(name, "vendor/"))
549                 return nil
550         }
551         if err := filepath.WalkDir(src, walkFn); err != nil {
552                 return nil, err
553         }
554         return pkgs, nil
555 }
556
557 func TestDependencies(t *testing.T) {
558         if !testenv.HasSrc() {
559                 // Tests run in a limited file system and we do not
560                 // provide access to every source file.
561                 t.Skipf("skipping on %s/%s, missing full GOROOT", runtime.GOOS, runtime.GOARCH)
562         }
563
564         ctxt := Default
565         all, err := listStdPkgs(ctxt.GOROOT)
566         if err != nil {
567                 t.Fatal(err)
568         }
569         sort.Strings(all)
570
571         sawImport := map[string]map[string]bool{} // from package => to package => true
572         policy := depsPolicy(t)
573
574         for _, pkg := range all {
575                 imports, err := findImports(pkg)
576                 if err != nil {
577                         t.Error(err)
578                         continue
579                 }
580                 if sawImport[pkg] == nil {
581                         sawImport[pkg] = map[string]bool{}
582                 }
583                 ok := policy[pkg]
584                 var bad []string
585                 for _, imp := range imports {
586                         sawImport[pkg][imp] = true
587                         if !ok[imp] {
588                                 bad = append(bad, imp)
589                         }
590                 }
591                 if bad != nil {
592                         t.Errorf("unexpected dependency: %s imports %v", pkg, bad)
593                 }
594         }
595
596         // depPath returns the path between the given from and to packages.
597         // It returns the empty string if there's no dependency path.
598         var depPath func(string, string) string
599         depPath = func(from, to string) string {
600                 if sawImport[from][to] {
601                         return from + " => " + to
602                 }
603                 for pkg := range sawImport[from] {
604                         if p := depPath(pkg, to); p != "" {
605                                 return from + " => " + p
606                         }
607                 }
608                 return ""
609         }
610 }
611
612 var buildIgnore = []byte("\n// +build ignore")
613
614 func findImports(pkg string) ([]string, error) {
615         vpkg := pkg
616         if strings.HasPrefix(pkg, "golang.org") {
617                 vpkg = "vendor/" + pkg
618         }
619         dir := filepath.Join(Default.GOROOT, "src", vpkg)
620         files, err := os.ReadDir(dir)
621         if err != nil {
622                 return nil, err
623         }
624         var imports []string
625         var haveImport = map[string]bool{}
626         fset := token.NewFileSet()
627         for _, file := range files {
628                 name := file.Name()
629                 if name == "slice_go14.go" || name == "slice_go18.go" {
630                         // These files are for compiler bootstrap with older versions of Go and not built in the standard build.
631                         continue
632                 }
633                 if !strings.HasSuffix(name, ".go") || strings.HasSuffix(name, "_test.go") {
634                         continue
635                 }
636                 info := fileInfo{
637                         name: filepath.Join(dir, name),
638                         fset: fset,
639                 }
640                 f, err := os.Open(info.name)
641                 if err != nil {
642                         return nil, err
643                 }
644                 err = readGoInfo(f, &info)
645                 f.Close()
646                 if err != nil {
647                         return nil, fmt.Errorf("reading %v: %v", name, err)
648                 }
649                 if bytes.Contains(info.header, buildIgnore) {
650                         continue
651                 }
652                 for _, imp := range info.imports {
653                         path := imp.path
654                         if !haveImport[path] {
655                                 haveImport[path] = true
656                                 imports = append(imports, path)
657                         }
658                 }
659         }
660         sort.Strings(imports)
661         return imports, nil
662 }
663
664 // depsPolicy returns a map m such that m[p][d] == true when p can import d.
665 func depsPolicy(t *testing.T) map[string]map[string]bool {
666         allowed := map[string]map[string]bool{"NONE": {}}
667         disallowed := [][2][]string{}
668
669         parseDepsRules(t, func(deps []string, op string, users []string) {
670                 if op == "!<" {
671                         disallowed = append(disallowed, [2][]string{deps, users})
672                         return
673                 }
674                 for _, u := range users {
675                         if allowed[u] != nil {
676                                 t.Errorf("multiple deps lists for %s", u)
677                         }
678                         allowed[u] = make(map[string]bool)
679                         for _, d := range deps {
680                                 if allowed[d] == nil {
681                                         t.Errorf("use of %s before its deps list", d)
682                                 }
683                                 allowed[u][d] = true
684                         }
685                 }
686         })
687
688         // Check for missing deps info.
689         for _, deps := range allowed {
690                 for d := range deps {
691                         if allowed[d] == nil {
692                                 t.Errorf("missing deps list for %s", d)
693                         }
694                 }
695         }
696
697         // Complete transitive allowed deps.
698         for k := range allowed {
699                 for i := range allowed {
700                         for j := range allowed {
701                                 if i != k && k != j && allowed[i][k] && allowed[k][j] {
702                                         if i == j {
703                                                 // Can only happen along with a "use of X before deps" error above,
704                                                 // but this error is more specific - it makes clear that reordering the
705                                                 // rules will not be enough to fix the problem.
706                                                 t.Errorf("deps policy cycle: %s < %s < %s", j, k, i)
707                                         }
708                                         allowed[i][j] = true
709                                 }
710                         }
711                 }
712         }
713
714         // Check negative assertions against completed allowed deps.
715         for _, bad := range disallowed {
716                 deps, users := bad[0], bad[1]
717                 for _, d := range deps {
718                         for _, u := range users {
719                                 if allowed[u][d] {
720                                         t.Errorf("deps policy incorrect: assertion failed: %s !< %s", d, u)
721                                 }
722                         }
723                 }
724         }
725
726         if t.Failed() {
727                 t.FailNow()
728         }
729
730         return allowed
731 }
732
733 // parseDepsRules parses depsRules, calling save(deps, op, users)
734 // for each deps < users or deps !< users rule
735 // (op is "<" or "!<").
736 func parseDepsRules(t *testing.T, save func(deps []string, op string, users []string)) {
737         p := &depsParser{t: t, lineno: 1, text: depsRules}
738
739         var prev []string
740         var op string
741         for {
742                 list, tok := p.nextList()
743                 if tok == "" {
744                         if prev == nil {
745                                 break
746                         }
747                         p.syntaxError("unexpected EOF")
748                 }
749                 if prev != nil {
750                         save(prev, op, list)
751                 }
752                 prev = list
753                 if tok == ";" {
754                         prev = nil
755                         op = ""
756                         continue
757                 }
758                 if tok != "<" && tok != "!<" {
759                         p.syntaxError("missing <")
760                 }
761                 op = tok
762         }
763 }
764
765 // A depsParser parses the depsRules syntax described above.
766 type depsParser struct {
767         t        *testing.T
768         lineno   int
769         lastWord string
770         text     string
771 }
772
773 // syntaxError reports a parsing error.
774 func (p *depsParser) syntaxError(msg string) {
775         p.t.Fatalf("deps:%d: syntax error: %s near %s", p.lineno, msg, p.lastWord)
776 }
777
778 // nextList parses and returns a comma-separated list of names.
779 func (p *depsParser) nextList() (list []string, token string) {
780         for {
781                 tok := p.nextToken()
782                 switch tok {
783                 case "":
784                         if len(list) == 0 {
785                                 return nil, ""
786                         }
787                         fallthrough
788                 case ",", "<", "!<", ";":
789                         p.syntaxError("bad list syntax")
790                 }
791                 list = append(list, tok)
792
793                 tok = p.nextToken()
794                 if tok != "," {
795                         return list, tok
796                 }
797         }
798 }
799
800 // nextToken returns the next token in the deps rules,
801 // one of ";" "," "<" "!<" or a name.
802 func (p *depsParser) nextToken() string {
803         for {
804                 if p.text == "" {
805                         return ""
806                 }
807                 switch p.text[0] {
808                 case ';', ',', '<':
809                         t := p.text[:1]
810                         p.text = p.text[1:]
811                         return t
812
813                 case '!':
814                         if len(p.text) < 2 || p.text[1] != '<' {
815                                 p.syntaxError("unexpected token !")
816                         }
817                         p.text = p.text[2:]
818                         return "!<"
819
820                 case '#':
821                         i := strings.Index(p.text, "\n")
822                         if i < 0 {
823                                 i = len(p.text)
824                         }
825                         p.text = p.text[i:]
826                         continue
827
828                 case '\n':
829                         p.lineno++
830                         fallthrough
831                 case ' ', '\t':
832                         p.text = p.text[1:]
833                         continue
834
835                 default:
836                         i := strings.IndexAny(p.text, "!;,<#\n \t")
837                         if i < 0 {
838                                 i = len(p.text)
839                         }
840                         t := p.text[:i]
841                         p.text = p.text[i:]
842                         p.lastWord = t
843                         return t
844                 }
845         }
846 }
847
848 // TestStdlibLowercase tests that all standard library package names are
849 // lowercase. See Issue 40065.
850 func TestStdlibLowercase(t *testing.T) {
851         if !testenv.HasSrc() {
852                 t.Skipf("skipping on %s/%s, missing full GOROOT", runtime.GOOS, runtime.GOARCH)
853         }
854
855         ctxt := Default
856         all, err := listStdPkgs(ctxt.GOROOT)
857         if err != nil {
858                 t.Fatal(err)
859         }
860
861         for _, pkgname := range all {
862                 if strings.ToLower(pkgname) != pkgname {
863                         t.Errorf("package %q should not use upper-case path", pkgname)
864                 }
865         }
866 }
867
868 // TestFindImports tests that findImports works.  See #43249.
869 func TestFindImports(t *testing.T) {
870         imports, err := findImports("go/build")
871         if err != nil {
872                 t.Fatal(err)
873         }
874         t.Logf("go/build imports %q", imports)
875         want := []string{"bytes", "os", "path/filepath", "strings"}
876 wantLoop:
877         for _, w := range want {
878                 for _, imp := range imports {
879                         if imp == w {
880                                 continue wantLoop
881                         }
882                 }
883                 t.Errorf("expected to find %q in import list", w)
884         }
885 }