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
Fix gocritic warnings
- Add missing space after // in a comment (proxy.go)
- Rewrite if/else if/else to switch in pullImageWithAuth (run.go)
- Replace single-case type switch with if in test helper (job_test.go)
  • Loading branch information
JamieMagee committed Feb 9, 2026
commit 5337c8388e3543dc719a01da36f5c4eb567048fa
2 changes: 1 addition & 1 deletion internal/infra/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (p *Proxy) Close() (err error) {
}()

// Check the error code if the container has already exited, so we can pass it along to the caller. If the proxy
//crashes we want the CLI to error out.
// crashes we want the CLI to error out.
containerInfo, inspectErr := p.cli.ContainerInspect(context.Background(), p.containerID)
if inspectErr != nil {
return fmt.Errorf("failed to inspect proxy container: %w", inspectErr)
Expand Down
8 changes: 4 additions & 4 deletions internal/infra/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ func pullImage(ctx context.Context, cli *client.Client, imageName string) error
func pullImageWithAuth(ctx context.Context, cli *client.Client, imageName string) error {
var imagePullOptions image.PullOptions

if strings.HasPrefix(imageName, "ghcr.io/") {

switch {
case strings.HasPrefix(imageName, "ghcr.io/"):
token := os.Getenv("LOCAL_GITHUB_ACCESS_TOKEN")
if token != "" {
auth := base64.StdEncoding.EncodeToString([]byte("x:" + token))
Expand All @@ -619,7 +619,7 @@ func pullImageWithAuth(ctx context.Context, cli *client.Client, imageName string
} else {
log.Println("Failed to find credentials for GitHub container registry.")
}
} else if strings.Contains(imageName, ".azurecr.io/") {
case strings.Contains(imageName, ".azurecr.io/"):
username := os.Getenv("AZURE_REGISTRY_USERNAME")
password := os.Getenv("AZURE_REGISTRY_PASSWORD")

Expand All @@ -641,7 +641,7 @@ func pullImageWithAuth(ctx context.Context, cli *client.Client, imageName string
} else {
log.Println("Failed to find credentials for Azure container registry.")
}
} else {
default:
log.Printf("Failed to find credentials for pulling image: %s\n.", imageName)
}

Expand Down
3 changes: 1 addition & 2 deletions internal/model/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ func compareMap(t *testing.T, parent string, expected map[string]any, actual int
case []any:
// Also check structs that are in arrays.
for _, v := range expectedValue {
switch v := v.(type) {
case map[string]any:
if v, ok := v.(map[string]any); ok {
structField := actualType.Field(fieldIndex)
name := yamlTagCleaner(structField.Tag.Get("yaml"))
compareMap(t, parent+"->"+name, v, actualValue.Interface())
Expand Down
Loading