File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ type typeCheckBatch struct {
62
62
syntaxIndex map [PackageID ]int // requested ID -> index in ids
63
63
pre preTypeCheck
64
64
post postTypeCheck
65
- handles map [PackageID ]* packageHandle
65
+ handles map [PackageID ]* packageHandle // (immutable)
66
66
parseCache * parseCache
67
67
fset * token.FileSet // describes all parsed or imported files
68
68
cpulimit chan unit // concurrency limiter for CPU-bound operations
@@ -473,6 +473,7 @@ func (b *typeCheckBatch) getImportPackage(ctx context.Context, id PackageID) (pk
473
473
474
474
// Do a second check for "unsafe" defensively, due to golang/go#60890.
475
475
if ph .mp .PkgPath == "unsafe" {
476
+ // (This assertion is reached.)
476
477
bug .Reportf ("encountered \" unsafe\" as %s (golang/go#60890)" , id )
477
478
return types .Unsafe , nil
478
479
}
@@ -957,6 +958,11 @@ func (s *Snapshot) getPackageHandles(ctx context.Context, ids []PackageID) (map[
957
958
for _ , v := range b .nodes {
958
959
assert (v .ph != nil , "nil handle" )
959
960
handles [v .mp .ID ] = v .ph
961
+
962
+ // debugging #60890
963
+ if v .ph .mp .PkgPath == "unsafe" && v .mp .ID != "unsafe" {
964
+ bug .Reportf ("PackagePath \" unsafe\" with ID %q" , v .mp .ID )
965
+ }
960
966
}
961
967
962
968
return handles , nil
Original file line number Diff line number Diff line change @@ -353,6 +353,11 @@ func buildMetadata(updates map[PackageID]*metadata.Package, pkg *packages.Packag
353
353
pkgPath := PackagePath (pkg .PkgPath )
354
354
id := PackageID (pkg .ID )
355
355
356
+ // debugging #60890
357
+ if pkg .PkgPath == "unsafe" && pkg .ID != "unsafe" {
358
+ bug .Reportf ("PackagePath \" unsafe\" with ID %q" , pkg .ID )
359
+ }
360
+
356
361
if metadata .IsCommandLineArguments (id ) {
357
362
var f string // file to use as disambiguating suffix
358
363
if len (pkg .CompiledGoFiles ) > 0 {
@@ -369,7 +374,7 @@ func buildMetadata(updates map[PackageID]*metadata.Package, pkg *packages.Packag
369
374
// A file=empty.go query results in IgnoredFiles=[empty.go].
370
375
f = pkg .IgnoredFiles [0 ]
371
376
} else {
372
- bug .Reportf ("command-line-arguments package has neither CompiledGoFiles nor IgnoredFiles: %#v" , "" ) //*pkg.Metadata )
377
+ bug .Reportf ("command-line-arguments package has neither CompiledGoFiles nor IgnoredFiles" )
373
378
return nil
374
379
}
375
380
id = PackageID (pkg .ID + f )
@@ -404,6 +409,11 @@ func buildMetadata(updates map[PackageID]*metadata.Package, pkg *packages.Packag
404
409
Standalone : standalone ,
405
410
}
406
411
412
+ // debugging #60890
413
+ if mp .PkgPath == "unsafe" && mp .ID != "unsafe" {
414
+ bug .Reportf ("PackagePath \" unsafe\" with ID %q" , mp .ID )
415
+ }
416
+
407
417
updates [id ] = mp
408
418
409
419
for _ , filename := range pkg .CompiledGoFiles {
You can’t perform that action at this time.
0 commit comments