Skip to content

Commit

Permalink
style: update to any from interface{}
Browse files Browse the repository at this point in the history
  • Loading branch information
grokify committed Aug 27, 2023
1 parent 2540992 commit 61a6bb8
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions examples/local_send/local_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (sender *Sender) SendCcMessage(ccMsg cc.Message, err error) {
if err != nil {
panic(fmt.Sprintf("Bad Test Message: %v\n", err))
}
var resMsg interface{}
req, resp, err := sender.Adapter.SendMessage(ccMsg, &resMsg, map[string]interface{}{})
var resMsg any
req, resp, err := sender.Adapter.SendMessage(ccMsg, &resMsg, map[string]any{})
fmt.Printf("RESPONSE_STATUS_CODE [%v]\n", resp.StatusCode())
if err != nil {
fmt.Printf("ERROR [%v]\n", err)
Expand Down
2 changes: 1 addition & 1 deletion examples/proxy_send/proxy_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (s *ExampleWebhookSender) SendExamplesForInputType(inputType string) error
return nil
}

func BuildURLQueryString(baseURL string, qry interface{}) string {
func BuildURLQueryString(baseURL string, qry any) string {
v, _ := query.Values(qry)
qryString := v.Encode()
if len(qryString) > 0 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/adapters/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewAdapterSet() AdapterSet {

func (set *AdapterSet) SendWebhooks(hookData models.HookData) []models.ErrorInfo {
errs := []models.ErrorInfo{}
hookOpts := map[string]interface{}{}
hookOpts := map[string]any{}
if hookData.OutputFormat == "nocard" {
hookOpts["useAttachments"] = false
log.Debug().
Expand All @@ -32,7 +32,7 @@ func (set *AdapterSet) SendWebhooks(hookData models.HookData) []models.ErrorInfo
}
if len(hookData.OutputType) > 0 && len(hookData.OutputURL) > 0 {
if adapter, ok := set.Adapters[hookData.OutputType]; ok {
var msg interface{}
var msg any
req, res, err := adapter.SendWebhook(
hookData.OutputURL, hookData.CanonicalMessage, &msg, hookOpts)
log.Debug().
Expand All @@ -46,7 +46,7 @@ func (set *AdapterSet) SendWebhooks(hookData models.HookData) []models.ErrorInfo
}
for _, namedAdapter := range hookData.OutputNames {
if adapter, ok := set.Adapters[namedAdapter]; ok {
var msg interface{}
var msg any
req, res, err := adapter.SendMessage(
hookData.CanonicalMessage, &msg, hookOpts)
errs = set.procResponse(errs, req, res, err)
Expand Down
62 changes: 31 additions & 31 deletions pkg/handlers/circleci/handler_circleci_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,28 @@ type CircleciOutPayload struct {
}

type CircleciOutMessage struct {
VCSURL string `json:"vcs_url,omitempty"`
BuildURL string `json:"build_url,omitempty"`
BuildNum int64 `json:"build_num,omitempty"`
Branch string `json:"branch,omitempty"`
VCSRevision string `json:"vcs_revision,omitempty"`
CommitterName string `json:"committer_name,omitempty"`
CommitterEmail string `json:"committer_email,omitempty"`
Subject string `json:"subject,omitempty"`
Body string `json:"body,omitempty"`
Why string `json:"why,omitempty"`
DontBuild interface{} `json:"dont_build,omitempty"`
QueuedAt string `json:"queued_at,omitempty"`
StartTime string `json:"start_time,omitempty"`
StopTime string `json:"stop_time,omitempty"`
BuildTimeMillis int64 `json:"build_time_millis,omitempty"`
Username string `json:"username,omitempty"`
Reponame string `json:"reponame,omitempty"`
Lifecycle string `json:"lifecycle,omitempty"`
Outcome string `json:"outcome,omitempty"`
Status string `json:"status,omitempty"`
RetryOf interface{} `json:"retry_of,omitempty"`
Steps []interface{} `json:"steps,omitempty"`
VCSURL string `json:"vcs_url,omitempty"`
BuildURL string `json:"build_url,omitempty"`
BuildNum int64 `json:"build_num,omitempty"`
Branch string `json:"branch,omitempty"`
VCSRevision string `json:"vcs_revision,omitempty"`
CommitterName string `json:"committer_name,omitempty"`
CommitterEmail string `json:"committer_email,omitempty"`
Subject string `json:"subject,omitempty"`
Body string `json:"body,omitempty"`
Why string `json:"why,omitempty"`
DontBuild any `json:"dont_build,omitempty"`
QueuedAt string `json:"queued_at,omitempty"`
StartTime string `json:"start_time,omitempty"`
StopTime string `json:"stop_time,omitempty"`
BuildTimeMillis int64 `json:"build_time_millis,omitempty"`
Username string `json:"username,omitempty"`
Reponame string `json:"reponame,omitempty"`
Lifecycle string `json:"lifecycle,omitempty"`
Outcome string `json:"outcome,omitempty"`
Status string `json:"status,omitempty"`
RetryOf any `json:"retry_of,omitempty"`
Steps []any `json:"steps,omitempty"`
}

type CircleciOutStep struct {
Expand All @@ -109,15 +109,15 @@ type CircleciOutStep struct {
}

type CircleciOutAction struct {
BashCommand interface{} `json:"bash_command,omitempty"`
RunTimeMillis int64 `json:"run_time_millis,omitempty"`
StartTime string `json:"start_time,omitempty"`
EndTime string `json:"end_time,omitempty"`
Name string `json:"name,omitempty"`
ExitCode interface{} `json:"exit_cide,omitempty"`
Type string `json:"type,omitempty"`
Index int64 `json:"index,omitempty"`
Status string `json:"status,omitempty"`
BashCommand any `json:"bash_command,omitempty"`
RunTimeMillis int64 `json:"run_time_millis,omitempty"`
StartTime string `json:"start_time,omitempty"`
EndTime string `json:"end_time,omitempty"`
Name string `json:"name,omitempty"`
ExitCode any `json:"exit_cide,omitempty"`
Type string `json:"type,omitempty"`
Index int64 `json:"index,omitempty"`
Status string `json:"status,omitempty"`
}

func CircleciOutMessageFromBytes(bytes []byte) (CircleciOutMessage, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/gosquared/handler_gosquared_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ type GosquaredOutLiveMessageMessage struct {
From string `json:"from,omitempty"`
Private bool `json:"private,omitempty"`
Session GosquaredOutLiveMessageSession `json:"session,omitempty"`
Data interface{} `json:"data,omitempty"`
Entities []interface{} `json:"entities,omitempty"`
Data any `json:"data,omitempty"`
Entities []any `json:"entities,omitempty"`
PersonID string `json:"person_id,omitempty"`
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/runscope/handler_runscope_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func Normalize(cfg config.Configuration, hReq handlers.HandlerRequest) (cc.Messa
}

type RunscopeOutMessage struct {
Variables interface{} `json:"variables,omitempty"`
Variables any `json:"variables,omitempty"`
TestID string `json:"test_id,omitempty"`
TestName string `json:"test_name,omitempty"`
TestRunID string `json:"test_run_id,omitempty"`
Expand All @@ -88,7 +88,7 @@ type RunscopeOutMessage struct {
Result string `json:"result,omitempty"`
StartedAt float64 `json:"started_at,omitempty"`
FinishedAt float64 `json:"finished_at,omitempty"`
Agent interface{} `json:"agent,omitempty"`
Agent any `json:"agent,omitempty"`
Region string `json:"region,omitempty"`
RegionName string `json:"region_name,omitempty"`
Requests []RunscopeOutRequest `json:"requests,omitempty"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/handlers/statuspage/handler_statuspage_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,20 @@ type StatuspageOutIncident struct {
ID string `json:"id,omitempty"`
Backfilled bool `json:"backfilled,omitempty"`
Impact string `json:"impact,omitempty"`
ImpactOverride interface{} `json:"impact_override,omitempty"`
ImpactOverride any `json:"impact_override,omitempty"`
MonitoringAt string `json:"monitoring_at,omitempty"`
PostmortemBody interface{} `json:"postmortem_body,omitempty"`
PostmortemBody any `json:"postmortem_body,omitempty"`
PostmortemBodyLastUpdatedAt string `json:"postmortem_body_last_updated_at,omitempty"`
PostmortemIgnored bool `json:"postmortem_ignored,omitempty"`
PostmortemNotifiedSubscribers bool `json:"postmortem_notified_subscribers,omitempty"`
PostmortemNotifiedTwitter bool `json:"postmortem_notified_twitter,omitempty"`
PostmortemPublishedAt string `json:"postmortem_published_at,omitempty"`
ResovledAt string `json:"resolved_at,omitempty"`
ScheduledAutoTransition bool `json:"scheduled_auto_transition,omitempty"`
ScheduledFor interface{} `json:"scheduled_for,omitempty"`
ScheduledFor any `json:"scheduled_for,omitempty"`
ScheduledRemindPrior bool `json:"scheduled_remind_prior,omitempty"`
ScheduledRemindedAt interface{} `json:"scheduled_reminded_at,omitempty"`
ScheduledUntil interface{} `json:"scheduled_until,omitempty"`
ScheduledRemindedAt any `json:"scheduled_reminded_at,omitempty"`
ScheduledUntil any `json:"scheduled_until,omitempty"`
Shortlink string `json:"shortlink,omitempty"`
Status string `json:"status,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/userlike/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type UserlikeOfflineMessageOutMessage struct {
ClientEmail string `json:"client_email,omitempty"`
ClientName string `json:"client_name,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Custom interface{} `json:"custom,omitempty"`
DataPrivacy interface{} `json:"data_privacy,omitempty"`
Custom any `json:"custom,omitempty"`
DataPrivacy any `json:"data_privacy,omitempty"`
ID int64 `json:"id,omitempty"`
LocCity string `json:"loc_city,omitempty"`
LocCountry string `json:"loc_country,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ type ResponseInfo struct {
Responses []ErrorInfo `json:"responses,omitempty"`
StatusCode int `json:"statusCode,omitempty"`
//URL string `json:"url,omitempty"`
//Body interface{} `json:"body,omitempty"`
//Body any `json:"body,omitempty"`
//InputType string `json:"inputType,omitempty"`
//OutputType string `json:"outputType,omitempty"`
}
Expand Down

0 comments on commit 61a6bb8

Please sign in to comment.