]> git.r.bdr.sh - rbdr/mobius/commitdiff
Use strings.ReplaceAll method
authorJeff Halter <redacted>
Thu, 20 Apr 2023 00:53:28 +0000 (17:53 -0700)
committerJeff Halter <redacted>
Thu, 20 Apr 2023 00:53:28 +0000 (17:53 -0700)
hotline/client_conn.go
hotline/files.go
hotline/transaction_handlers.go
hotline/transaction_handlers_test.go

index f92c1cdb5999d37e598ae7708b3882ff5fdb4bf3..0a5a108da9fa706a0b3f6c410131c1944b006cfa 100644 (file)
@@ -254,5 +254,5 @@ func (cc *ClientConn) String() string {
                "None.\n",
        )
 
-       return strings.Replace(template, "\n", "\r", -1)
+       return strings.ReplaceAll(template, "\n", "\r")
 }
index 9c3efe2e182cc5ff45caa9c1c50e914d5c814f29..63fa482d498ab4c44d450b9a58bae33b2c5e89ca 100644 (file)
@@ -117,7 +117,7 @@ func getFileNameList(path string, ignoreList []string) (fields []Field, err erro
                        copy(fnwi.Creator[:], hlFile.ffo.FlatFileInformationFork.CreatorSignature)
                }
 
-               strippedName := strings.Replace(file.Name(), ".incomplete", "", -1)
+               strippedName := strings.ReplaceAll(file.Name(), ".incomplete", "")
 
                nameSize := make([]byte, 2)
                binary.BigEndian.PutUint16(nameSize, uint16(len(strippedName)))
index 137b2a0583ce2288f180cc07f37a572b1654360e..7864e19240a3b435e183600934812b79ffd9b387 100644 (file)
@@ -1015,7 +1015,7 @@ func HandleTranOldPostNews(cc *ClientConn, t *Transaction) (res []Transaction, e
        }
 
        newsPost := fmt.Sprintf(newsTemplate+"\r", cc.UserName, time.Now().Format(newsDateTemplate), t.GetField(FieldData).Data)
-       newsPost = strings.Replace(newsPost, "\n", "\r", -1)
+       newsPost = strings.ReplaceAll(newsPost, "\n", "\r")
 
        // update news in memory
        cc.Server.FlatNews = append([]byte(newsPost), cc.Server.FlatNews...)
index ff1a53c37d08ea2243d38428e112779e4f9a5d48..01880f2555ceb6db7aa782cbbc4b1fc8b06028d6 100644 (file)
@@ -2980,7 +2980,7 @@ func TestHandleGetClientInfoText(t *testing.T) {
                                        ErrorCode: []byte{0, 0, 0, 0},
                                        Fields: []Field{
                                                NewField(FieldData, []byte(
-                                                       strings.Replace(`Nickname:   Testy McTest
+                                                       strings.ReplaceAll(`Nickname:   Testy McTest
 Name:       test
 Account:    test
 Address:    1.2.3.4:12345
@@ -3005,7 +3005,7 @@ None.
 
 None.
 
-`, "\n", "\r", -1)),
+`, "\n", "\r")),
                                                ),
                                                NewField(FieldUserName, []byte("Testy McTest")),
                                        },