Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
a87dac1b
Commit
a87dac1b
authored
Jul 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
219f3139
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
go/xcommon/tracing/cmd/gotrace/gotrace.go
go/xcommon/tracing/cmd/gotrace/gotrace.go
+11
-3
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
+1
-1
No files found.
go/xcommon/tracing/cmd/gotrace/gotrace.go
View file @
a87dac1b
...
@@ -193,24 +193,32 @@ func packageTrace(prog *loader.Program, pkgi *loader.PackageInfo) (*Package, err
...
@@ -193,24 +193,32 @@ func packageTrace(prog *loader.Program, pkgi *loader.PackageInfo) (*Package, err
tconf
:=
&
types
.
Config
{
tconf
:=
&
types
.
Config
{
Importer
:
&
progImporter
{
prog
},
Importer
:
&
progImporter
{
prog
},
// XXX to ignore traceXXX() calls from original package code
IgnoreFuncBodies
:
true
,
// we took imports from original source file verbatim,
// we took imports from original source file verbatim,
// but most of them probably won't be used.
// but most of them probably won't be used.
DisableUnusedImportCheck
:
true
,
DisableUnusedImportCheck
:
true
,
}
}
tfset
:=
token
.
NewFileSet
()
// XXX ok to separate or use original package fset?
//
tfset := token.NewFileSet() // XXX ok to separate or use original package fset?
tpkg
:=
types
.
NewPackage
(
pkgi
.
Pkg
.
Path
(),
pkgi
.
Pkg
.
Name
())
tpkg
:=
types
.
NewPackage
(
pkgi
.
Pkg
.
Path
(),
pkgi
.
Pkg
.
Name
())
tinfo
:=
&
types
.
Info
{
Types
:
make
(
map
[
ast
.
Expr
]
types
.
TypeAndValue
)}
tinfo
:=
&
types
.
Info
{
Types
:
make
(
map
[
ast
.
Expr
]
types
.
TypeAndValue
)}
p
:=
&
Package
{
p
:=
&
Package
{
Pkgi
:
pkgi
,
Pkgi
:
pkgi
,
traceFset
:
tfset
,
// traceFset: tfset,
traceChecker
:
types
.
NewChecker
(
tconf
,
tfset
,
tpkg
,
tinfo
),
// traceChecker: types.NewChecker(tconf, tfset, tpkg, tinfo),
// XXX vvv do we need separate field for traceFset if it is = prog.Fset?
traceFset
:
prog
.
Fset
,
traceChecker
:
types
.
NewChecker
(
tconf
,
prog
.
Fset
,
tpkg
,
tinfo
),
tracePkg
:
tpkg
,
tracePkg
:
tpkg
,
traceTypeInfo
:
tinfo
,
traceTypeInfo
:
tinfo
,
}
}
// preload original package files into tracing package
// preload original package files into tracing package
fmt
.
Println
(
"FFF"
,
p
.
Pkgi
.
Files
)
err
:=
p
.
traceChecker
.
Files
(
p
.
Pkgi
.
Files
)
err
:=
p
.
traceChecker
.
Files
(
p
.
Pkgi
.
Files
)
if
err
!=
nil
{
if
err
!=
nil
{
// must not happen
// must not happen
...
...
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
View file @
a87dac1b
...
@@ -133,7 +133,7 @@ func TestGoTraceGen(t *testing.T) {
...
@@ -133,7 +133,7 @@ func TestGoTraceGen(t *testing.T) {
}
}
// XXX autodetect (go list ?)
// XXX autodetect (go list ?)
testv
:=
[]
string
{
"a/pkg1"
}
// XXX
, "b/pkg2", "c/pkg3"}
testv
:=
[]
string
{
"a/pkg1"
,
"b/pkg2"
,
"c/pkg3"
}
for
_
,
tpkg
:=
range
testv
{
for
_
,
tpkg
:=
range
testv
{
err
=
tracegen
(
tpkg
,
tBuildCtx
,
""
/* = local imorts disabled */
)
err
=
tracegen
(
tpkg
,
tBuildCtx
,
""
/* = local imorts disabled */
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment