Replace strings.Replace with strings.ReplaceAll (#5128)

This commit is contained in:
Håvard Anda Estensen 2022-08-21 16:21:09 +02:00 committed by GitHub
parent 78e9703bd7
commit 8283c68335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -220,7 +220,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.ReplaceAll(resp, "{{listenAddr}}", dev.listener.Addr().String())
}
func (dev *fakeIGD) listen() (err error) {

View File

@ -1133,7 +1133,7 @@ func encodeTestSlice(n uint) []byte {
}
func unhex(str string) []byte {
b, err := hex.DecodeString(strings.Replace(str, " ", "", -1))
b, err := hex.DecodeString(strings.ReplaceAll(str, " ", ""))
if err != nil {
panic(fmt.Sprintf("invalid hex string: %q", str))
}