mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-25 03:34:14 +00:00
interface{} -> any
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user