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
7caa2d81
Unverified
Commit
7caa2d81
authored
May 09, 2022
by
s7v7nislands
Committed by
GitHub
May 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: replace strings.Replace with string.ReplaceAll (#24835)
parent
86d54770
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
13 additions
and
13 deletions
+13
-13
bind.go
accounts/abi/bind/bind.go
+1
-1
template.go
accounts/abi/bind/template.go
+1
-1
type.go
accounts/abi/type.go
+1
-1
downloader_test.go
eth/downloader/downloader_test.go
+2
-2
ethstats.go
ethstats/ethstats.go
+1
-1
api.go
internal/debug/api.go
+2
-2
downloader_test.go
les/downloader/downloader_test.go
+2
-2
collector.go
metrics/prometheus/collector.go
+1
-1
natupnp_test.go
p2p/nat/natupnp_test.go
+1
-1
decode_test.go
rlp/decode_test.go
+1
-1
No files found.
accounts/abi/bind/bind.go
View file @
7caa2d81
...
...
@@ -179,7 +179,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
contracts
[
types
[
i
]]
=
&
tmplContract
{
Type
:
capitalise
(
types
[
i
]),
InputABI
:
strings
.
Replace
(
strippedABI
,
"
\"
"
,
"
\\\"
"
,
-
1
),
InputABI
:
strings
.
Replace
All
(
strippedABI
,
"
\"
"
,
"
\\\"
"
),
InputBin
:
strings
.
TrimPrefix
(
strings
.
TrimSpace
(
bytecodes
[
i
]),
"0x"
),
Constructor
:
evmABI
.
Constructor
,
Calls
:
calls
,
...
...
accounts/abi/bind/template.go
View file @
7caa2d81
...
...
@@ -161,7 +161,7 @@ var (
}
{{range $pattern, $name := .Libraries}}
{{decapitalise $name}}Addr, _, _, _ := Deploy{{capitalise $name}}(auth, backend)
{{$contract.Type}}Bin = strings.Replace
({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:], -1
)
{{$contract.Type}}Bin = strings.Replace
All({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:]
)
{{end}}
address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex({{.Type}}Bin), backend {{range .Constructor.Inputs}}, {{.Name}}{{end}})
if err != nil {
...
...
accounts/abi/type.go
View file @
7caa2d81
...
...
@@ -201,7 +201,7 @@ func NewType(t string, internalType string, components []ArgumentMarshaling) (ty
if
internalType
!=
""
&&
strings
.
HasPrefix
(
internalType
,
structPrefix
)
{
// Foo.Bar type definition is not allowed in golang,
// convert the format to FooBar
typ
.
TupleRawName
=
strings
.
Replace
(
internalType
[
len
(
structPrefix
)
:
],
"."
,
""
,
-
1
)
typ
.
TupleRawName
=
strings
.
Replace
All
(
internalType
[
len
(
structPrefix
)
:
],
"."
,
""
)
}
case
"function"
:
...
...
eth/downloader/downloader_test.go
View file @
7caa2d81
...
...
@@ -1331,8 +1331,8 @@ func TestRemoteHeaderRequestSpan(t *testing.T) {
}
}
if
failed
{
res
:=
strings
.
Replace
(
fmt
.
Sprint
(
data
),
" "
,
","
,
-
1
)
exp
:=
strings
.
Replace
(
fmt
.
Sprint
(
tt
.
expected
),
" "
,
","
,
-
1
)
res
:=
strings
.
Replace
All
(
fmt
.
Sprint
(
data
),
" "
,
","
)
exp
:=
strings
.
Replace
All
(
fmt
.
Sprint
(
tt
.
expected
),
" "
,
","
)
t
.
Logf
(
"got: %v
\n
"
,
res
)
t
.
Logf
(
"exp: %v
\n
"
,
exp
)
t
.
Errorf
(
"test %d: wrong values"
,
i
)
...
...
ethstats/ethstats.go
View file @
7caa2d81
...
...
@@ -366,7 +366,7 @@ func (s *Service) readLoop(conn *connWrapper) {
// If the network packet is a system ping, respond to it directly
var
ping
string
if
err
:=
json
.
Unmarshal
(
blob
,
&
ping
);
err
==
nil
&&
strings
.
HasPrefix
(
ping
,
"primus::ping::"
)
{
if
err
:=
conn
.
WriteJSON
(
strings
.
Replace
(
ping
,
"ping"
,
"pong"
,
-
1
));
err
!=
nil
{
if
err
:=
conn
.
WriteJSON
(
strings
.
Replace
All
(
ping
,
"ping"
,
"pong"
));
err
!=
nil
{
log
.
Warn
(
"Failed to respond to system ping message"
,
"err"
,
err
)
return
}
...
...
internal/debug/api.go
View file @
7caa2d81
...
...
@@ -209,8 +209,8 @@ func (*HandlerT) Stacks(filter *string) string {
// E.g. (eth || snap) && !p2p -> (eth in Value || snap in Value) && p2p not in Value
expanded
=
regexp
.
MustCompile
(
`[:/\.A-Za-z0-9_-]+`
)
.
ReplaceAllString
(
expanded
,
"`$0` in Value"
)
expanded
=
regexp
.
MustCompile
(
"!(`[:/
\\
.A-Za-z0-9_-]+`)"
)
.
ReplaceAllString
(
expanded
,
"$1 not"
)
expanded
=
strings
.
Replace
(
expanded
,
"||"
,
"or"
,
-
1
)
expanded
=
strings
.
Replace
(
expanded
,
"&&"
,
"and"
,
-
1
)
expanded
=
strings
.
Replace
All
(
expanded
,
"||"
,
"or"
)
expanded
=
strings
.
Replace
All
(
expanded
,
"&&"
,
"and"
)
log
.
Info
(
"Expanded filter expression"
,
"filter"
,
*
filter
,
"expanded"
,
expanded
)
expr
,
err
:=
bexpr
.
CreateEvaluator
(
expanded
)
...
...
les/downloader/downloader_test.go
View file @
7caa2d81
...
...
@@ -1577,8 +1577,8 @@ func TestRemoteHeaderRequestSpan(t *testing.T) {
}
}
if
failed
{
res
:=
strings
.
Replace
(
fmt
.
Sprint
(
data
),
" "
,
","
,
-
1
)
exp
:=
strings
.
Replace
(
fmt
.
Sprint
(
tt
.
expected
),
" "
,
","
,
-
1
)
res
:=
strings
.
Replace
All
(
fmt
.
Sprint
(
data
),
" "
,
","
)
exp
:=
strings
.
Replace
All
(
fmt
.
Sprint
(
tt
.
expected
),
" "
,
","
)
t
.
Logf
(
"got: %v
\n
"
,
res
)
t
.
Logf
(
"exp: %v
\n
"
,
exp
)
t
.
Errorf
(
"test %d: wrong values"
,
i
)
...
...
metrics/prometheus/collector.go
View file @
7caa2d81
...
...
@@ -116,5 +116,5 @@ func (c *collector) writeSummaryPercentile(name, p string, value interface{}) {
}
func
mutateKey
(
key
string
)
string
{
return
strings
.
Replace
(
key
,
"/"
,
"_"
,
-
1
)
return
strings
.
Replace
All
(
key
,
"/"
,
"_"
)
}
p2p/nat/natupnp_test.go
View file @
7caa2d81
...
...
@@ -223,7 +223,7 @@ func (dev *fakeIGD) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func
(
dev
*
fakeIGD
)
replaceListenAddr
(
resp
string
)
string
{
return
strings
.
Replace
(
resp
,
"{{listenAddr}}"
,
dev
.
listener
.
Addr
()
.
String
(),
-
1
)
return
strings
.
Replace
All
(
resp
,
"{{listenAddr}}"
,
dev
.
listener
.
Addr
()
.
String
()
)
}
func
(
dev
*
fakeIGD
)
listen
()
(
err
error
)
{
...
...
rlp/decode_test.go
View file @
7caa2d81
...
...
@@ -1203,7 +1203,7 @@ func encodeTestSlice(n uint) []byte {
}
func
unhex
(
str
string
)
[]
byte
{
b
,
err
:=
hex
.
DecodeString
(
strings
.
Replace
(
str
,
" "
,
""
,
-
1
))
b
,
err
:=
hex
.
DecodeString
(
strings
.
Replace
All
(
str
,
" "
,
""
))
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"invalid hex string: %q"
,
str
))
}
...
...
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