Skip to content

Commit 8cbe5a8

Browse files
committed
Linting
1 parent c099b53 commit 8cbe5a8

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

notify/receivers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ func GetActiveReceiversMap(r *dispatch.Route) map[string]struct{} {
532532
return receiversMap
533533
}
534534

535-
func parseHttpConfig(integration *GrafanaIntegrationConfig, decryptFn func(key string, fallback string) string) (*http.HTTPClientConfig, error) {
535+
func parseHTTPConfig(integration *GrafanaIntegrationConfig, decryptFn func(key string, fallback string) string) (*http.HTTPClientConfig, error) {
536536
httpConfigSettings := struct {
537537
HTTPConfig *http.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"`
538538
}{}
@@ -552,7 +552,7 @@ func parseHttpConfig(integration *GrafanaIntegrationConfig, decryptFn func(key s
552552
}
553553

554554
func newNotifierConfig[T interface{}](integration *GrafanaIntegrationConfig, idx int, settings T, decryptFn func(key string, fallback string) string) (*NotifierConfig[T], error) {
555-
httpClientConfig, err := parseHttpConfig(integration, decryptFn)
555+
httpClientConfig, err := parseHTTPConfig(integration, decryptFn)
556556
if err != nil {
557557
return nil, err
558558
}

notify/receivers_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ func TestHTTPConfig(t *testing.T) {
491491

492492
invalidAddress := fmt.Errorf("invalid address")
493493
allowedUrls := map[string]struct{}{
494-
strings.TrimPrefix(oauth2Server.URL, "http://"): struct{}{},
495-
strings.TrimPrefix(testServer.URL, "http://"): struct{}{},
494+
oauth2Server.URL: {},
495+
testServer.URL: {},
496496
}
497497
integrations, err := BuildGrafanaReceiverIntegrations(
498498
parsed,
@@ -509,7 +509,7 @@ func TestHTTPConfig(t *testing.T) {
509509
// we don't start calling real endpoints in the tests.
510510
// Additionally, it will help ensure the test is correctly validating the OAuth2 flow.
511511
Control: func(_, address string, _ syscall.RawConn) error {
512-
if _, ok := allowedUrls[address]; !ok {
512+
if _, ok := allowedUrls["http://"+address]; !ok {
513513
return fmt.Errorf("%w: %s", invalidAddress, address)
514514
}
515515
return nil

notify/testing.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ var AllKnownConfigsForTesting = map[string]NotifierConfigTest{
128128
NotifierType: "prometheus-alertmanager",
129129
Config: alertmanager.FullValidConfigForTesting,
130130
Secrets: alertmanager.FullValidSecretsForTesting,
131-
commonHttpConfigUnsupported: true,
131+
commonHTTPConfigUnsupported: true,
132132
},
133133
"dingding": {NotifierType: "dingding",
134134
Config: dinding.FullValidConfigForTesting,
@@ -138,7 +138,7 @@ var AllKnownConfigsForTesting = map[string]NotifierConfigTest{
138138
},
139139
"email": {NotifierType: "email",
140140
Config: email.FullValidConfigForTesting,
141-
commonHttpConfigUnsupported: true,
141+
commonHTTPConfigUnsupported: true,
142142
},
143143
"googlechat": {NotifierType: "googlechat",
144144
Config: googlechat.FullValidConfigForTesting,
@@ -159,7 +159,7 @@ var AllKnownConfigsForTesting = map[string]NotifierConfigTest{
159159
"mqtt": {NotifierType: "mqtt",
160160
Config: mqtt.FullValidConfigForTesting,
161161
Secrets: mqtt.FullValidSecretsForTesting,
162-
commonHttpConfigUnsupported: true,
162+
commonHTTPConfigUnsupported: true,
163163
},
164164
"oncall": {NotifierType: "oncall",
165165
Config: oncall.FullValidConfigForTesting,
@@ -184,11 +184,11 @@ var AllKnownConfigsForTesting = map[string]NotifierConfigTest{
184184
"slack": {NotifierType: "slack",
185185
Config: slack.FullValidConfigForTesting,
186186
Secrets: slack.FullValidSecretsForTesting,
187-
commonHttpConfigUnsupported: true,
187+
commonHTTPConfigUnsupported: true,
188188
},
189189
"sns": {NotifierType: "sns",
190190
Config: sns.FullValidConfigForTesting,
191-
commonHttpConfigUnsupported: true,
191+
commonHTTPConfigUnsupported: true,
192192
},
193193
"teams": {NotifierType: "teams",
194194
Config: teams.FullValidConfigForTesting,
@@ -259,7 +259,7 @@ type NotifierConfigTest struct {
259259
NotifierType string
260260
Config string
261261
Secrets string
262-
commonHttpConfigUnsupported bool
262+
commonHTTPConfigUnsupported bool
263263
}
264264

265265
func (n NotifierConfigTest) GetRawNotifierConfig(name string) *GrafanaIntegrationConfig {
@@ -275,7 +275,7 @@ func (n NotifierConfigTest) GetRawNotifierConfig(name string) *GrafanaIntegratio
275275
}
276276

277277
config := []byte(n.Config)
278-
if !n.commonHttpConfigUnsupported {
278+
if !n.commonHTTPConfigUnsupported {
279279
var err error
280280
config, err = MergeSettings([]byte(n.Config), []byte(FullValidHTTPConfigForTesting))
281281
if err != nil {

0 commit comments

Comments
 (0)