diff --git a/cmd/appview/serve.go b/cmd/appview/serve.go index bef4154..15b0006 100644 --- a/cmd/appview/serve.go +++ b/cmd/appview/serve.go @@ -397,7 +397,7 @@ func serveRegistry(cmd *cobra.Command, args []string) error { return } - var metadataMap map[string]interface{} + var metadataMap map[string]any if err := json.Unmarshal(metadataBytes, &metadataMap); err != nil { http.Error(w, "Failed to unmarshal metadata", http.StatusInternalServerError) return diff --git a/docs/INTEGRATION_STRATEGY.md b/docs/INTEGRATION_STRATEGY.md index 5427668..177da96 100644 --- a/docs/INTEGRATION_STRATEGY.md +++ b/docs/INTEGRATION_STRATEGY.md @@ -251,7 +251,7 @@ func (h *Handler) VerifyImage(w http.ResponseWriter, r *http.Request) { return } - json.NewEncoder(w).Encode(map[string]interface{}{ + json.NewEncoder(w).Encode(map[string]any{ "verified": result.Verified, "did": result.Signature.DID, "signedAt": result.Signature.SignedAt, diff --git a/docs/SIGNATURE_INTEGRATION.md b/docs/SIGNATURE_INTEGRATION.md index f0fbf8b..a06900a 100644 --- a/docs/SIGNATURE_INTEGRATION.md +++ b/docs/SIGNATURE_INTEGRATION.md @@ -545,7 +545,7 @@ func (v *ATProtoVerifier) VerifyReference( Name: v.name, Type: v.Type(), Message: fmt.Sprintf("Verified for DID %s", sigData.ATProto.DID), - Extensions: map[string]interface{}{ + Extensions: map[string]any{ "did": sigData.ATProto.DID, "handle": sigData.ATProto.Handle, "signedAt": sigData.ATProto.SignedAt, @@ -673,7 +673,7 @@ type ProviderRequest struct { type ProviderResponse struct { SystemError string `json:"system_error,omitempty"` - Responses []map[string]interface{} `json:"responses"` + Responses []map[string]any `json:"responses"` } func handleProvide(w http.ResponseWriter, r *http.Request) { @@ -684,11 +684,11 @@ func handleProvide(w http.ResponseWriter, r *http.Request) { } // Verify each image - responses := make([]map[string]interface{}, 0, len(req.Values)) + responses := make([]map[string]any, 0, len(req.Values)) for _, image := range req.Values { result, err := verifier.Verify(context.Background(), image) - response := map[string]interface{}{ + response := map[string]any{ "image": image, "verified": false, } diff --git a/examples/plugins/gatekeeper-provider/main.go.temp b/examples/plugins/gatekeeper-provider/main.go.temp index e823f85..425a670 100644 --- a/examples/plugins/gatekeeper-provider/main.go.temp +++ b/examples/plugins/gatekeeper-provider/main.go.temp @@ -35,7 +35,7 @@ type ProviderRequest struct { // ProviderResponse is the response format to Gatekeeper. type ProviderResponse struct { SystemError string `json:"system_error,omitempty"` - Responses []map[string]interface{} `json:"responses"` + Responses []map[string]any `json:"responses"` } // VerificationResult holds the result of verifying a single image. @@ -110,7 +110,7 @@ func (s *Server) handleProvide(w http.ResponseWriter, r *http.Request) { log.Printf("INFO: received verification request for %d images", len(req.Values)) // Verify each image - responses := make([]map[string]interface{}, 0, len(req.Values)) + responses := make([]map[string]any, 0, len(req.Values)) for _, image := range req.Values { result := s.verifyImage(r.Context(), image) responses = append(responses, structToMap(result)) @@ -186,9 +186,9 @@ func (s *Server) handleReady(w http.ResponseWriter, r *http.Request) { } // structToMap converts a struct to a map for JSON encoding. -func structToMap(v interface{}) map[string]interface{} { +func structToMap(v any) map[string]any { data, _ := json.Marshal(v) - var m map[string]interface{} + var m map[string]any json.Unmarshal(data, &m) return m } diff --git a/examples/plugins/ratify-verifier/README.md b/examples/plugins/ratify-verifier/README.md index a8e9304..ae545ef 100644 --- a/examples/plugins/ratify-verifier/README.md +++ b/examples/plugins/ratify-verifier/README.md @@ -196,7 +196,7 @@ type VerifierResult struct { Name string Type string Message string - Extensions map[string]interface{} + Extensions map[string]any } ``` diff --git a/examples/plugins/ratify-verifier/verifier.go.temp b/examples/plugins/ratify-verifier/verifier.go.temp index 732d0f3..dfda455 100644 --- a/examples/plugins/ratify-verifier/verifier.go.temp +++ b/examples/plugins/ratify-verifier/verifier.go.temp @@ -166,7 +166,7 @@ func (v *ATProtoVerifier) VerifyReference( Name: v.name, Type: v.Type(), Message: fmt.Sprintf("Successfully verified ATProto signature for DID %s", sigData.ATProto.DID), - Extensions: map[string]interface{}{ + Extensions: map[string]any{ "did": sigData.ATProto.DID, "handle": sigData.ATProto.Handle, "signedAt": sigData.ATProto.SignedAt, @@ -203,7 +203,7 @@ func (v *ATProtoVerifier) failureResult(message string) verifier.VerifierResult Name: v.name, Type: v.Type(), Message: message, - Extensions: map[string]interface{}{ + Extensions: map[string]any{ "error": message, }, } diff --git a/pkg/appview/db/oauth_store.go b/pkg/appview/db/oauth_store.go index 40aa8f9..d46d9fd 100644 --- a/pkg/appview/db/oauth_store.go +++ b/pkg/appview/db/oauth_store.go @@ -339,8 +339,8 @@ func scopesMatch(stored, desired []string) bool { // GetSessionStats returns statistics about stored OAuth sessions // Useful for monitoring and debugging session health -func (s *OAuthStore) GetSessionStats(ctx context.Context) (map[string]interface{}, error) { - stats := make(map[string]interface{}) +func (s *OAuthStore) GetSessionStats(ctx context.Context) (map[string]any, error) { + stats := make(map[string]any) // Total sessions var totalSessions int @@ -392,7 +392,7 @@ func (s *OAuthStore) GetSessionStats(ctx context.Context) (map[string]interface{ // ListSessionsForMonitoring returns a list of all sessions with basic info for monitoring // Returns: DID, session age (minutes), last update time -func (s *OAuthStore) ListSessionsForMonitoring(ctx context.Context) ([]map[string]interface{}, error) { +func (s *OAuthStore) ListSessionsForMonitoring(ctx context.Context) ([]map[string]any, error) { rows, err := s.db.QueryContext(ctx, ` SELECT account_did, @@ -408,7 +408,7 @@ func (s *OAuthStore) ListSessionsForMonitoring(ctx context.Context) ([]map[strin } defer rows.Close() - var sessions []map[string]interface{} + var sessions []map[string]any for rows.Next() { var did, sessionID, createdAt, updatedAt string var idleMinutes int @@ -418,7 +418,7 @@ func (s *OAuthStore) ListSessionsForMonitoring(ctx context.Context) ([]map[strin continue } - sessions = append(sessions, map[string]interface{}{ + sessions = append(sessions, map[string]any{ "did": did, "session_id": sessionID, "created_at": createdAt, diff --git a/pkg/appview/handlers/images.go b/pkg/appview/handlers/images.go index b7a0ca7..a137579 100644 --- a/pkg/appview/handlers/images.go +++ b/pkg/appview/handlers/images.go @@ -95,7 +95,7 @@ func (h *DeleteManifestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusConflict) - json.NewEncoder(w).Encode(map[string]interface{}{ + json.NewEncoder(w).Encode(map[string]any{ "error": "confirmation_required", "message": "This manifest has associated tags that will also be deleted", "tags": tags, diff --git a/pkg/atproto/directory_test.go b/pkg/atproto/directory_test.go index 1e81d55..d0a35cf 100644 --- a/pkg/atproto/directory_test.go +++ b/pkg/atproto/directory_test.go @@ -32,7 +32,7 @@ func TestGetDirectoryConcurrency(t *testing.T) { wg.Add(numGoroutines) // Channel to collect all directory instances - instances := make(chan interface{}, numGoroutines) + instances := make(chan any, numGoroutines) // Launch many goroutines concurrently accessing GetDirectory for i := 0; i < numGoroutines; i++ { @@ -48,7 +48,7 @@ func TestGetDirectoryConcurrency(t *testing.T) { close(instances) // Collect all instances - var dirs []interface{} + var dirs []any for dir := range instances { dirs = append(dirs, dir) } @@ -72,7 +72,7 @@ func TestGetDirectoryConcurrency(t *testing.T) { func TestGetDirectorySequential(t *testing.T) { t.Run("multiple calls in sequence", func(t *testing.T) { // Get directory multiple times in sequence - dirs := make([]interface{}, 10) + dirs := make([]any, 10) for i := 0; i < 10; i++ { dirs[i] = GetDirectory() } @@ -122,7 +122,7 @@ func TestGetDirectoryRaceConditions(t *testing.T) { var wg sync.WaitGroup wg.Add(numGoroutines) - instances := make([]interface{}, numGoroutines) + instances := make([]any, numGoroutines) var mu sync.Mutex // Simulate many goroutines trying to get the directory simultaneously diff --git a/pkg/auth/hold_remote_test.go b/pkg/auth/hold_remote_test.go index 32fbd8a..c49bb1b 100644 --- a/pkg/auth/hold_remote_test.go +++ b/pkg/auth/hold_remote_test.go @@ -78,10 +78,10 @@ func TestFetchCaptainRecordFromXRPC(t *testing.T) { } // Return mock response - response := map[string]interface{}{ + response := map[string]any{ "uri": "at://did:web:test-hold/io.atcr.hold.captain/self", "cid": "bafytest123", - "value": map[string]interface{}{ + "value": map[string]any{ "$type": atproto.CaptainCollection, "owner": "did:plc:owner123", "public": true, @@ -281,10 +281,10 @@ func TestGetBackoffDuration(t *testing.T) { func TestCheckReadAccess_PublicHold(t *testing.T) { // Create mock server that returns public captain record server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - response := map[string]interface{}{ + response := map[string]any{ "uri": "at://did:web:test-hold/io.atcr.hold.captain/self", "cid": "bafytest123", - "value": map[string]interface{}{ + "value": map[string]any{ "$type": atproto.CaptainCollection, "owner": "did:plc:owner123", "public": true, // Public hold diff --git a/pkg/auth/token/handler_test.go b/pkg/auth/token/handler_test.go index 1ba9859..3f44547 100644 --- a/pkg/auth/token/handler_test.go +++ b/pkg/auth/token/handler_test.go @@ -513,7 +513,7 @@ func TestTokenResponse_JSONFormat(t *testing.T) { } // Verify JSON structure - var decoded map[string]interface{} + var decoded map[string]any if err := json.Unmarshal(data, &decoded); err != nil { t.Fatalf("Failed to unmarshal JSON: %v", err) } diff --git a/pkg/auth/token/issuer_test.go b/pkg/auth/token/issuer_test.go index 4364f15..f0a3dcb 100644 --- a/pkg/auth/token/issuer_test.go +++ b/pkg/auth/token/issuer_test.go @@ -207,7 +207,7 @@ func TestIssuer_Issue_ValidateToken(t *testing.T) { } // Parse and validate the token - token, err := jwt.ParseWithClaims(tokenString, &Claims{}, func(token *jwt.Token) (interface{}, error) { + token, err := jwt.ParseWithClaims(tokenString, &Claims{}, func(token *jwt.Token) (any, error) { return issuer.publicKey, nil }) if err != nil { @@ -289,7 +289,7 @@ func TestIssuer_Issue_X5CHeader(t *testing.T) { } // x5c should be a slice of base64-encoded certificates - x5cSlice, ok := x5c.([]interface{}) + x5cSlice, ok := x5c.([]any) if !ok { t.Fatal("Expected x5c to be a slice") } @@ -575,7 +575,7 @@ func TestIssuer_DifferentExpirations(t *testing.T) { } // Parse token and verify expiration - token, err := jwt.ParseWithClaims(tokenString, &Claims{}, func(token *jwt.Token) (interface{}, error) { + token, err := jwt.ParseWithClaims(tokenString, &Claims{}, func(token *jwt.Token) (any, error) { return issuer.publicKey, nil }) if err != nil { diff --git a/pkg/hold/pds/records_test.go b/pkg/hold/pds/records_test.go index 6b5b8e1..469838f 100644 --- a/pkg/hold/pds/records_test.go +++ b/pkg/hold/pds/records_test.go @@ -614,7 +614,7 @@ type mockRepo struct { records map[string]string // key -> cid } -func (m *mockRepo) ForEach(ctx context.Context, prefix string, fn func(string, interface{}) error) error { +func (m *mockRepo) ForEach(ctx context.Context, prefix string, fn func(string, any) error) error { for k, v := range m.records { if err := fn(k, v); err != nil { if err == repo.ErrDoneIterating {