From eef33c17b51aa316d9df7830e3cbbf0d350a4387 Mon Sep 17 00:00:00 2001 From: "Scion Agent (ci-main-fix)" Date: Thu, 11 Jun 2026 23:21:10 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20CI=20failures=20=E2=80=94=20go?= =?UTF-8?q?fmt=20formatting=20and=20errcheck=20lint=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run gofmt on 6 skill-related files from PR #399 and replace os.Setenv with t.Setenv in pipeline_health_test.go from PR #401 to satisfy the errcheck linter. --- pkg/agent/caching_skill_resolver_test.go | 2 +- pkg/agent/skill_resolver.go | 4 +++- pkg/api/skill_uri.go | 8 ++++---- pkg/hub/skill_handlers.go | 4 ++-- pkg/hubclient/skills.go | 8 ++++---- pkg/sciontool/telemetry/pipeline_health_test.go | 17 ++++++++--------- pkg/store/entadapter/skill_store.go | 2 +- 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/pkg/agent/caching_skill_resolver_test.go b/pkg/agent/caching_skill_resolver_test.go index 539046129..fb2b7ee63 100644 --- a/pkg/agent/caching_skill_resolver_test.go +++ b/pkg/agent/caching_skill_resolver_test.go @@ -52,7 +52,7 @@ func TestCachingSkillResolver_InjectsCache(t *testing.T) { var capturedCtx context.Context inner := &ctxCapturingResolver{ - inner: &mockResolver{resolved: []ResolvedSkill{{Name: "s", Hash: "h"}}}, + inner: &mockResolver{resolved: []ResolvedSkill{{Name: "s", Hash: "h"}}}, capture: func(ctx context.Context) { capturedCtx = ctx }, } diff --git a/pkg/agent/skill_resolver.go b/pkg/agent/skill_resolver.go index 59f952a40..fe8f3d7aa 100644 --- a/pkg/agent/skill_resolver.go +++ b/pkg/agent/skill_resolver.go @@ -390,7 +390,9 @@ func buildSkillEntry(skill ResolvedSkill, dest, skillsDest string) (*SkillResolu } // populateSkillCache stores downloaded skill files in the cache. -func populateSkillCache(cache interface{ Put(string, map[string][]byte) (string, error) }, skill ResolvedSkill, installedDir string) { +func populateSkillCache(cache interface { + Put(string, map[string][]byte) (string, error) +}, skill ResolvedSkill, installedDir string) { files := make(map[string][]byte, len(skill.Files)) for _, f := range skill.Files { content, err := os.ReadFile(filepath.Join(installedDir, f.Path)) diff --git a/pkg/api/skill_uri.go b/pkg/api/skill_uri.go index 8f3d4b6d7..eaa931137 100644 --- a/pkg/api/skill_uri.go +++ b/pkg/api/skill_uri.go @@ -31,10 +31,10 @@ type SkillURI struct { } const ( - skillURIScheme = "skill://" - defaultRegistry = "scion" - defaultVersion = "latest" - maxSkillNameLen = 64 + skillURIScheme = "skill://" + defaultRegistry = "scion" + defaultVersion = "latest" + maxSkillNameLen = 64 ) var validScopes = map[string]bool{ diff --git a/pkg/hub/skill_handlers.go b/pkg/hub/skill_handlers.go index 3dcef79cc..cd9dcaf2a 100644 --- a/pkg/hub/skill_handlers.go +++ b/pkg/hub/skill_handlers.go @@ -59,7 +59,7 @@ type SkillWithCapabilities struct { // PublishVersionRequest is the request body for creating a skill version. type PublishVersionRequest struct { - Version string `json:"version"` + Version string `json:"version"` Files []FileUploadRequest `json:"files,omitempty"` } @@ -779,7 +779,7 @@ func (s *Server) handleSkillUpload(w http.ResponseWriter, r *http.Request, skill } var req struct { - Version string `json:"version"` + Version string `json:"version"` Files []FileUploadRequest `json:"files"` } if err := readJSON(r, &req); err != nil { diff --git a/pkg/hubclient/skills.go b/pkg/hubclient/skills.go index cafa9aedc..681ad9b7f 100644 --- a/pkg/hubclient/skills.go +++ b/pkg/hubclient/skills.go @@ -160,7 +160,7 @@ type UpdateSkillRequest struct { // PublishVersionRequest is the request for creating a skill version. type PublishVersionRequest struct { - Version string `json:"version"` + Version string `json:"version"` Files []FileUploadRequest `json:"files,omitempty"` } @@ -172,7 +172,7 @@ type PublishVersionResponse struct { // FinalizeSkillVersionRequest is the request for finalizing a skill version. type FinalizeSkillVersionRequest struct { - Version string `json:"version"` + Version string `json:"version"` Manifest *SkillManifest `json:"manifest"` } @@ -201,7 +201,7 @@ type ResolveSkillRef struct { // ResolveSkillsResponse is the response for batch skill resolution. type ResolveSkillsResponse struct { - Resolved []ResolvedSkill `json:"resolved"` + Resolved []ResolvedSkill `json:"resolved"` Errors []ResolveSkillError `json:"errors,omitempty"` } @@ -343,7 +343,7 @@ func (s *skillService) FinalizeVersion(ctx context.Context, skillID string, req // RequestUploadURLs requests signed upload URLs for a skill version's files. func (s *skillService) RequestUploadURLs(ctx context.Context, skillID string, version string, files []FileUploadRequest) (*UploadResponse, error) { req := struct { - Version string `json:"version"` + Version string `json:"version"` Files []FileUploadRequest `json:"files"` }{ Version: version, diff --git a/pkg/sciontool/telemetry/pipeline_health_test.go b/pkg/sciontool/telemetry/pipeline_health_test.go index b37755650..9ea158716 100644 --- a/pkg/sciontool/telemetry/pipeline_health_test.go +++ b/pkg/sciontool/telemetry/pipeline_health_test.go @@ -7,7 +7,6 @@ package telemetry import ( "context" "errors" - "os" "testing" "time" @@ -16,10 +15,10 @@ import ( func TestPipeline_HealthGauge_Registers(t *testing.T) { clearTelemetryEnv() - os.Setenv(EnvEnabled, "true") - os.Setenv(EnvCloudEnabled, "false") - os.Setenv(EnvGRPCPort, "54401") - os.Setenv(EnvHTTPPort, "54402") + t.Setenv(EnvEnabled, "true") + t.Setenv(EnvCloudEnabled, "false") + t.Setenv(EnvGRPCPort, "54401") + t.Setenv(EnvHTTPPort, "54402") defer clearTelemetryEnv() cfg := &Config{ @@ -54,10 +53,10 @@ func TestPipeline_HealthGauge_Registers(t *testing.T) { func TestPipeline_HealthGauge_StopsOnStop(t *testing.T) { clearTelemetryEnv() - os.Setenv(EnvEnabled, "true") - os.Setenv(EnvCloudEnabled, "false") - os.Setenv(EnvGRPCPort, "54403") - os.Setenv(EnvHTTPPort, "54404") + t.Setenv(EnvEnabled, "true") + t.Setenv(EnvCloudEnabled, "false") + t.Setenv(EnvGRPCPort, "54403") + t.Setenv(EnvHTTPPort, "54404") defer clearTelemetryEnv() cfg := &Config{ diff --git a/pkg/store/entadapter/skill_store.go b/pkg/store/entadapter/skill_store.go index 4e9bd70bd..6c0187544 100644 --- a/pkg/store/entadapter/skill_store.go +++ b/pkg/store/entadapter/skill_store.go @@ -22,11 +22,11 @@ import ( "time" entsql "entgo.io/ent/dialect/sql" - "github.com/Masterminds/semver/v3" "github.com/GoogleCloudPlatform/scion/pkg/ent" entskill "github.com/GoogleCloudPlatform/scion/pkg/ent/skill" entskillversion "github.com/GoogleCloudPlatform/scion/pkg/ent/skillversion" "github.com/GoogleCloudPlatform/scion/pkg/store" + "github.com/Masterminds/semver/v3" ) // SkillStore implements store.SkillStore using Ent ORM.