Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go-fuse
Commits
6a08a74a
Commit
6a08a74a
authored
Aug 24, 2024
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmark: simplify ReadLines
Change-Id: I683c0f614f67e787229d0754354a25f225184995
parent
a8693e36
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
18 deletions
+8
-18
benchmark/benchmark.go
benchmark/benchmark.go
+8
-18
No files found.
benchmark/benchmark.go
View file @
6a08a74a
...
@@ -7,32 +7,22 @@ package benchmark
...
@@ -7,32 +7,22 @@ package benchmark
// Routines for benchmarking fuse.
// Routines for benchmarking fuse.
import
(
import
(
"b
ufio
"
"b
ytes
"
"log"
"log"
"os"
"os"
)
)
func
ReadLines
(
name
string
)
[]
string
{
func
ReadLines
(
name
string
)
[]
string
{
f
,
err
:=
os
.
Open
(
name
)
data
,
err
:=
os
.
ReadFile
(
name
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
"Read
Lines
: "
,
err
)
log
.
Fatal
(
"Read
File
: "
,
err
)
}
}
defer
f
.
Close
()
r
:=
bufio
.
NewReader
(
f
)
l
:=
[]
string
{}
var
lines
[]
string
for
{
for
_
,
l
:=
range
bytes
.
Split
(
data
,
[]
byte
(
"
\n
"
))
{
line
,
_
,
err
:=
r
.
ReadLine
()
if
len
(
l
)
>
0
{
if
line
==
nil
||
err
!=
nil
{
lines
=
append
(
lines
,
string
(
l
))
break
}
}
fn
:=
string
(
line
)
l
=
append
(
l
,
fn
)
}
if
len
(
l
)
==
0
{
log
.
Fatal
(
"no files added"
)
}
}
return
lines
return
l
}
}
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