@@ -40,17 +40,27 @@ func TestImports(t *testing.T) {
40
40
{{range .XTestImports -}}
41
41
{{$path}} {{.}}
42
42
{{end -}}` , "crypto/internal/fips140/..." )
43
- out , err := cmd .CombinedOutput ()
43
+ bout , err := cmd .CombinedOutput ()
44
44
if err != nil {
45
- t .Fatalf ("go list: %v\n %s" , err , out )
45
+ t .Fatalf ("go list: %v\n %s" , err , bout )
46
+ }
47
+ out := string (bout )
48
+
49
+ // In a snapshot, all the paths are crypto/internal/fips140/v1.2.3/...
50
+ // Determine the version number and remove it for the test.
51
+ _ , v , _ := strings .Cut (out , "crypto/internal/fips140/" )
52
+ v , _ , _ = strings .Cut (v , "/" )
53
+ v , _ , _ = strings .Cut (v , " " )
54
+ if strings .HasPrefix (v , "v" ) && strings .Count (v , "." ) == 2 {
55
+ out = strings .ReplaceAll (out , "crypto/internal/fips140/" + v , "crypto/internal/fips140" )
46
56
}
47
57
48
58
allPackages := make (map [string ]bool )
49
59
50
60
// importCheck is the set of packages that import crypto/internal/fips140/check.
51
61
importCheck := make (map [string ]bool )
52
62
53
- for _ , line := range strings .Split (string ( out ) , "\n " ) {
63
+ for _ , line := range strings .Split (out , "\n " ) {
54
64
if line == "" {
55
65
continue
56
66
}
0 commit comments