Skip to content

Commit 524eb66

Browse files
committed
refactor: replace interface{} with any in Go code
1 parent 8879283 commit 524eb66

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

chatops-lark/pkg/events/handler/imagetag_trigger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func queryRegistryImage(ctx context.Context, params *registryImageQueryParams, g
116116
}
117117

118118
dispatchedAt := time.Now().UTC()
119-
inputs := map[string]interface{}{
119+
inputs := map[string]any{
120120
"registry_url": params.Repository,
121121
"image_tag": params.Tag,
122122
}

chatops-lark/pkg/events/handler/repo_admin_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestGetOrgAdmins_ExcludeOrgOwners(t *testing.T) {
2020
mux.HandleFunc("/users/testorg", func(w http.ResponseWriter, r *http.Request) {
2121
w.Header().Set("Content-Type", "application/json")
2222
w.WriteHeader(http.StatusOK)
23-
json.NewEncoder(w).Encode(map[string]interface{}{
23+
json.NewEncoder(w).Encode(map[string]any{
2424
"login": "testorg",
2525
"type": "Organization",
2626
})
@@ -37,7 +37,7 @@ func TestGetOrgAdmins_ExcludeOrgOwners(t *testing.T) {
3737
w.Header().Set("Content-Type", "application/json")
3838
w.WriteHeader(http.StatusOK)
3939

40-
collaborators := []map[string]interface{}{
40+
collaborators := []map[string]any{
4141
{"login": "owner1", "permissions": map[string]bool{"admin": true, "push": true, "pull": true}},
4242
{"login": "owner2", "permissions": map[string]bool{"admin": true, "push": true, "pull": true}},
4343
{"login": "owner3", "permissions": map[string]bool{"admin": true, "push": true, "pull": true}},
@@ -60,7 +60,7 @@ func TestGetOrgAdmins_ExcludeOrgOwners(t *testing.T) {
6060
w.Header().Set("Content-Type", "application/json")
6161
w.WriteHeader(http.StatusOK)
6262

63-
orgOwners := []map[string]interface{}{
63+
orgOwners := []map[string]any{
6464
{"login": "owner1", "type": "User"},
6565
{"login": "owner2", "type": "User"},
6666
{"login": "owner3", "type": "User"},
@@ -115,7 +115,7 @@ func TestGetOrgAdmins_PersonalRepo(t *testing.T) {
115115
mux.HandleFunc("/users/testuser", func(w http.ResponseWriter, r *http.Request) {
116116
w.Header().Set("Content-Type", "application/json")
117117
w.WriteHeader(http.StatusOK)
118-
json.NewEncoder(w).Encode(map[string]interface{}{
118+
json.NewEncoder(w).Encode(map[string]any{
119119
"login": "testuser",
120120
"type": "User",
121121
})
@@ -150,13 +150,13 @@ func TestGetOrgAdmins_NoAdmins(t *testing.T) {
150150
mux.HandleFunc("/repos/testorg/emptyrepo/collaborators", func(w http.ResponseWriter, r *http.Request) {
151151
w.Header().Set("Content-Type", "application/json")
152152
w.WriteHeader(http.StatusOK)
153-
json.NewEncoder(w).Encode([]interface{}{})
153+
json.NewEncoder(w).Encode([]any{})
154154
})
155155

156156
mux.HandleFunc("/orgs/testorg/members", func(w http.ResponseWriter, r *http.Request) {
157157
w.Header().Set("Content-Type", "application/json")
158158
w.WriteHeader(http.StatusOK)
159-
json.NewEncoder(w).Encode([]interface{}{})
159+
json.NewEncoder(w).Encode([]any{})
160160
})
161161

162162
gc := github.NewClient(nil)
@@ -189,7 +189,7 @@ func TestGetOrgAdmins_RepoNotFound(t *testing.T) {
189189
mux.HandleFunc("/repos/testorg/notfound/collaborators", func(w http.ResponseWriter, r *http.Request) {
190190
w.Header().Set("Content-Type", "application/json")
191191
w.WriteHeader(http.StatusNotFound)
192-
json.NewEncoder(w).Encode(map[string]interface{}{
192+
json.NewEncoder(w).Encode(map[string]any{
193193
"message": "Not Found",
194194
})
195195
})

0 commit comments

Comments
 (0)