File tree 1 file changed +11
-7
lines changed
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 7
7
"go/parser"
8
8
"go/scanner"
9
9
"go/token"
10
+ "go/types"
10
11
"strings"
11
12
"time"
12
13
@@ -62,13 +63,16 @@ func main() {
62
63
63
64
packages := make (map [string ]* compiler.Archive )
64
65
var pkgsToLoad map [string ]struct {}
65
- importContext := compiler .NewImportContext (func (path string ) (* compiler.Archive , error ) {
66
- if pkg , found := packages [path ]; found {
67
- return pkg , nil
68
- }
69
- pkgsToLoad [path ] = struct {}{}
70
- return & compiler.Archive {}, nil
71
- })
66
+ importContext := & compiler.ImportContext {
67
+ Packages : map [string ]* types.Package {"unsafe" : types .Unsafe },
68
+ Import : func (path string ) (* compiler.Archive , error ) {
69
+ if pkg , found := packages [path ]; found {
70
+ return pkg , nil
71
+ }
72
+ pkgsToLoad [path ] = struct {}{}
73
+ return & compiler.Archive {}, nil
74
+ },
75
+ }
72
76
fileSet := token .NewFileSet ()
73
77
pkgsReceived := 0
74
78
You can’t perform that action at this time.
0 commit comments