Skip to content

Commit 9b0e16c

Browse files
committed
lint: execute pre-commit hooks
1 parent f39d9b8 commit 9b0e16c

File tree

35 files changed

+135
-137
lines changed

35 files changed

+135
-137
lines changed

sysdig/data_source_sysdig_fargate_ECS_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ func sortAndCompare(t *testing.T, expected []byte, actual []byte) {
4242
// getKiltRecipe returns the default json Kilt recipe
4343
func getKiltRecipe(t *testing.T) string {
4444
recipeConfig := KiltRecipeConfig{
45-
SysdigAccessKey: "sysdig_access_key",
46-
AgentImage: "workload_agent_image",
47-
OrchestratorHost: "orchestrator_host",
48-
OrchestratorPort: "orchestrator_port",
49-
CollectorHost: "collector_host",
50-
CollectorPort: "collector_port",
51-
SysdigLogging: "sysdig_logging",
52-
Priority: "priority",
45+
SysdigAccessKey: "sysdig_access_key",
46+
AgentImage: "workload_agent_image",
47+
CollectorHost: "collector_host",
48+
CollectorPort: "collector_port",
49+
SysdigLogging: "sysdig_logging",
50+
Priority: "priority",
5351
}
5452

5553
jsonRecipeConfig, err := json.Marshal(&recipeConfig)

sysdig/data_source_sysdig_fargate_workload_agent.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,13 @@ func patchFargateTaskDefinition(ctx context.Context, containerDefinitions string
346346
}
347347

348348
type KiltRecipeConfig struct {
349-
SysdigAccessKey string `json:"sysdig_access_key"`
350-
AgentImage string `json:"agent_image"`
351-
CollectorHost string `json:"collector_host"`
352-
CollectorPort string `json:"collector_port"`
353-
SysdigLogging string `json:"sysdig_logging"`
354-
Sidecar string `json:"sidecar"`
355-
Priority string `json:"priority"`
349+
SysdigAccessKey string `json:"sysdig_access_key"`
350+
AgentImage string `json:"agent_image"`
351+
CollectorHost string `json:"collector_host"`
352+
CollectorPort string `json:"collector_port"`
353+
SysdigLogging string `json:"sysdig_logging"`
354+
Sidecar string `json:"sidecar"`
355+
Priority string `json:"priority"`
356356
}
357357

358358
type patchOptions struct {
@@ -427,13 +427,13 @@ func dataSourceSysdigFargateWorkloadAgentRead(ctx context.Context, d *schema.Res
427427
}
428428

429429
recipeConfig := KiltRecipeConfig{
430-
SysdigAccessKey: d.Get("sysdig_access_key").(string),
431-
AgentImage: d.Get("workload_agent_image").(string),
432-
CollectorHost: d.Get("collector_host").(string),
433-
CollectorPort: d.Get("collector_port").(string),
434-
SysdigLogging: d.Get("sysdig_logging").(string),
435-
Sidecar: d.Get("sidecar").(string),
436-
Priority: priority,
430+
SysdigAccessKey: d.Get("sysdig_access_key").(string),
431+
AgentImage: d.Get("workload_agent_image").(string),
432+
CollectorHost: d.Get("collector_host").(string),
433+
CollectorPort: d.Get("collector_port").(string),
434+
SysdigLogging: d.Get("sysdig_logging").(string),
435+
Sidecar: d.Get("sidecar").(string),
436+
Priority: priority,
437437
}
438438

439439
jsonConf, err := json.Marshal(&recipeConfig)

sysdig/internal/client/v2/users.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (c *Client) DeleteUser(ctx context.Context, id int) (err error) {
152152
func (c *Client) GetCurrentUser(ctx context.Context) (u *User, err error) {
153153
response, err := c.requester.Request(ctx, http.MethodGet, c.getCurrentUserURL(), nil)
154154
if err != nil {
155-
return
155+
return u, err
156156
}
157157
defer func() {
158158
if dErr := response.Body.Close(); dErr != nil {
@@ -162,7 +162,7 @@ func (c *Client) GetCurrentUser(ctx context.Context) (u *User, err error) {
162162

163163
if response.StatusCode != http.StatusOK {
164164
err = c.ErrorFromResponse(response)
165-
return
165+
return u, err
166166
}
167167

168168
wrapper, err := Unmarshal[userWrapper](response.Body)

sysdig/resource_sysdig_monitor_alert_v2_prometheus.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ func resourceSysdigMonitorAlertV2Prometheus() *schema.Resource {
3333

3434
Schema: createAlertV2Schema(map[string]*schema.Schema{
3535
"duration_seconds": {
36-
Type: schema.TypeInt,
37-
Optional: true,
38-
Computed: true, // computed if trigger_after_minutes is defined
39-
ValidateFunc: validation.IntAtLeast(0),
36+
Type: schema.TypeInt,
37+
Optional: true,
38+
Computed: true, // computed if trigger_after_minutes is defined
39+
ValidateFunc: validation.IntAtLeast(0),
4040
},
4141
"query": {
4242
Type: schema.TypeString,
@@ -173,7 +173,7 @@ func buildAlertV2PrometheusStruct(d *schema.ResourceData) *v2.AlertV2Prometheus
173173
func updateAlertV2PrometheusState(d *schema.ResourceData, alert *v2.AlertV2Prometheus) (err error) {
174174
err = updateAlertV2CommonState(d, &alert.AlertV2Common)
175175
if err != nil {
176-
return
176+
return err
177177
}
178178

179179
_ = d.Set("duration_seconds", alert.Config.Duration)
@@ -186,5 +186,5 @@ func updateAlertV2PrometheusState(d *schema.ResourceData, alert *v2.AlertV2Prome
186186
_ = d.Set("keep_firing_for_minutes", nil)
187187
}
188188

189-
return
189+
return err
190190
}

sysdig/resource_sysdig_monitor_dashboard.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ func sharingFromResourceData(data *schema.ResourceData) (sharingSettings []*v2.S
428428
Role: shareInfo["role"].(string),
429429
})
430430
}
431-
return
431+
return sharingSettings, err
432432
}
433433

434434
func panelsFromResourceData(data *schema.ResourceData) (panels []*v2.Panels, err error) {
@@ -452,7 +452,7 @@ func panelsFromResourceData(data *schema.ResourceData) (panels []*v2.Panels, err
452452

453453
panels = append(panels, panel)
454454
}
455-
return
455+
return panels, err
456456
}
457457

458458
func defaultLegendConfiguration() *v2.LegendConfiguration {
@@ -726,7 +726,7 @@ func queriesFromResourceData(panelInfo map[string]any, panel *v2.Panels) (newQue
726726

727727
newQueries = append(newQueries, promqlQuery)
728728
}
729-
return
729+
return newQueries, err
730730
}
731731

732732
func dashboardToResourceData(dashboard *v2.Dashboard, data *schema.ResourceData) (err error) {

sysdig/resource_sysdig_monitor_notification_channel_common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func monitorNotificationChannelFromResourceData(d *schema.ResourceData, teamID i
6666
SendTestNotification: d.Get("send_test_notification").(bool),
6767
},
6868
}
69-
return
69+
return nc, err
7070
}
7171

7272
func monitorNotificationChannelToResourceData(nc *v2.NotificationChannel, data *schema.ResourceData) (err error) {
@@ -86,7 +86,7 @@ func monitorNotificationChannelToResourceData(nc *v2.NotificationChannel, data *
8686
_ = data.Set("notify_when_resolved", nc.Options.NotifyOnResolve)
8787
// do not update "send_test_notification" from the api response as it will always be "false" on subsequent reads because the fields is not persisted
8888

89-
return
89+
return err
9090
}
9191

9292
func getMonitorNotificationChannelClient(c SysdigClients) (v2.NotificationChannelInterface, error) {

sysdig/resource_sysdig_monitor_notification_channel_custom_webhook.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func resourceSysdigMonitorNotificationChannelCustomWebhookDelete(ctx context.Con
156156
func monitorNotificationChannelCustomWebhookFromResourceData(d *schema.ResourceData, teamID int) (nc v2.NotificationChannel, err error) {
157157
nc, err = monitorNotificationChannelFromResourceData(d, teamID)
158158
if err != nil {
159-
return
159+
return nc, err
160160
}
161161

162162
nc.Type = notificationChannelTypeCustomWebhook
@@ -166,13 +166,13 @@ func monitorNotificationChannelCustomWebhookFromResourceData(d *schema.ResourceD
166166
nc.Options.AdditionalHeaders = d.Get("additional_headers").(map[string]any)
167167
allowInsecureConnections := d.Get("allow_insecure_connections").(bool)
168168
nc.Options.AllowInsecureConnections = &allowInsecureConnections
169-
return
169+
return nc, err
170170
}
171171

172172
func monitorNotificationChannelCustomWebhookToResourceData(nc *v2.NotificationChannel, d *schema.ResourceData) (err error) {
173173
err = monitorNotificationChannelToResourceData(nc, d)
174174
if err != nil {
175-
return
175+
return err
176176
}
177177

178178
_ = d.Set("url", nc.Options.URL)
@@ -183,5 +183,5 @@ func monitorNotificationChannelCustomWebhookToResourceData(nc *v2.NotificationCh
183183
_ = d.Set("allow_insecure_connections", *nc.Options.AllowInsecureConnections)
184184
}
185185

186-
return
186+
return err
187187
}

sysdig/resource_sysdig_monitor_notification_channel_email.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,21 @@ func resourceSysdigMonitorNotificationChannelEmailDelete(ctx context.Context, d
138138
func monitorNotificationChannelEmailFromResourceData(d *schema.ResourceData, teamID int) (nc v2.NotificationChannel, err error) {
139139
nc, err = monitorNotificationChannelFromResourceData(d, teamID)
140140
if err != nil {
141-
return
141+
return nc, err
142142
}
143143

144144
nc.Type = notificationChannelTypeEmail
145145
nc.Options.EmailRecipients = cast.ToStringSlice(d.Get("recipients").(*schema.Set).List())
146-
return
146+
return nc, err
147147
}
148148

149149
func monitorNotificationChannelEmailToResourceData(nc *v2.NotificationChannel, d *schema.ResourceData) (err error) {
150150
err = monitorNotificationChannelToResourceData(nc, d)
151151
if err != nil {
152-
return
152+
return err
153153
}
154154

155155
_ = d.Set("recipients", nc.Options.EmailRecipients)
156156

157-
return
157+
return err
158158
}

sysdig/resource_sysdig_monitor_notification_channel_google_chat.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,21 @@ func resourceSysdigMonitorNotificationChannelGoogleChatDelete(ctx context.Contex
145145
func monitorNotificationChannelGoogleChatFromResourceData(d *schema.ResourceData, teamID int) (nc v2.NotificationChannel, err error) {
146146
nc, err = monitorNotificationChannelFromResourceData(d, teamID)
147147
if err != nil {
148-
return
148+
return nc, err
149149
}
150150

151151
nc.Type = notificationChannelTypeGChat
152152
nc.Options.URL = d.Get("url").(string)
153-
return
153+
return nc, err
154154
}
155155

156156
func monitorNotificationChannelGoogleChatToResourceData(nc *v2.NotificationChannel, d *schema.ResourceData) (err error) {
157157
err = monitorNotificationChannelToResourceData(nc, d)
158158
if err != nil {
159-
return
159+
return err
160160
}
161161

162162
_ = d.Set("url", nc.Options.URL)
163163

164-
return
164+
return err
165165
}

sysdig/resource_sysdig_monitor_notification_channel_ibm_event_notification.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,21 @@ func resourceSysdigMonitorNotificationChannelIBMEventNotificationDelete(ctx cont
145145
func monitorNotificationChannelIBMEventNotificationFromResourceData(d *schema.ResourceData, teamID int) (nc v2.NotificationChannel, err error) {
146146
nc, err = monitorNotificationChannelFromResourceData(d, teamID)
147147
if err != nil {
148-
return
148+
return nc, err
149149
}
150150

151151
nc.Type = notificationChannelTypeIBMEventNotification
152152
nc.Options.InstanceID = d.Get("instance_id").(string)
153-
return
153+
return nc, err
154154
}
155155

156156
func monitorNotificationChannelIBMEventNotificationToResourceData(nc *v2.NotificationChannel, d *schema.ResourceData) (err error) {
157157
err = monitorNotificationChannelToResourceData(nc, d)
158158
if err != nil {
159-
return
159+
return err
160160
}
161161

162162
_ = d.Set("instance_id", nc.Options.InstanceID)
163163

164-
return
164+
return err
165165
}

0 commit comments

Comments
 (0)