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

@ -1,6 +1,6 @@
version: "2"
run:
go: "1.24"
go: "1.25"
linters:
default: none
enable:

View file

@ -20,7 +20,7 @@ RUN make ui
# STEP 2 build executable binary
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.

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() {

View file

@ -483,7 +483,6 @@ func (site *Site) publish(key string, val interface{}) {
}
func (site *Site) collectMeters(key string, meters []config.Device[api.Meter]) []measurement {
var wg sync.WaitGroup
mm := make([]measurement, len(meters))
fun := func(i int, dev config.Device[api.Meter]) {
@ -525,13 +524,14 @@ func (site *Site) collectMeters(key string, meters []config.Device[api.Meter]) [
Power: power,
Energy: energy,
}
wg.Done()
}
wg.Add(len(meters))
var wg sync.WaitGroup
for i, meter := range meters {
go fun(i, meter)
wg.Go(func() {
fun(i, meter)
})
}
wg.Wait()
@ -885,18 +885,15 @@ func (site *Site) updateLoadpoints(rates api.Rates) float64 {
sum float64
)
wg.Add(len(site.loadpoints))
for _, lp := range site.loadpoints {
go func() {
wg.Go(func() {
power := lp.UpdateChargePowerAndCurrents()
site.prioritizer.UpdateChargePowerFlexibility(lp, rates)
mu.Lock()
sum += power
mu.Unlock()
wg.Done()
}()
})
}
wg.Wait()

2
go.mod
View file

@ -1,6 +1,6 @@
module github.com/evcc-io/evcc
go 1.24.0
go 1.25.0
require (
dario.cat/mergo v1.0.2

View file

@ -30,10 +30,8 @@ func TestConcurrentRead(t *testing.T) {
var wg sync.WaitGroup
for i := 1; i <= 10; i++ {
wg.Add(1)
go func(id int) {
for id := 1; id <= 10; id++ {
wg.Go(func() {
// client
conn, err := modbus.NewConnection(context.TODO(), l.Addr().String(), "", "", 0, modbus.Tcp, uint8(id))
require.NoError(t, err)
@ -53,9 +51,7 @@ func TestConcurrentRead(t *testing.T) {
time.Sleep(time.Duration(rand.Int31n(1000)) * time.Microsecond)
}
wg.Done()
}(i)
})
}
wg.Wait()