Skip to content

Commit 523eb15

Browse files
sallyomclaude
andauthored
fix: resolve Go formatting and linting issues (#282)
- Auto-format backend handlers/content.go with gofmt - Auto-format operator internal/handlers/sessions.go with gofmt - Remove unused getProjectSettings function from backend git/operations.go - Remove unused k8s.io/apimachinery/pkg/api/errors import All files now pass: - gofmt -l (zero output) - go vet ./... (no issues) - golangci-lint run (0 issues) Signed-off-by: sallyom <somalley@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1623470 commit 523eb15

File tree

3 files changed

+8
-40
lines changed

3 files changed

+8
-40
lines changed

components/backend/git/operations.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"strings"
1919
"time"
2020

21-
"k8s.io/apimachinery/pkg/api/errors"
2221
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2322
"k8s.io/apimachinery/pkg/runtime/schema"
2423
"k8s.io/client-go/dynamic"
@@ -45,37 +44,6 @@ type DiffSummary struct {
4544
FilesRemoved int `json:"files_removed"`
4645
}
4746

48-
// getProjectSettings retrieves the ProjectSettings CR for a project using the provided dynamic client
49-
func getProjectSettings(ctx context.Context, dynClient dynamic.Interface, projectName string) (*ProjectSettings, error) {
50-
if dynClient == nil {
51-
return &ProjectSettings{}, nil
52-
}
53-
54-
if GetProjectSettingsResource == nil {
55-
return &ProjectSettings{}, nil
56-
}
57-
58-
gvr := GetProjectSettingsResource()
59-
obj, err := dynClient.Resource(gvr).Namespace(projectName).Get(ctx, "projectsettings", v1.GetOptions{})
60-
if err != nil {
61-
if errors.IsNotFound(err) {
62-
return &ProjectSettings{}, nil
63-
}
64-
return nil, fmt.Errorf("failed to get ProjectSettings: %w", err)
65-
}
66-
67-
settings := &ProjectSettings{}
68-
if obj != nil {
69-
if spec, ok := obj.Object["spec"].(map[string]interface{}); ok {
70-
if v, ok := spec["runnerSecretsName"].(string); ok {
71-
settings.RunnerSecret = strings.TrimSpace(v)
72-
}
73-
}
74-
}
75-
76-
return settings, nil
77-
}
78-
7947
// GetGitHubToken tries to get a GitHub token from GitHub App first, then falls back to project runner secret
8048
func GetGitHubToken(ctx context.Context, k8sClient *kubernetes.Clientset, dynClient dynamic.Interface, project, userID string) (string, error) {
8149
// Try GitHub App first if available

components/backend/handlers/content.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,13 @@ func ContentWorkflowMetadata(c *gin.Context) {
511511
shortCommand = commandName[lastDot+1:]
512512
}
513513

514-
commands = append(commands, map[string]interface{}{
515-
"id": commandName,
516-
"name": displayName,
517-
"description": metadata["description"],
518-
"slashCommand": "/" + shortCommand,
519-
"icon": metadata["icon"],
520-
})
514+
commands = append(commands, map[string]interface{}{
515+
"id": commandName,
516+
"name": displayName,
517+
"description": metadata["description"],
518+
"slashCommand": "/" + shortCommand,
519+
"icon": metadata["icon"],
520+
})
521521
}
522522
}
523523
log.Printf("ContentWorkflowMetadata: found %d commands", len(commands))

components/operator/internal/handlers/sessions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
312312
maxTokens, _, _ := unstructured.NestedInt64(llmSettings, "maxTokens")
313313

314314
// Hardcoded secret names (convention over configuration)
315-
const runnerSecretsName = "ambient-runner-secrets" // ANTHROPIC_API_KEY only (ignored when Vertex enabled)
315+
const runnerSecretsName = "ambient-runner-secrets" // ANTHROPIC_API_KEY only (ignored when Vertex enabled)
316316
const integrationSecretsName = "ambient-non-vertex-integrations" // GIT_*, JIRA_*, custom keys (optional)
317317

318318
// Check if integration secrets exist (optional)

0 commit comments

Comments
 (0)