Skip to content

Commit 1f7a5f0

Browse files
author
Sean Sain
committed
fix errors from the golangcli-lint
1 parent 2bba4ea commit 1f7a5f0

File tree

5 files changed

+8
-57
lines changed

5 files changed

+8
-57
lines changed

sumologic/resource_sumologic_content_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package sumologic
22

33
import (
4-
"encoding/json"
54
"fmt"
65
"log"
76
"os"
8-
"reflect"
97
"testing"
108

119
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
@@ -97,20 +95,6 @@ func testAccCheckContentAttributes(name string) resource.TestCheckFunc {
9795
}
9896
}
9997

100-
func testAccCheckContentConfig(content *Content) resource.TestCheckFunc {
101-
return func(s *terraform.State) error {
102-
var expectedContent Content
103-
//unmarshal the expected config for comparison. Ignore the error here, configuration is known
104-
_ = json.Unmarshal([]byte(configJson), &expectedContent)
105-
106-
//if the configuration structs are not equal
107-
if !reflect.DeepEqual(expectedContent, content) {
108-
return fmt.Errorf("Configuration is not equal, %v does not match expected %v", content, expectedContent)
109-
}
110-
return nil
111-
}
112-
}
113-
11498
func testAccCheckContentDestroy(s *terraform.State) error {
11599
client := testAccProvider.Meta().(*Client)
116100
for _, r := range s.RootModule().Resources {

sumologic/resource_sumologic_extraction_rule.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,6 @@ func resourceSumologicFieldExtractionRuleUpdate(d *schema.ResourceData, meta int
112112
return resourceSumologicFieldExtractionRuleRead(d, meta)
113113
}
114114

115-
func resourceSumologicFieldExtractionRuleExists(d *schema.ResourceData, meta interface{}) error {
116-
c := meta.(*Client)
117-
118-
_, err := c.GetFieldExtractionRule(d.Id())
119-
if err != nil {
120-
return err
121-
}
122-
123-
return nil
124-
}
125-
126115
func resourceToFieldExtractionRule(d *schema.ResourceData) FieldExtractionRule {
127116

128117
return FieldExtractionRule{

sumologic/resource_sumologic_role.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,6 @@ func resourceSumologicRoleUpdate(d *schema.ResourceData, meta interface{}) error
119119
return resourceSumologicRoleRead(d, meta)
120120
}
121121

122-
func resourceSumologicRoleExists(d *schema.ResourceData, meta interface{}) error {
123-
c := meta.(*Client)
124-
125-
_, err := c.GetRole(d.Id())
126-
if err != nil {
127-
return err
128-
}
129-
130-
return nil
131-
}
132-
133122
func resourceToRole(d *schema.ResourceData) Role {
134123
rawCapabilities := d.Get("capabilities").([]interface{})
135124
capabilities := make([]string, len(rawCapabilities))

sumologic/resource_sumologic_user.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,6 @@ func resourceSumologicUserUpdate(d *schema.ResourceData, meta interface{}) error
121121
return resourceSumologicUserRead(d, meta)
122122
}
123123

124-
func resourceSumologicUserExists(d *schema.ResourceData, meta interface{}) error {
125-
c := meta.(*Client)
126-
127-
_, err := c.GetUser(d.Id())
128-
if err != nil {
129-
return err
130-
}
131-
132-
return nil
133-
}
134-
135124
func resourceToUser(d *schema.ResourceData) User {
136125
rawRoleIds := d.Get("role_ids").([]interface{})
137126
roleIds := make([]string, len(rawRoleIds))

sumologic/sumologic_client.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var endpoints = map[string]string{
3434
"ca": "https://api.ca.sumologic.com/api/",
3535
}
3636

37-
var rateLimiter = time.Tick(time.Minute / 240)
37+
var rateLimiter = time.NewTicker(time.Minute / 240)
3838

3939
func createNewRequest(method, url string, body io.Reader, accessID string, accessKey string) (*http.Request, error) {
4040
req, err := http.NewRequest(method, url, body)
@@ -65,7 +65,7 @@ func (s *Client) PostWithCookies(urlPath string, payload interface{}) ([]byte, [
6565
return nil, nil, err
6666
}
6767

68-
<-rateLimiter
68+
<-rateLimiter.C
6969
resp, err := s.httpClient.Do(req)
7070
if err != nil {
7171
return nil, nil, err
@@ -103,7 +103,7 @@ func (s *Client) GetWithCookies(urlPath string, cookies []*http.Cookie) ([]byte,
103103
req.AddCookie(cookie)
104104
}
105105

106-
<-rateLimiter
106+
<-rateLimiter.C
107107
resp, err := s.httpClient.Do(req)
108108
if err != nil {
109109
return nil, "", err
@@ -134,7 +134,7 @@ func (s *Client) Post(urlPath string, payload interface{}) ([]byte, error) {
134134
return nil, err
135135
}
136136

137-
<-rateLimiter
137+
<-rateLimiter.C
138138
resp, err := s.httpClient.Do(req)
139139
if err != nil {
140140
return nil, err
@@ -161,7 +161,7 @@ func (s *Client) PostRawPayload(urlPath string, payload string) ([]byte, error)
161161
return nil, err
162162
}
163163

164-
<-rateLimiter
164+
<-rateLimiter.C
165165
resp, err := s.httpClient.Do(req)
166166

167167
if err != nil {
@@ -193,7 +193,7 @@ func (s *Client) Put(urlPath string, payload interface{}) ([]byte, error) {
193193
}
194194
req.Header.Add("If-Match", etag)
195195

196-
<-rateLimiter
196+
<-rateLimiter.C
197197
resp, err := s.httpClient.Do(req)
198198
if err != nil {
199199
return nil, err
@@ -221,7 +221,7 @@ func (s *Client) Get(urlPath string) ([]byte, string, error) {
221221
return nil, "", err
222222
}
223223

224-
<-rateLimiter
224+
<-rateLimiter.C
225225
resp, err := s.httpClient.Do(req)
226226
if err != nil {
227227
return nil, "", err
@@ -251,7 +251,7 @@ func (s *Client) Delete(urlPath string) ([]byte, error) {
251251
return nil, err
252252
}
253253

254-
<-rateLimiter
254+
<-rateLimiter.C
255255
resp, err := s.httpClient.Do(req)
256256
if err != nil {
257257
return nil, err

0 commit comments

Comments
 (0)