Skip to content

Commit 130859c

Browse files
committed
Update to Go 1.26 refactor with suggested fixes
1 parent 4761bb8 commit 130859c

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

agent/agent_test.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,9 @@ func setupFakeSSH(wg *sync.WaitGroup, call func(addrPort netip.AddrPort, pubKey
174174
addrPort := tcp.Addr().(*net.TCPAddr).AddrPort()
175175

176176
var wg2 sync.WaitGroup
177-
wg2.Add(1)
178-
go func() {
179-
defer wg2.Done()
177+
wg2.Go(func() {
180178
call(addrPort, sshPubKey)
181-
}()
179+
})
182180

183181
tcpConn, err := tcp.AcceptTCP()
184182
if err != nil {
@@ -205,15 +203,11 @@ func setupFakeSSH(wg *sync.WaitGroup, call func(addrPort netip.AddrPort, pubKey
205203
}
206204

207205
// The incoming Request channel must be serviced.
208-
wg.Add(1)
209-
go func() {
206+
wg.Go(func() {
210207
ssh.DiscardRequests(reqs)
211-
wg.Done()
212-
}()
208+
})
213209

214-
wg.Add(1)
215-
go func() {
216-
defer wg.Done()
210+
wg.Go(func() {
217211

218212
// Service the incoming channel.
219213
for newChannel := range chans {
@@ -326,7 +320,7 @@ func setupFakeSSH(wg *sync.WaitGroup, call func(addrPort netip.AddrPort, pubKey
326320
channel.SendRequest("exit-status", false, binary.BigEndian.AppendUint32(nil, 0))
327321
}()
328322
}
329-
}()
323+
})
330324

331325
wg2.Wait()
332326

cmd/orchid/setup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func runSetup(wd string) error {
175175
return nil
176176
}
177177

178-
func listenAddressValidator(ans interface{}) error {
178+
func listenAddressValidator(ans any) error {
179179
if ansStr, ok := ans.(string); ok {
180180
// empty string means disable
181181
if ansStr == "" {
@@ -189,7 +189,7 @@ func listenAddressValidator(ans interface{}) error {
189189
return nil
190190
}
191191

192-
func urlValidator(ans interface{}) error {
192+
func urlValidator(ans any) error {
193193
if ansStr, ok := ans.(string); ok {
194194
_, err := url.Parse(ansStr)
195195
return err

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/1f349/orchid
22

3-
go 1.24.2
3+
go 1.26
44

55
require (
66
github.com/1f349/cache v0.0.7

utils/domain-checker.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package utils
22

3-
import "github.com/1f349/violet/utils"
3+
import (
4+
"github.com/1f349/violet/utils"
5+
"slices"
6+
)
47

58
type DomainChecker []string
69

710
func (d DomainChecker) ValidateDomain(a string) bool {
811
if fqdn, ok := utils.GetTopFqdn(a); ok {
9-
for _, i := range d {
10-
if i == fqdn {
11-
return true
12-
}
12+
if slices.Contains(d, fqdn) {
13+
return true
1314
}
1415
}
1516
return false

0 commit comments

Comments
 (0)