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:
Jon Ayers
2025-03-26 01:56:39 -05:00
committed by GitHub
co-authored by Claude
parent c131d01cfd
commit 17ddee05e5
187 changed files with 650 additions and 531 deletions
+6 -5
View File
@@ -62,11 +62,12 @@ func ProtoFromManifest(manifest Manifest) (*proto.Manifest, error) {
return nil, xerrors.Errorf("convert workspace apps: %w", err)
}
return &proto.Manifest{
AgentId: manifest.AgentID[:],
AgentName: manifest.AgentName,
OwnerUsername: manifest.OwnerName,
WorkspaceId: manifest.WorkspaceID[:],
WorkspaceName: manifest.WorkspaceName,
AgentId: manifest.AgentID[:],
AgentName: manifest.AgentName,
OwnerUsername: manifest.OwnerName,
WorkspaceId: manifest.WorkspaceID[:],
WorkspaceName: manifest.WorkspaceName,
// #nosec G115 - Safe conversion for GitAuthConfigs which is expected to be small and positive
GitAuthConfigs: uint32(manifest.GitAuthConfigs),
EnvironmentVariables: manifest.EnvironmentVariables,
Directory: manifest.Directory,
+3 -3
View File
@@ -355,7 +355,7 @@ func (l *LogSender) Flush(src uuid.UUID) {
// the map.
}
var LogLimitExceededError = xerrors.New("Log limit exceeded")
var ErrLogLimitExceeded = xerrors.New("Log limit exceeded")
// SendLoop sends any pending logs until it hits an error or the context is canceled. It does not
// retry as it is expected that a higher layer retries establishing connection to the agent API and
@@ -365,7 +365,7 @@ func (l *LogSender) SendLoop(ctx context.Context, dest LogDest) error {
defer l.L.Unlock()
if l.exceededLogLimit {
l.logger.Debug(ctx, "aborting SendLoop because log limit is already exceeded")
return LogLimitExceededError
return ErrLogLimitExceeded
}
ctxDone := false
@@ -438,7 +438,7 @@ func (l *LogSender) SendLoop(ctx context.Context, dest LogDest) error {
// no point in keeping anything we have queued around, server will not accept them
l.queues = make(map[uuid.UUID]*logQueue)
l.Broadcast() // might unblock WaitUntilEmpty
return LogLimitExceededError
return ErrLogLimitExceeded
}
// Since elsewhere we only append to the logs, here we can remove them
+2 -2
View File
@@ -157,7 +157,7 @@ func TestLogSender_LogLimitExceeded(t *testing.T) {
&proto.BatchCreateLogsResponse{LogLimitExceeded: true})
err := testutil.RequireRecvCtx(ctx, t, loopErr)
require.ErrorIs(t, err, LogLimitExceededError)
require.ErrorIs(t, err, ErrLogLimitExceeded)
// Should also unblock WaitUntilEmpty
err = testutil.RequireRecvCtx(ctx, t, empty)
@@ -180,7 +180,7 @@ func TestLogSender_LogLimitExceeded(t *testing.T) {
loopErr <- err
}()
err = testutil.RequireRecvCtx(ctx, t, loopErr)
require.ErrorIs(t, err, LogLimitExceededError)
require.ErrorIs(t, err, ErrLogLimitExceeded)
}
func TestLogSender_SkipHugeLog(t *testing.T) {
+1 -1
View File
@@ -397,7 +397,7 @@ type DeploymentValues struct {
Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
WriteConfig serpent.Bool `json:"write_config,omitempty" typescript:",notnull"`
// DEPRECATED: Use HTTPAddress or TLS.Address instead.
// Deprecated: Use HTTPAddress or TLS.Address instead.
Address serpent.HostPort `json:"address,omitempty" typescript:",notnull"`
}
+5 -5
View File
@@ -102,17 +102,17 @@ func validateBuildParameter(richParameter TemplateVersionParameter, buildParamet
return nil
}
var min, max int
var minVal, maxVal int
if richParameter.ValidationMin != nil {
min = int(*richParameter.ValidationMin)
minVal = int(*richParameter.ValidationMin)
}
if richParameter.ValidationMax != nil {
max = int(*richParameter.ValidationMax)
maxVal = int(*richParameter.ValidationMax)
}
validation := &provider.Validation{
Min: min,
Max: max,
Min: minVal,
Max: maxVal,
MinDisabled: richParameter.ValidationMin == nil,
MaxDisabled: richParameter.ValidationMax == nil,
Regex: richParameter.ValidationRegex,
+6 -5
View File
@@ -121,15 +121,16 @@ func parseVariableValuesFromHCL(content []byte) ([]VariableValue, error) {
}
ctyType := ctyValue.Type()
if ctyType.Equals(cty.String) {
switch {
case ctyType.Equals(cty.String):
stringData[attribute.Name] = ctyValue.AsString()
} else if ctyType.Equals(cty.Number) {
case ctyType.Equals(cty.Number):
stringData[attribute.Name] = ctyValue.AsBigFloat().String()
} else if ctyType.IsTupleType() {
case ctyType.IsTupleType():
// In case of tuples, Coder only supports the list(string) type.
var items []string
var err error
_ = ctyValue.ForEachElement(func(key, val cty.Value) (stop bool) {
_ = ctyValue.ForEachElement(func(_, val cty.Value) (stop bool) {
if !val.Type().Equals(cty.String) {
err = xerrors.Errorf("unsupported tuple item type: %s ", val.GoString())
return true
@@ -146,7 +147,7 @@ func parseVariableValuesFromHCL(content []byte) ([]VariableValue, error) {
return nil, err
}
stringData[attribute.Name] = string(m)
} else {
default:
return nil, xerrors.Errorf("unsupported value type (name: %s): %s", attribute.Name, ctyType.GoString())
}
}
+1
View File
@@ -154,6 +154,7 @@ func (c *AgentConn) ReconnectingPTY(ctx context.Context, id uuid.UUID, height, w
return nil, err
}
data = append(make([]byte, 2), data...)
// #nosec G115 - Safe conversion as the data length is expected to be within uint16 range for PTY initialization
binary.LittleEndian.PutUint16(data, uint16(len(data)-2))
_, err = conn.Write(data)
+1
View File
@@ -123,6 +123,7 @@ func init() {
// Add a thousand more ports to the ignore list during tests so it's easier
// to find an available port.
for i := 63000; i < 64000; i++ {
// #nosec G115 - Safe conversion as port numbers are within uint16 range (0-65535)
AgentIgnoredListeningPorts[uint16(i)] = struct{}{}
}
}