Skip to content

Commit

Permalink
#patch: rearrange struct fields for less memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
circa10a committed Nov 24, 2021
1 parent 3587fad commit 9c136af
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
linters-settings:
govet:
enable:
- fieldalignment
2 changes: 1 addition & 1 deletion providers/discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ type config struct {

// Provider is an implementation of the `go-aws-news/providers` Provider interface.
type Provider struct {
IsEnabled bool `yaml:"enabled"`
WebhookURL string `yaml:"webhookURL"`
AvatarURL string `yaml:"avatarURL"`
IsEnabled bool `yaml:"enabled"`
}

// Embed is a custom field for a Discord webhook payload.
Expand Down
2 changes: 1 addition & 1 deletion providers/rocketchat/rocketchat.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type config struct {

// Provider is an implementation of the `go-aws-news/providers` Provider interface.
type Provider struct {
IsEnabled bool `yaml:"enabled"`
WebhookURL string `yaml:"webhookURL"`
IconURL string `yaml:"iconURL"`
IsEnabled bool `yaml:"enabled"`
}

// Content is sent as json to the Rocket.Chat webhook endpoint.
Expand Down
2 changes: 1 addition & 1 deletion providers/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type config struct {

// Provider is an implementation of the `go-aws-news/providers` Provider interface.
type Provider struct {
IsEnabled bool `yaml:"enabled"`
WebhookURL string `yaml:"webhookURL"`
IconURL string `yaml:"iconURL"`
IsEnabled bool `yaml:"enabled"`
}

// Content is sent as json to the Rocket.Chat webhook endpoint.
Expand Down
8 changes: 4 additions & 4 deletions providers/smtp/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ type config struct {

// Provider is an implementation of the `go-aws-news/providers` Provider interface.
type Provider struct {
IsEnabled bool `yaml:"enabled"`
Footer string `yaml:"footer"`
Server string `yaml:"server"`
Port string `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Subject string `yaml:"subject"`
Footer string `yaml:"footer"`
From string `yaml:"from"`
To []string `yaml:"to"`
Template string `yaml:"customTemplate"`
To []string `yaml:"to"`
IsEnabled bool `yaml:"enabled"`
}

type email struct {
addr string
from string
to []string
date string
subject string
body string
footer string
template string
to []string
}

// init initializes the provider from the provided config.
Expand Down
8 changes: 4 additions & 4 deletions providers/yammer/yammer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ type config struct {

// Provider is an implementation of the `go-aws-news/providers` Provider interface.
type Provider struct {
IsEnabled bool `yaml:"enabled"`
APIURL string `yaml:"APIURL"`
GroupID int `yaml:"groupID"`
Token string `yaml:"token"`
MessageType string `yaml:"messageType"`
Title string `yaml:"title"`
GroupID int `yaml:"groupID"`
IsEnabled bool `yaml:"enabled"`
}

// Payload is the respresentation of the json body being sent to Yammer via POST
type Payload struct {
Body string `json:"body"`
GroupID int `json:"group_id"`
IsRichText bool `json:"is_rich_text"`
MessageType string `json:"message_type"`
Title string `json:"title"`
GroupID int `json:"group_id"`
IsRichText bool `json:"is_rich_text"`
}

// init initializes the provider from the provided config.
Expand Down

0 comments on commit 9c136af

Please sign in to comment.