Skip to content

Commit fc9e86e

Browse files
committed
Linting fixes and updating APIs
1 parent 5045600 commit fc9e86e

File tree

40 files changed

+464
-464
lines changed

40 files changed

+464
-464
lines changed

github/data_source_github_organization_projects.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func dataSourceGithubOrganizationProjects() *schema.Resource {
116116
}
117117
}
118118

119-
func dataSourceGithubOrganizationProjectsRead(d *schema.ResourceData, meta interface{}) error {
119+
func dataSourceGithubOrganizationProjectsRead(d *schema.ResourceData, meta any) error {
120120
client := meta.(*Owner).v3client
121121
ctx := context.Background()
122122

@@ -128,13 +128,13 @@ func dataSourceGithubOrganizationProjectsRead(d *schema.ResourceData, meta inter
128128
for {
129129
if opts == nil {
130130
opts = &github.ListProjectsOptions{
131-
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Int(100)},
131+
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Ptr(100)},
132132
}
133133
}
134134

135135
projects, resp, err := client.Projects.ListOrganizationProjects(ctx, orgName, opts)
136136
if err != nil {
137-
return fmt.Errorf("error listing organization Projects V2: %v", err)
137+
return fmt.Errorf("error listing organization Projects V2: %w", err)
138138
}
139139

140140
allProjects = append(allProjects, projects...)
@@ -145,18 +145,18 @@ func dataSourceGithubOrganizationProjectsRead(d *schema.ResourceData, meta inter
145145

146146
opts = &github.ListProjectsOptions{
147147
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{
148-
PerPage: github.Int(100),
149-
After: github.String(resp.After),
148+
PerPage: github.Ptr(100),
149+
After: github.Ptr(resp.After),
150150
},
151151
}
152152
}
153153

154154
d.SetId(orgName)
155155

156-
projectsData := make([]map[string]interface{}, 0, len(allProjects))
156+
projectsData := make([]map[string]any, 0, len(allProjects))
157157

158158
for _, project := range allProjects {
159-
projectData := map[string]interface{}{
159+
projectData := map[string]any{
160160
"id": project.GetID(),
161161
"node_id": project.GetNodeID(),
162162
"number": project.GetNumber(),
@@ -198,7 +198,7 @@ func dataSourceGithubOrganizationProjectsRead(d *schema.ResourceData, meta inter
198198
}
199199

200200
if err := d.Set("projects", projectsData); err != nil {
201-
return fmt.Errorf("error setting projects: %v", err)
201+
return fmt.Errorf("error setting projects: %w", err)
202202
}
203203

204204
return nil

github/data_source_github_project_fields.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func dataSourceGithubProjectFields() *schema.Resource {
117117
}
118118
}
119119

120-
func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta interface{}) error {
120+
func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta any) error {
121121
client := meta.(*Owner).v3client
122122
ctx := context.Background()
123123

@@ -136,7 +136,7 @@ func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta interface{})
136136
for {
137137
if opts == nil {
138138
opts = &github.ListProjectsOptions{
139-
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Int(100)},
139+
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Ptr(100)},
140140
}
141141
}
142142

@@ -150,7 +150,7 @@ func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta interface{})
150150
}
151151

152152
if err != nil {
153-
return fmt.Errorf("error listing project fields: %v", err)
153+
return fmt.Errorf("error listing project fields: %w", err)
154154
}
155155

156156
allFields = append(allFields, fields...)
@@ -161,8 +161,8 @@ func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta interface{})
161161

162162
opts = &github.ListProjectsOptions{
163163
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{
164-
PerPage: github.Int(100),
165-
After: github.String(resp.After),
164+
PerPage: github.Ptr(100),
165+
After: github.Ptr(resp.After),
166166
},
167167
}
168168
}
@@ -176,10 +176,10 @@ func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta interface{})
176176
}
177177
d.SetId(resourceID)
178178

179-
fieldsData := make([]map[string]interface{}, 0, len(allFields))
179+
fieldsData := make([]map[string]any, 0, len(allFields))
180180

181181
for _, field := range allFields {
182-
fieldData := map[string]interface{}{
182+
fieldData := map[string]any{
183183
"id": field.GetID(),
184184
"node_id": field.GetNodeID(),
185185
"name": field.GetName(),
@@ -191,9 +191,9 @@ func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta interface{})
191191

192192
// Add options for single_select fields
193193
if len(field.Options) > 0 {
194-
optionsData := make([]map[string]interface{}, 0, len(field.Options))
194+
optionsData := make([]map[string]any, 0, len(field.Options))
195195
for _, option := range field.Options {
196-
optionData := map[string]interface{}{
196+
optionData := map[string]any{
197197
"id": option.GetID(),
198198
"color": option.GetColor(),
199199
}
@@ -217,7 +217,7 @@ func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta interface{})
217217
}
218218

219219
if err := d.Set("fields", fieldsData); err != nil {
220-
return fmt.Errorf("error setting fields: %v", err)
220+
return fmt.Errorf("error setting fields: %w", err)
221221
}
222222

223223
return nil

github/data_source_github_user_projects.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func dataSourceGithubUserProjects() *schema.Resource {
116116
}
117117
}
118118

119-
func dataSourceGithubUserProjectsRead(d *schema.ResourceData, meta interface{}) error {
119+
func dataSourceGithubUserProjectsRead(d *schema.ResourceData, meta any) error {
120120
client := meta.(*Owner).v3client
121121
ctx := context.Background()
122122

@@ -128,13 +128,13 @@ func dataSourceGithubUserProjectsRead(d *schema.ResourceData, meta interface{})
128128
for {
129129
if opts == nil {
130130
opts = &github.ListProjectsOptions{
131-
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Int(100)},
131+
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Ptr(100)},
132132
}
133133
}
134134

135135
projects, resp, err := client.Projects.ListUserProjects(ctx, username, opts)
136136
if err != nil {
137-
return fmt.Errorf("error listing user Projects V2: %v", err)
137+
return fmt.Errorf("error listing user Projects V2: %w", err)
138138
}
139139

140140
allProjects = append(allProjects, projects...)
@@ -145,18 +145,18 @@ func dataSourceGithubUserProjectsRead(d *schema.ResourceData, meta interface{})
145145

146146
opts = &github.ListProjectsOptions{
147147
ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{
148-
PerPage: github.Int(100),
149-
After: github.String(resp.After),
148+
PerPage: github.Ptr(100),
149+
After: github.Ptr(resp.After),
150150
},
151151
}
152152
}
153153

154154
d.SetId(username)
155155

156-
projectsData := make([]map[string]interface{}, 0, len(allProjects))
156+
projectsData := make([]map[string]any, 0, len(allProjects))
157157

158158
for _, project := range allProjects {
159-
projectData := map[string]interface{}{
159+
projectData := map[string]any{
160160
"id": project.GetID(),
161161
"node_id": project.GetNodeID(),
162162
"number": project.GetNumber(),
@@ -198,7 +198,7 @@ func dataSourceGithubUserProjectsRead(d *schema.ResourceData, meta interface{})
198198
}
199199

200200
if err := d.Set("projects", projectsData); err != nil {
201-
return fmt.Errorf("error setting projects: %v", err)
201+
return fmt.Errorf("error setting projects: %w", err)
202202
}
203203

204204
return nil

github/resource_github_actions_organization_permissions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ func resourceGithubActionsOrganizationPermissionsDelete(d *schema.ResourceData,
297297
_, _, err = client.Actions.UpdateActionsPermissions(ctx,
298298
orgName,
299299
github.ActionsPermissions{
300-
AllowedActions: github.String("all"),
301-
EnabledRepositories: github.String("all"),
300+
AllowedActions: github.Ptr("all"),
301+
EnabledRepositories: github.Ptr("all"),
302302
})
303303
if err != nil {
304304
return err

github/resource_github_actions_repository_access_level.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func resourceGithubActionsRepositoryAccessLevelCreateOrUpdate(d *schema.Resource
4646

4747
accessLevel := d.Get("access_level").(string)
4848
actionAccessLevel := github.RepositoryActionsAccessLevel{
49-
AccessLevel: github.String(accessLevel),
49+
AccessLevel: github.Ptr(accessLevel),
5050
}
5151

5252
_, err := client.Repositories.EditActionsAccessLevel(ctx, owner, repoName, actionAccessLevel)
@@ -81,7 +81,7 @@ func resourceGithubActionsRepositoryAccessLevelDelete(d *schema.ResourceData, me
8181
ctx := context.WithValue(context.Background(), ctxId, repoName)
8282

8383
actionAccessLevel := github.RepositoryActionsAccessLevel{
84-
AccessLevel: github.String("none"),
84+
AccessLevel: github.Ptr("none"),
8585
}
8686
_, err := client.Repositories.EditActionsAccessLevel(ctx, owner, repoName, actionAccessLevel)
8787

github/resource_github_actions_repository_oidc_subject_claim_customization_template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDelete(
117117
owner := meta.(*Owner).name
118118

119119
customOIDCSubjectClaimTemplate := &github.OIDCSubjectClaimCustomTemplate{
120-
UseDefault: github.Bool(true),
120+
UseDefault: github.Ptr(true),
121121
}
122122

123123
ctx := context.Background()

github/resource_github_actions_repository_permissions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ func resourceGithubActionsRepositoryPermissionsDelete(d *schema.ResourceData, me
222222

223223
// Reset the repo to "default" settings
224224
repoActionPermissions := github.ActionsPermissionsRepository{
225-
AllowedActions: github.String("all"),
226-
Enabled: github.Bool(true),
225+
AllowedActions: github.Ptr("all"),
226+
Enabled: github.Ptr(true),
227227
}
228228

229229
_, _, err := client.Repositories.UpdateActionsPermissions(ctx,

github/resource_github_branch_protection_v3_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
func buildProtectionRequest(d *schema.ResourceData) (*github.ProtectionRequest, error) {
1616
req := &github.ProtectionRequest{
1717
EnforceAdmins: d.Get("enforce_admins").(bool),
18-
RequiredConversationResolution: github.Bool(d.Get("require_conversation_resolution").(bool)),
18+
RequiredConversationResolution: github.Ptr(d.Get("require_conversation_resolution").(bool)),
1919
}
2020

2121
rsc, err := expandRequiredStatusChecks(d)

github/resource_github_enterprise_actions_permissions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ func resourceGithubActionsEnterprisePermissionsDelete(d *schema.ResourceData, me
280280
_, _, err := client.Actions.UpdateActionsPermissionsInEnterprise(ctx,
281281
d.Get("enterprise_slug").(string),
282282
github.ActionsPermissionsEnterprise{
283-
AllowedActions: github.String("all"),
284-
EnabledOrganizations: github.String("all"),
283+
AllowedActions: github.Ptr("all"),
284+
EnabledOrganizations: github.Ptr("all"),
285285
})
286286
if err != nil {
287287
return err

github/resource_github_enterprise_actions_workflow_permissions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ func resourceGithubEnterpriseActionsWorkflowPermissionsCreateOrUpdate(d *schema.
5454
workflowPerms := github.DefaultWorkflowPermissionEnterprise{}
5555

5656
if v, ok := d.GetOk("default_workflow_permissions"); ok {
57-
workflowPerms.DefaultWorkflowPermissions = github.String(v.(string))
57+
workflowPerms.DefaultWorkflowPermissions = github.Ptr(v.(string))
5858
}
5959

6060
if v, ok := d.GetOk("can_approve_pull_request_reviews"); ok {
61-
workflowPerms.CanApprovePullRequestReviews = github.Bool(v.(bool))
61+
workflowPerms.CanApprovePullRequestReviews = github.Ptr(v.(bool))
6262
}
6363

6464
log.Printf("[DEBUG] Updating workflow permissions for enterprise: %s", enterpriseSlug)
@@ -104,8 +104,8 @@ func resourceGithubEnterpriseActionsWorkflowPermissionsDelete(d *schema.Resource
104104

105105
// Reset to safe defaults
106106
workflowPerms := github.DefaultWorkflowPermissionEnterprise{
107-
DefaultWorkflowPermissions: github.String("read"),
108-
CanApprovePullRequestReviews: github.Bool(false),
107+
DefaultWorkflowPermissions: github.Ptr("read"),
108+
CanApprovePullRequestReviews: github.Ptr(false),
109109
}
110110

111111
_, _, err := client.Actions.UpdateDefaultWorkflowPermissionsInEnterprise(ctx, enterpriseSlug, workflowPerms)

0 commit comments

Comments
 (0)