Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions internal/cache/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func loadTemplates() (map[string]Cache, error) {

decoder := json.NewDecoder(file)

rawTemplates := make(map[string]interface{})
rawTemplates := make(map[string]any)
err = decoder.Decode(&rawTemplates)
if err != nil {
return nil, fmt.Errorf("failed to parse template file: %w", err)
Expand All @@ -123,8 +123,8 @@ func loadTemplates() (map[string]Cache, error) {
}

// extractTemplateCache safely extracts a Cache from raw template data
func extractTemplateCache(templateName string, template interface{}) (Cache, error) {
templateMap, ok := template.(map[string]interface{})
func extractTemplateCache(templateName string, template any) (Cache, error) {
templateMap, ok := template.(map[string]any)
if !ok {
return Cache{}, fmt.Errorf("template %s is not a valid object", templateName)
}
Expand Down Expand Up @@ -155,7 +155,7 @@ func extractTemplateCache(templateName string, template interface{}) (Cache, err
}

// extractStringField safely extracts a string field from a map
func extractStringField(m map[string]interface{}, field string, required bool) (string, error) {
func extractStringField(m map[string]any, field string, required bool) (string, error) {
value, exists := m[field]
if !exists {
if required {
Expand All @@ -174,7 +174,7 @@ func extractStringField(m map[string]interface{}, field string, required bool) (
}

// extractStringArrayField safely extracts a []string field from a map
func extractStringArrayField(m map[string]interface{}, field string, required bool) ([]string, error) {
func extractStringArrayField(m map[string]any, field string, required bool) ([]string, error) {
value, exists := m[field]
if !exists {
if required {
Expand All @@ -184,7 +184,7 @@ func extractStringArrayField(m map[string]interface{}, field string, required bo
}
}

array, ok := value.([]interface{})
array, ok := value.([]any)
if !ok {
return nil, fmt.Errorf("field '%s' must be an array, got %T", field, value)
}
Expand Down
9 changes: 3 additions & 6 deletions internal/cache/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ func (m *mockAPIClient) CacheEntryRetrieve(ctx context.Context, registry string,
// Try fallback keys - check if the entry key matches any of the requested fallback keys
if req.FallbackKeys != "" {
// FallbackKeys is a comma-separated string
fallbackKeys := strings.Split(req.FallbackKeys, ",")
for _, fbKey := range fallbackKeys {
fallbackKeys := strings.SplitSeq(req.FallbackKeys, ",")
for fbKey := range fallbackKeys {
fbKey = strings.TrimSpace(fbKey)
if entry, exists := reg.cache[fbKey]; exists && entry.committed {
return api.CacheEntryRetrieveResp{
Expand Down Expand Up @@ -213,10 +213,7 @@ func createRandomFile(t *testing.T, path string, sizeBytes int64) {
remaining := sizeBytes

for remaining > 0 {
toWrite := int64(chunkSize)
if remaining < toWrite {
toWrite = remaining
}
toWrite := min(remaining, int64(chunkSize))

if _, err := rand.Read(buf[:toWrite]); err != nil {
t.Fatalf("rand.Read: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/job/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestStartTracing_NoTracingBackend(t *testing.T) {

// If you call opentracing.GlobalTracer() without having set it first, it returns a NoopTracer
// In this test case, we haven't touched opentracing at all, so we get the NoopTracer
if got, want := reflect.TypeOf(opentracing.GlobalTracer()), reflect.TypeOf(opentracing.NoopTracer{}); got != want {
if got, want := reflect.TypeOf(opentracing.GlobalTracer()), reflect.TypeFor[opentracing.NoopTracer](); got != want {
t.Errorf("opentracing.GlobalTracer() = %v, want %v", got, want)
}
stopper()
Expand Down
4 changes: 2 additions & 2 deletions internal/job/integration/checkout_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func TestCheckingOutLocalGitProjectWithGitSSHKey(t *testing.T) {
case "clone", "fetch":
var gitSSHCommand string
for _, envVar := range i.Env {
if strings.HasPrefix(envVar, "GIT_SSH_COMMAND=") {
gitSSHCommand = strings.TrimPrefix(envVar, "GIT_SSH_COMMAND=")
if after, ok := strings.CutPrefix(envVar, "GIT_SSH_COMMAND="); ok {
gitSSHCommand = after
break
}
}
Expand Down