mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
chore: update golang to 1.24.1 (#17035)
- Update go.mod to use Go 1.24.1 - Update GitHub Actions setup-go action to use Go 1.24.1 - Fix linting issues with golangci-lint by: - Updating to golangci-lint v1.57.1 (more compatible with Go 1.24.1) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <claude@anthropic.com>
This commit is contained in:
+16
-10
@@ -40,35 +40,39 @@ func convertRouterConfig(cfg router.Config) *NetworkSettingsRequest {
|
||||
v6LocalAddrs := make([]string, 0)
|
||||
v6PrefixLengths := make([]uint32, 0)
|
||||
for _, addrs := range cfg.LocalAddrs {
|
||||
if addrs.Addr().Is4() {
|
||||
switch {
|
||||
case addrs.Addr().Is4():
|
||||
v4LocalAddrs = append(v4LocalAddrs, addrs.Addr().String())
|
||||
v4SubnetMasks = append(v4SubnetMasks, prefixToSubnetMask(addrs))
|
||||
} else if addrs.Addr().Is6() {
|
||||
case addrs.Addr().Is6():
|
||||
v6LocalAddrs = append(v6LocalAddrs, addrs.Addr().String())
|
||||
// #nosec G115 - Safe conversion as IPv6 prefix lengths are always within uint32 range (0-128)
|
||||
v6PrefixLengths = append(v6PrefixLengths, uint32(addrs.Bits()))
|
||||
} else {
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
v4Routes := make([]*NetworkSettingsRequest_IPv4Settings_IPv4Route, 0)
|
||||
v6Routes := make([]*NetworkSettingsRequest_IPv6Settings_IPv6Route, 0)
|
||||
for _, route := range cfg.Routes {
|
||||
if route.Addr().Is4() {
|
||||
switch {
|
||||
case route.Addr().Is4():
|
||||
v4Routes = append(v4Routes, convertToIPV4Route(route))
|
||||
} else if route.Addr().Is6() {
|
||||
case route.Addr().Is6():
|
||||
v6Routes = append(v6Routes, convertToIPV6Route(route))
|
||||
} else {
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
v4ExcludedRoutes := make([]*NetworkSettingsRequest_IPv4Settings_IPv4Route, 0)
|
||||
v6ExcludedRoutes := make([]*NetworkSettingsRequest_IPv6Settings_IPv6Route, 0)
|
||||
for _, route := range cfg.LocalRoutes {
|
||||
if route.Addr().Is4() {
|
||||
switch {
|
||||
case route.Addr().Is4():
|
||||
v4ExcludedRoutes = append(v4ExcludedRoutes, convertToIPV4Route(route))
|
||||
} else if route.Addr().Is6() {
|
||||
case route.Addr().Is6():
|
||||
v6ExcludedRoutes = append(v6ExcludedRoutes, convertToIPV6Route(route))
|
||||
} else {
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -95,6 +99,7 @@ func convertRouterConfig(cfg router.Config) *NetworkSettingsRequest {
|
||||
}
|
||||
|
||||
return &NetworkSettingsRequest{
|
||||
// #nosec G115 - Safe conversion as MTU values are expected to be small positive integers
|
||||
Mtu: uint32(cfg.NewMTU),
|
||||
Ipv4Settings: v4Settings,
|
||||
Ipv6Settings: v6Settings,
|
||||
@@ -113,7 +118,8 @@ func convertToIPV4Route(route netip.Prefix) *NetworkSettingsRequest_IPv4Settings
|
||||
|
||||
func convertToIPV6Route(route netip.Prefix) *NetworkSettingsRequest_IPv6Settings_IPv6Route {
|
||||
return &NetworkSettingsRequest_IPv6Settings_IPv6Route{
|
||||
Destination: route.Addr().String(),
|
||||
Destination: route.Addr().String(),
|
||||
// #nosec G115 - Safe conversion as prefix lengths are always within uint32 range (0-128)
|
||||
PrefixLength: uint32(route.Bits()),
|
||||
Router: "", // N/A
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ func (s *serdes[S, _, _]) sendLoop() {
|
||||
s.logger.Critical(s.ctx, "failed to marshal message", slog.Error(err))
|
||||
return
|
||||
}
|
||||
// #nosec G115 - Safe conversion as protobuf message length is expected to be within uint32 range
|
||||
if err := binary.Write(s.conn, binary.BigEndian, uint32(len(mb))); err != nil {
|
||||
s.logger.Debug(s.ctx, "failed to write length", slog.Error(err))
|
||||
return
|
||||
|
||||
@@ -75,6 +75,7 @@ func TestSpeaker_RawPeer(t *testing.T) {
|
||||
msgBuf := make([]byte, msgLen)
|
||||
n, err = mp.Read(msgBuf)
|
||||
require.NoError(t, err)
|
||||
// #nosec G115 - Safe conversion of read bytes count to uint32 for comparison with message length
|
||||
require.Equal(t, msgLen, uint32(n))
|
||||
msg := new(TunnelMessage)
|
||||
err = proto.Unmarshal(msgBuf, msg)
|
||||
|
||||
@@ -322,6 +322,7 @@ func (t *Tunnel) Sync() {
|
||||
|
||||
func sinkEntryToPb(e slog.SinkEntry) *Log {
|
||||
l := &Log{
|
||||
// #nosec G115 - Safe conversion for log levels which are small positive integers
|
||||
Level: Log_Level(e.Level),
|
||||
Message: e.Message,
|
||||
LoggerNames: e.LoggerNames,
|
||||
|
||||
Reference in New Issue
Block a user