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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
e8921f0e
Commit
e8921f0e
authored
Jun 29, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d617938d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
go/xcommon/tracing/cmd/gotrace/gotrace.go
go/xcommon/tracing/cmd/gotrace/gotrace.go
+6
-2
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
+10
-9
No files found.
go/xcommon/tracing/cmd/gotrace/gotrace.go
View file @
e8921f0e
...
...
@@ -406,14 +406,18 @@ func writeFile(path string, data []byte) error {
return
ioutil
.
WriteFile
(
path
,
data
,
0666
)
}
// removeFile
removes
file at path after checking it is safe to write to that file
// removeFile
make sure there is no
file at path after checking it is safe to write to that file
func
removeFile
(
path
string
)
error
{
err
:=
checkCanWrite
(
path
)
if
err
!=
nil
{
return
err
}
return
os
.
Remove
(
path
)
err
=
os
.
Remove
(
path
)
if
e
,
ok
:=
err
.
(
*
os
.
PathError
);
ok
&&
os
.
IsNotExist
(
e
.
Err
)
{
err
=
nil
}
return
err
}
type
Buffer
struct
{
...
...
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
View file @
e8921f0e
package
main
import
(
"
bytes
"
"
fmt
"
"go/build"
"io/ioutil"
"os"
...
...
@@ -100,16 +100,17 @@ func xprepareTree(src, dst string, mode TreePrepareMode) {
// diffR compares two directories recursively
func
diffR
(
patha
,
pathb
string
)
(
diff
string
,
err
error
)
{
out
:=
&
bytes
.
Buffer
{}
cmd
:=
exec
.
Command
(
"diff"
,
"-urN"
,
patha
,
pathb
)
cmd
.
Stdout
=
out
err
=
cmd
.
Run
()
if
e
,
ok
:=
err
.
(
*
exec
.
ExitError
);
ok
&&
e
.
Sys
()
.
(
syscall
.
WaitStatus
)
.
ExitStatus
()
==
1
{
err
=
nil
// diff signals with 1 just a difference - problem exit code is 2
out
,
err
:=
cmd
.
Output
()
if
e
,
ok
:=
err
.
(
*
exec
.
ExitError
);
ok
{
if
e
.
Sys
()
.
(
syscall
.
WaitStatus
)
.
ExitStatus
()
==
1
{
err
=
nil
// diff signals with 1 just a difference - problem exit code is 2
}
else
{
err
=
fmt
.
Errorf
(
"diff %s %s:
\n
%s"
,
patha
,
pathb
,
e
.
Stderr
)
}
}
return
out
.
String
(
),
err
return
string
(
out
),
err
}
func
TestGoTraceGen
(
t
*
testing
.
T
)
{
...
...
@@ -143,7 +144,7 @@ func TestGoTraceGen(t *testing.T) {
t
.
Errorf
(
"%v: %v"
,
tpkg
,
err
)
}
diff
,
err
:=
diffR
(
good
+
"/
"
+
tpkg
,
work
+
"
/"
+
tpkg
)
diff
,
err
:=
diffR
(
good
+
"/
src/"
+
tpkg
,
work
+
"/src
/"
+
tpkg
)
if
err
!=
nil
{
t
.
Fatalf
(
"%v: %v"
,
tpkg
,
err
)
}
...
...
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