refactor: adopt standard slice helpers
This commit is contained in:
parent
f016d62bc5
commit
e0aa1e857d
4 changed files with 13 additions and 13 deletions
6
go.mod
6
go.mod
|
|
@ -13,8 +13,8 @@ require (
|
|||
github.com/BurntSushi/toml v1.6.0
|
||||
github.com/alecthomas/chroma/v2 v2.27.0
|
||||
github.com/andybalholm/brotli v1.2.2
|
||||
github.com/ayn2op/arikawa/v3 v3.0.0-20260818073432-f49cfbdeaecd
|
||||
github.com/ayn2op/ningen/v3 v3.0.1-0.20260818073850-83e35312c6cc
|
||||
github.com/ayn2op/arikawa/v3 v3.0.0-20260818212803-ea226484f0f9
|
||||
github.com/ayn2op/ningen/v3 v3.0.1-0.20260818214204-4e9ec3f35437
|
||||
github.com/ayn2op/tview v0.0.0-20260812042550-0532d50b709f
|
||||
github.com/bogdanfinn/fhttp v0.6.8
|
||||
github.com/bogdanfinn/tls-client v1.15.1
|
||||
|
|
@ -61,7 +61,7 @@ require (
|
|||
golang.org/x/crypto v0.55.0 // indirect
|
||||
golang.org/x/exp/shiny v0.0.0-20260813180055-c1d0aacb2297 // indirect
|
||||
golang.org/x/image v0.45.0 // indirect
|
||||
golang.org/x/mobile v0.0.0-20260816165457-f98cc9b3c733 // indirect
|
||||
golang.org/x/mobile v0.0.0-20260818145002-f020ddb2de58 // indirect
|
||||
golang.org/x/net v0.58.0 // indirect
|
||||
golang.org/x/sys v0.47.0 // indirect
|
||||
golang.org/x/term v0.45.0 // indirect
|
||||
|
|
|
|||
12
go.sum
12
go.sum
|
|
@ -10,10 +10,10 @@ github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs
|
|||
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||
github.com/andybalholm/brotli v1.2.2 h1:HzTuoo2ErYQqf5qvcJInB8uvqSVxRttzkFexPWtnceM=
|
||||
github.com/andybalholm/brotli v1.2.2/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/ayn2op/arikawa/v3 v3.0.0-20260818073432-f49cfbdeaecd h1:uXVZPx8arfvYQAHSfgjBo6zy2Yrn2eFi+VTRgPQQ/qA=
|
||||
github.com/ayn2op/arikawa/v3 v3.0.0-20260818073432-f49cfbdeaecd/go.mod h1:O0QAm4VBLKBF01sofDEsAHGfD8+Tk8iWNYWksojTt6A=
|
||||
github.com/ayn2op/ningen/v3 v3.0.1-0.20260818073850-83e35312c6cc h1:B5QnZxF5Ukm1nzdUzQlcL8H/1WUV7moAGdg5xi95ULA=
|
||||
github.com/ayn2op/ningen/v3 v3.0.1-0.20260818073850-83e35312c6cc/go.mod h1:XhtckMjvipRb0JyG6nDpfoGu0p8jxxrHqjAlwAewejE=
|
||||
github.com/ayn2op/arikawa/v3 v3.0.0-20260818212803-ea226484f0f9 h1:aCFnS+/kF7Yv/Vqb/Ax+1ZQ7l9OT7LB2Q3r7KHBqJf0=
|
||||
github.com/ayn2op/arikawa/v3 v3.0.0-20260818212803-ea226484f0f9/go.mod h1:O0QAm4VBLKBF01sofDEsAHGfD8+Tk8iWNYWksojTt6A=
|
||||
github.com/ayn2op/ningen/v3 v3.0.1-0.20260818214204-4e9ec3f35437 h1:hM4rXx8orr+kMEwCKtEq25m5GFih5ziW8lCJuwqr/Xs=
|
||||
github.com/ayn2op/ningen/v3 v3.0.1-0.20260818214204-4e9ec3f35437/go.mod h1:XhtckMjvipRb0JyG6nDpfoGu0p8jxxrHqjAlwAewejE=
|
||||
github.com/ayn2op/tview v0.0.0-20260812042550-0532d50b709f h1:RidxK97+mKbM25L2iIdM6i6nfdZBSd1chNCu8e0PbxE=
|
||||
github.com/ayn2op/tview v0.0.0-20260812042550-0532d50b709f/go.mod h1:l/sE5dmdvLVlv/2rvoJFcFVl6uq9w2Z62/SfGpJiquw=
|
||||
github.com/bdandy/go-errors v1.2.2 h1:WdFv/oukjTJCLa79UfkGmwX7ZxONAihKu4V0mLIs11Q=
|
||||
|
|
@ -119,8 +119,8 @@ golang.org/x/exp/shiny v0.0.0-20260813180055-c1d0aacb2297 h1:sZ6Vq+Kl3T2bzXfXU33
|
|||
golang.org/x/exp/shiny v0.0.0-20260813180055-c1d0aacb2297/go.mod h1:kR98TGmikSWxqoBFhVyUNAePSDh8mkfqULxCdDaD8nM=
|
||||
golang.org/x/image v0.45.0 h1:FMb1nTbH5H9vF55SriQHgFw5GnNL9Jg6L25BwXKzhB0=
|
||||
golang.org/x/image v0.45.0/go.mod h1:n62x/7RqlwXDvGsSU4u6IUTUf6KghUZ9Bt7cG/T9Fx4=
|
||||
golang.org/x/mobile v0.0.0-20260816165457-f98cc9b3c733 h1:XKMObIaAElmkdO+4SQh1iCfzwciZHJi1OblnX9BED9k=
|
||||
golang.org/x/mobile v0.0.0-20260816165457-f98cc9b3c733/go.mod h1:jMwjxoDSx9jqhNaZqPnr6nnKzb7cs+Dy1Czk7wdX+R8=
|
||||
golang.org/x/mobile v0.0.0-20260818145002-f020ddb2de58 h1:Ka3QB8ttuiqyuUvt2VJ2B0llDuKpshFzLn+bk97+X4M=
|
||||
golang.org/x/mobile v0.0.0-20260818145002-f020ddb2de58/go.mod h1:jMwjxoDSx9jqhNaZqPnr6nnKzb7cs+Dy1Czk7wdX+R8=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ package tls
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
|
||||
tls_client "github.com/bogdanfinn/tls-client"
|
||||
)
|
||||
|
||||
func NewClient(options ...tls_client.HttpClientOption) tls_client.HttpClient {
|
||||
options = append([]tls_client.HttpClientOption{tls_client.WithClientProfile(clientProfile), tls_client.WithRandomTLSExtensionOrder()}, options...)
|
||||
options = slices.Concat([]tls_client.HttpClientOption{tls_client.WithClientProfile(clientProfile), tls_client.WithRandomTLSExtensionOrder()}, options)
|
||||
client, err := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to create new tls http client: %w", err))
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ func (ml *messagesList) deleteMessage(index int) {
|
|||
}
|
||||
|
||||
delete(ml.itemByID, ml.messages[index].ID)
|
||||
ml.messages = append(ml.messages[:index], ml.messages[index+1:]...)
|
||||
ml.messages = slices.Delete(ml.messages, index, index+1)
|
||||
ml.rebuildRows()
|
||||
}
|
||||
|
||||
|
|
@ -1125,8 +1125,7 @@ func extractEmbedURLs(embeds []discord.Embed) []string {
|
|||
}
|
||||
|
||||
func messageURLs(msg discord.Message) []string {
|
||||
combined := extractURLs(msg.Content)
|
||||
combined = append(combined, extractEmbedURLs(msg.Embeds)...)
|
||||
combined := slices.Concat(extractURLs(msg.Content), extractEmbedURLs(msg.Embeds))
|
||||
|
||||
urls := make([]string, 0, len(combined))
|
||||
seen := make(map[string]struct{}, len(combined))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue