Skip to content

Commit 44878cb

Browse files
committed
run go fix
1 parent f8c7f2f commit 44878cb

7 files changed

Lines changed: 15 additions & 18 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ jobs:
3131
- name: Check out code into the Go module directory
3232
uses: actions/checkout@v6
3333

34-
- name: Set up Go 1.25
34+
- name: Set up Go 1.26
3535
uses: actions/setup-go@v6
3636
with:
37-
go-version: "1.25"
37+
go-version: "1.26"
3838
cache: false
3939

4040
- name: fake ipxe binary

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt update \
1414
make \
1515
&& make ipxe
1616

17-
FROM golang:1.25-trixie AS builder
17+
FROM golang:1.26-trixie AS builder
1818
WORKDIR /work
1919
COPY . .
2020
COPY --from=ipxe-builder /work/ipxe/ipxe /work/ipxe/ipxe

dhcp4/options.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"io"
24+
"maps"
2425
"net"
2526
"sort"
2627
)
@@ -134,9 +135,7 @@ func (o Options) Marshal() ([]byte, error) {
134135
// Copy returns a shallow copy of o.
135136
func (o Options) Copy() Options {
136137
ret := make(Options, len(o))
137-
for k, v := range o {
138-
ret[k] = v
139-
}
138+
maps.Copy(ret, o)
140139
return ret
141140
}
142141

dhcp4/packet.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"errors"
2121
"fmt"
2222
"io"
23+
"maps"
2324
"net"
2425
"sort"
2526
)
@@ -197,9 +198,7 @@ func (p *Packet) Marshal() ([]byte, error) {
197198
ret.Write([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
198199

199200
opts := make(Options, len(p.Options)+1)
200-
for k, v := range p.Options {
201-
opts[k] = v
202-
}
201+
maps.Copy(opts, p.Options)
203202
opts[53] = []byte{byte(p.Type)}
204203
if optsInSname {
205204
opts, err = opts.marshalLimited(ret, 64, true)
@@ -339,9 +338,9 @@ func Unmarshal(bs []byte) (*Packet, error) {
339338
}
340339

341340
func nullStr(bs []byte) (string, bool) {
342-
i := bytes.IndexByte(bs, 0)
343-
if i == -1 {
341+
before, _, ok := bytes.Cut(bs, []byte{0})
342+
if !ok {
344343
return "", false
345344
}
346-
return string(bs[:i]), true
345+
return string(before), true
347346
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/metal-stack/pixie
22

3-
go 1.25
3+
go 1.26
44

55
require (
66
github.com/metal-stack/api v0.0.45
@@ -12,6 +12,7 @@ require (
1212
github.com/stretchr/testify v1.11.1
1313
golang.org/x/crypto v0.47.0
1414
golang.org/x/net v0.49.0
15+
google.golang.org/protobuf v1.36.11
1516
)
1617

1718
require (
@@ -42,6 +43,5 @@ require (
4243
go.yaml.in/yaml/v3 v3.0.4 // indirect
4344
golang.org/x/sys v0.40.0 // indirect
4445
golang.org/x/text v0.33.0 // indirect
45-
google.golang.org/protobuf v1.36.11 // indirect
4646
gopkg.in/yaml.v3 v3.0.1 // indirect
4747
)

pixiecore/cli/cli.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package cli // import "github.com/metal-stack/pixie/cli"
1818
import (
1919
"fmt"
2020
"log/slog"
21+
"maps"
2122
"os"
2223

2324
"github.com/metal-stack/pixie/pixiecore"
@@ -142,9 +143,7 @@ func serverFromFlags(cmd *cobra.Command) *pixiecore.Server {
142143
MetricsAddress: metricsAddr,
143144
DHCPNoBind: dhcpNoBind,
144145
}
145-
for fwtype, bs := range Ipxe {
146-
ret.Ipxe[fwtype] = bs
147-
}
146+
maps.Copy(ret.Ipxe, Ipxe)
148147
if ipxeBios != "" {
149148
ret.Ipxe[pixiecore.FirmwareX86PC] = mustFile(ipxeBios)
150149
}

pixiecore/cli/ipv6apicmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var ipv6ApiCmd = &cobra.Command{
5555
}
5656
dnsServerAddresses := make([]net.IP, 0)
5757
if cmd.Flags().Changed("dns-servers") {
58-
for _, dnsServerAddress := range strings.Split(dnsServers, ",") {
58+
for dnsServerAddress := range strings.SplitSeq(dnsServers, ",") {
5959
dnsServerAddresses = append(dnsServerAddresses, net.ParseIP(dnsServerAddress))
6060
}
6161
}

0 commit comments

Comments
 (0)