chore: upgrade go 1.25 (#22904)

This commit is contained in:
andig 2025-08-14 16:21:54 +02:00 • committed by GitHub
parent 536e01459a
commit 6f03177a54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 26 additions and 45 deletions

View file

@ -11,26 +11,21 @@ import (
"github.com/jeremywohl/flatten"
)
func workers(log *util.Logger, num int, tasks <-chan string, hits chan<- []tasks.Result) *sync.WaitGroup {
func workers(log *util.Logger, num int, ips <-chan string, hits chan<- []tasks.Result) *sync.WaitGroup {
var wg sync.WaitGroup
for range num {
wg.Add(1)
go func() {
workunit(log, tasks, hits)
wg.Done()
}()
wg.Go(func() {
for ip := range ips {
res := taskList.Test(log, "", tasks.ResultDetails{IP: ip})
hits <- res
}
})
}
return &wg
}
func workunit(log *util.Logger, ips <-chan string, hits chan<- []tasks.Result) {
for ip := range ips {
res := taskList.Test(log, "", tasks.ResultDetails{IP: ip})
hits <- res
}
}
func Work(log *util.Logger, num int, hosts []string) []tasks.Result {
ip := make(chan string)
hits := make(chan []tasks.Result)

View file

@ -18,16 +18,11 @@ func Register(cb func()) {
// Cleanup executes the registered shutdown functions when the stop channel closes
func Cleanup(doneC chan struct{}) {
wg := new(sync.WaitGroup)
var wg sync.WaitGroup
mu.Lock()
for _, cb := range handlers {
wg.Add(1)
go func(cb func()) {
cb()
wg.Done()
}(cb)
wg.Go(cb)
}
mu.Unlock()

View file

@ -64,20 +64,18 @@ func tronityAuthorize(addr string, oc *oauth2.Config) (*oauth2.Token, error) {
mux := &http.ServeMux{}
mux.HandleFunc("/auth/tronity", handler)
wg := new(sync.WaitGroup)
s := &http.Server{
Addr: addr,
Handler: mux,
}
// start server
wg.Add(1)
go func() {
var wg sync.WaitGroup
wg.Go(func() {
if err := s.ListenAndServe(); err != http.ErrServerClosed {
log.FATAL.Fatal(err)
}
wg.Done()
}()
})
// close on exit
defer func() {