Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
fa87929a
Commit
fa87929a
authored
Feb 14, 2019
by
Matthew Halpern
Committed by
Péter Szilágyi
Feb 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: prefer nil slices over zero-length slices (#19077)
parent
e26a119c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
12 additions
and
12 deletions
+12
-12
main.go
cmd/abigen/main.go
+1
-1
monitorcmd.go
cmd/geth/monitorcmd.go
+3
-3
usage.go
cmd/geth/usage.go
+1
-1
access.go
cmd/swarm/access.go
+2
-2
access_test.go
cmd/swarm/access_test.go
+2
-2
fs.go
cmd/swarm/fs.go
+1
-1
sliding_window.go
cmd/swarm/swarm-smoke/sliding_window.go
+1
-1
flags.go
cmd/utils/flags.go
+1
-1
No files found.
cmd/abigen/main.go
View file @
fa87929a
...
@@ -124,7 +124,7 @@ func main() {
...
@@ -124,7 +124,7 @@ func main() {
}
}
abis
=
append
(
abis
,
string
(
abi
))
abis
=
append
(
abis
,
string
(
abi
))
bin
:=
[]
byte
{}
var
bin
[]
byte
if
*
binFlag
!=
""
{
if
*
binFlag
!=
""
{
if
bin
,
err
=
ioutil
.
ReadFile
(
*
binFlag
);
err
!=
nil
{
if
bin
,
err
=
ioutil
.
ReadFile
(
*
binFlag
);
err
!=
nil
{
fmt
.
Printf
(
"Failed to read input bytecode: %v
\n
"
,
err
)
fmt
.
Printf
(
"Failed to read input bytecode: %v
\n
"
,
err
)
...
...
cmd/geth/monitorcmd.go
View file @
fa87929a
...
@@ -169,7 +169,7 @@ func retrieveMetrics(client *rpc.Client) (map[string]interface{}, error) {
...
@@ -169,7 +169,7 @@ func retrieveMetrics(client *rpc.Client) (map[string]interface{}, error) {
// resolveMetrics takes a list of input metric patterns, and resolves each to one
// resolveMetrics takes a list of input metric patterns, and resolves each to one
// or more canonical metric names.
// or more canonical metric names.
func
resolveMetrics
(
metrics
map
[
string
]
interface
{},
patterns
[]
string
)
[]
string
{
func
resolveMetrics
(
metrics
map
[
string
]
interface
{},
patterns
[]
string
)
[]
string
{
res
:=
[]
string
{}
var
res
[]
string
for
_
,
pattern
:=
range
patterns
{
for
_
,
pattern
:=
range
patterns
{
res
=
append
(
res
,
resolveMetric
(
metrics
,
pattern
,
""
)
...
)
res
=
append
(
res
,
resolveMetric
(
metrics
,
pattern
,
""
)
...
)
}
}
...
@@ -179,7 +179,7 @@ func resolveMetrics(metrics map[string]interface{}, patterns []string) []string
...
@@ -179,7 +179,7 @@ func resolveMetrics(metrics map[string]interface{}, patterns []string) []string
// resolveMetrics takes a single of input metric pattern, and resolves it to one
// resolveMetrics takes a single of input metric pattern, and resolves it to one
// or more canonical metric names.
// or more canonical metric names.
func
resolveMetric
(
metrics
map
[
string
]
interface
{},
pattern
string
,
path
string
)
[]
string
{
func
resolveMetric
(
metrics
map
[
string
]
interface
{},
pattern
string
,
path
string
)
[]
string
{
results
:=
[]
string
{}
var
results
[]
string
// If a nested metric was requested, recurse optionally branching (via comma)
// If a nested metric was requested, recurse optionally branching (via comma)
parts
:=
strings
.
SplitN
(
pattern
,
"/"
,
2
)
parts
:=
strings
.
SplitN
(
pattern
,
"/"
,
2
)
...
@@ -215,7 +215,7 @@ func resolveMetric(metrics map[string]interface{}, pattern string, path string)
...
@@ -215,7 +215,7 @@ func resolveMetric(metrics map[string]interface{}, pattern string, path string)
// expandMetrics expands the entire tree of metrics into a flat list of paths.
// expandMetrics expands the entire tree of metrics into a flat list of paths.
func
expandMetrics
(
metrics
map
[
string
]
interface
{},
path
string
)
[]
string
{
func
expandMetrics
(
metrics
map
[
string
]
interface
{},
path
string
)
[]
string
{
// Iterate over all fields and expand individually
// Iterate over all fields and expand individually
list
:=
[]
string
{}
var
list
[]
string
for
name
,
metric
:=
range
metrics
{
for
name
,
metric
:=
range
metrics
{
switch
metric
:=
metric
.
(
type
)
{
switch
metric
:=
metric
.
(
type
)
{
case
float64
:
case
float64
:
...
...
cmd/geth/usage.go
View file @
fa87929a
...
@@ -308,7 +308,7 @@ func init() {
...
@@ -308,7 +308,7 @@ func init() {
categorized
[
flag
.
String
()]
=
struct
{}{}
categorized
[
flag
.
String
()]
=
struct
{}{}
}
}
}
}
uncategorized
:=
[]
cli
.
Flag
{}
var
uncategorized
[]
cli
.
Flag
for
_
,
flag
:=
range
data
.
(
*
cli
.
App
)
.
Flags
{
for
_
,
flag
:=
range
data
.
(
*
cli
.
App
)
.
Flags
{
if
_
,
ok
:=
categorized
[
flag
.
String
()];
!
ok
{
if
_
,
ok
:=
categorized
[
flag
.
String
()];
!
ok
{
if
strings
.
HasPrefix
(
flag
.
GetName
(),
"dashboard"
)
{
if
strings
.
HasPrefix
(
flag
.
GetName
(),
"dashboard"
)
{
...
...
cmd/swarm/access.go
View file @
fa87929a
...
@@ -178,8 +178,8 @@ func accessNewACT(ctx *cli.Context) {
...
@@ -178,8 +178,8 @@ func accessNewACT(ctx *cli.Context) {
accessKey
[]
byte
accessKey
[]
byte
err
error
err
error
ref
=
args
[
0
]
ref
=
args
[
0
]
pkGrantees
=
[]
string
{}
pkGrantees
[]
string
passGrantees
=
[]
string
{}
passGrantees
[]
string
pkGranteesFilename
=
ctx
.
String
(
SwarmAccessGrantKeysFlag
.
Name
)
pkGranteesFilename
=
ctx
.
String
(
SwarmAccessGrantKeysFlag
.
Name
)
passGranteesFilename
=
ctx
.
String
(
utils
.
PasswordFileFlag
.
Name
)
passGranteesFilename
=
ctx
.
String
(
utils
.
PasswordFileFlag
.
Name
)
privateKey
=
getPrivKey
(
ctx
)
privateKey
=
getPrivKey
(
ctx
)
...
...
cmd/swarm/access_test.go
View file @
fa87929a
...
@@ -397,7 +397,7 @@ func testACT(t *testing.T, bogusEntries int) {
...
@@ -397,7 +397,7 @@ func testACT(t *testing.T, bogusEntries int) {
}
}
ref
:=
matches
[
0
]
ref
:=
matches
[
0
]
grantees
:=
[]
string
{}
var
grantees
[]
string
for
i
,
v
:=
range
cluster
.
Nodes
{
for
i
,
v
:=
range
cluster
.
Nodes
{
if
i
==
nodeToSkip
{
if
i
==
nodeToSkip
{
continue
continue
...
@@ -408,7 +408,7 @@ func testACT(t *testing.T, bogusEntries int) {
...
@@ -408,7 +408,7 @@ func testACT(t *testing.T, bogusEntries int) {
}
}
if
bogusEntries
>
0
{
if
bogusEntries
>
0
{
bogusGrantees
:=
[]
string
{}
var
bogusGrantees
[]
string
for
i
:=
0
;
i
<
bogusEntries
;
i
++
{
for
i
:=
0
;
i
<
bogusEntries
;
i
++
{
prv
,
err
:=
ecies
.
GenerateKey
(
rand
.
Reader
,
DefaultCurve
,
nil
)
prv
,
err
:=
ecies
.
GenerateKey
(
rand
.
Reader
,
DefaultCurve
,
nil
)
...
...
cmd/swarm/fs.go
View file @
fa87929a
...
@@ -123,7 +123,7 @@ func listMounts(cliContext *cli.Context) {
...
@@ -123,7 +123,7 @@ func listMounts(cliContext *cli.Context) {
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
defer
cancel
()
mf
:=
[]
fuse
.
MountInfo
{}
var
mf
[]
fuse
.
MountInfo
err
=
client
.
CallContext
(
ctx
,
&
mf
,
"swarmfs_listmounts"
)
err
=
client
.
CallContext
(
ctx
,
&
mf
,
"swarmfs_listmounts"
)
if
err
!=
nil
{
if
err
!=
nil
{
utils
.
Fatalf
(
"encountered an error calling the RPC endpoint while listing mounts: %v"
,
err
)
utils
.
Fatalf
(
"encountered an error calling the RPC endpoint while listing mounts: %v"
,
err
)
...
...
cmd/swarm/swarm-smoke/sliding_window.go
View file @
fa87929a
...
@@ -56,7 +56,7 @@ func slidingWindowCmd(ctx *cli.Context, tuid string) error {
...
@@ -56,7 +56,7 @@ func slidingWindowCmd(ctx *cli.Context, tuid string) error {
}
}
func
slidingWindow
(
ctx
*
cli
.
Context
,
tuid
string
)
error
{
func
slidingWindow
(
ctx
*
cli
.
Context
,
tuid
string
)
error
{
hashes
:=
[]
uploadResult
{}
//swarm hashes of the uploads
var
hashes
[]
uploadResult
//swarm hashes of the uploads
nodes
:=
len
(
hosts
)
nodes
:=
len
(
hosts
)
const
iterationTimeout
=
30
*
time
.
Second
const
iterationTimeout
=
30
*
time
.
Second
log
.
Info
(
"sliding window test started"
,
"tuid"
,
tuid
,
"nodes"
,
nodes
,
"filesize(kb)"
,
filesize
,
"timeout"
,
timeout
)
log
.
Info
(
"sliding window test started"
,
"tuid"
,
tuid
,
"nodes"
,
nodes
,
"filesize(kb)"
,
filesize
,
"timeout"
,
timeout
)
...
...
cmd/utils/flags.go
View file @
fa87929a
...
@@ -1613,7 +1613,7 @@ func MakeConsolePreloads(ctx *cli.Context) []string {
...
@@ -1613,7 +1613,7 @@ func MakeConsolePreloads(ctx *cli.Context) []string {
return
nil
return
nil
}
}
// Otherwise resolve absolute paths and return them
// Otherwise resolve absolute paths and return them
preloads
:=
[]
string
{}
var
preloads
[]
string
assets
:=
ctx
.
GlobalString
(
JSpathFlag
.
Name
)
assets
:=
ctx
.
GlobalString
(
JSpathFlag
.
Name
)
for
_
,
file
:=
range
strings
.
Split
(
ctx
.
GlobalString
(
PreloadJSFlag
.
Name
),
","
)
{
for
_
,
file
:=
range
strings
.
Split
(
ctx
.
GlobalString
(
PreloadJSFlag
.
Name
),
","
)
{
...
...
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