Skip to content

Commit 89e0a27

Browse files
committed
Remove unnecessary return value from Client.Get
1 parent 6c5bf73 commit 89e0a27

File tree

77 files changed

+96
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+96
-96
lines changed

sumologic/data_source_sumologic_folder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func dataSourceSumologicFolderRead(d *schema.ResourceData, meta interface{}) err
4444
}
4545

4646
func (s *Client) GetFolderByPath(path string) (*Folder, error) {
47-
data, _, err := s.Get(fmt.Sprintf("v2/content/path?path=%s", url.QueryEscape(path)))
47+
data, err := s.Get(fmt.Sprintf("v2/content/path?path=%s", url.QueryEscape(path)))
4848
if err != nil {
4949
return nil, err
5050
}

sumologic/data_source_sumologic_role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func dataSourceSumologicRoleRead(d *schema.ResourceData, meta interface{}) error
8686
}
8787

8888
func (s *Client) GetRoleName(name string) (*Role, error) {
89-
data, _, err := s.Get(fmt.Sprintf("v1/roles?name=%s", url.QueryEscape(name)))
89+
data, err := s.Get(fmt.Sprintf("v1/roles?name=%s", url.QueryEscape(name)))
9090
if err != nil {
9191
return nil, err
9292
}

sumologic/data_source_sumologic_role_v2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func dataSourceSumologicRoleV2Read(d *schema.ResourceData, meta interface{}) err
121121
}
122122

123123
func (s *Client) GetRoleNameV2(name string) (*RoleV2, error) {
124-
data, _, err := s.Get(fmt.Sprintf("v2/roles?name=%s", url.QueryEscape(name)))
124+
data, err := s.Get(fmt.Sprintf("v2/roles?name=%s", url.QueryEscape(name)))
125125
if err != nil {
126126
return nil, err
127127
}

sumologic/data_source_sumologic_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func dataSourceSumologicUserRead(d *schema.ResourceData, meta interface{}) error
9191
}
9292

9393
func (s *Client) GetUserByEmail(email string) (*User, error) {
94-
data, _, err := s.Get(fmt.Sprintf("v1/users?email=%s", url.QueryEscape(email)))
94+
data, err := s.Get(fmt.Sprintf("v1/users?email=%s", url.QueryEscape(email)))
9595
if err != nil {
9696
return nil, err
9797
}

sumologic/sumologic_app.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func (s *Client) GetAppInstance(id string) (*AppInstance, error) {
1111
url := fmt.Sprintf("v2/apps/instances/%s", id)
12-
data, _, err := s.Get(url)
12+
data, err := s.Get(url)
1313
if err != nil {
1414
return nil, err
1515
}
@@ -47,7 +47,7 @@ func (s *Client) CreateAppInstance(uuid string, appInstallPayload AppInstallPayl
4747
}
4848

4949
var appInstallResponse AppInstallResponse
50-
b, _, _ := s.Get(url)
50+
b, _ := s.Get(url)
5151
err = json.Unmarshal(b, &appInstallResponse)
5252
if err != nil {
5353
return "", err
@@ -96,7 +96,7 @@ func (s *Client) UpdateAppInstance(uuid string, appInstallPayload AppInstallPayl
9696
}
9797

9898
var appInstallResponse AppInstallResponse
99-
b, _, _ := s.Get(url)
99+
b, _ := s.Get(url)
100100
err = json.Unmarshal(b, &appInstallResponse)
101101
if err != nil {
102102
return "", err

sumologic/sumologic_client.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,38 +169,38 @@ func (s *Client) Put(urlPath string, payload interface{}) ([]byte, error) {
169169
return s.handleSumoResponse(resp)
170170
}
171171

172-
func (s *Client) Get(urlPath string) ([]byte, string, error) {
172+
func (s *Client) Get(urlPath string) ([]byte, error) {
173173
return s.GetWithErrOpt(urlPath, false)
174174
}
175175

176-
func (s *Client) GetWithErrOpt(urlPath string, return404Err bool) ([]byte, string, error) {
176+
func (s *Client) GetWithErrOpt(urlPath string, return404Err bool) ([]byte, error) {
177177
req, err := s.createSumoRequest(http.MethodGet, urlPath, nil)
178178
if err != nil {
179-
return nil, "", err
179+
return nil, err
180180
}
181181

182182
resp, err := s.doSumoRequest(req)
183183
if err != nil {
184-
return nil, "", err
184+
return nil, err
185185
}
186186

187187
d, err := io.ReadAll(resp.Body)
188188
defer resp.Body.Close()
189189
if err != nil {
190-
return nil, "", err
190+
return nil, err
191191
}
192192

193193
if resp.StatusCode == 404 {
194194
if return404Err {
195-
return nil, "", errors.New(string(d))
195+
return nil, errors.New(string(d))
196196
} else {
197-
return nil, "", nil
197+
return nil, nil
198198
}
199199
} else if resp.StatusCode >= 400 {
200-
return nil, "", errors.New(string(d))
200+
return nil, errors.New(string(d))
201201
}
202202

203-
return d, resp.Header.Get("ETag"), nil
203+
return d, nil
204204
}
205205

206206
func (s *Client) GetETag(urlPath string) (string, error) {

sumologic/sumologic_cloud_to_cloud_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (s *Client) CreateCloudToCloudSource(source CloudToCloudSource, collectorID
4646

4747
func (s *Client) GetCloudToCloudSource(collectorID, sourceID int) (*CloudToCloudSource, error) {
4848
urlPath := fmt.Sprintf("v1/collectors/%d/sources/%d", collectorID, sourceID)
49-
body, _, err := s.Get(urlPath)
49+
body, err := s.Get(urlPath)
5050

5151
if err != nil {
5252
return nil, err

sumologic/sumologic_cloudsyslog_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (s *Client) CreateCloudsyslogSource(cloudSyslogSource CloudSyslogSource, co
3939

4040
func (s *Client) GetCloudSyslogSource(collectorID, sourceID int) (*CloudSyslogSource, error) {
4141

42-
body, _, err := s.Get(fmt.Sprintf("v1/collectors/%d/sources/%d", collectorID, sourceID))
42+
body, err := s.Get(fmt.Sprintf("v1/collectors/%d/sources/%d", collectorID, sourceID))
4343
if err != nil {
4444
return nil, err
4545
}

sumologic/sumologic_cmffgp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func (s *Client) GetCmfFgp(targetType string, targetId string) (*CmfFgpResponse,
1010

1111
// e.g. "v1/monitors/0000000000000003/permissions"
1212
url := fmt.Sprintf("v1/%s/%s/permissions", targetType, targetId)
13-
data, _, err := s.GetWithErrOpt(url, true)
13+
data, err := s.GetWithErrOpt(url, true)
1414
if err != nil {
1515
return nil, err
1616
}

sumologic/sumologic_collectors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
)
77

88
func (s *Client) GetCollector(id int) (*Collector, error) {
9-
data, _, err := s.Get(fmt.Sprintf("v1/collectors/%d", id))
9+
data, err := s.Get(fmt.Sprintf("v1/collectors/%d", id))
1010
if err != nil {
1111
return nil, err
1212
}
@@ -25,7 +25,7 @@ func (s *Client) GetCollector(id int) (*Collector, error) {
2525
}
2626

2727
func (s *Client) GetCollectorName(name string) (*Collector, error) {
28-
data, _, err := s.Get(fmt.Sprintf("v1/collectors/name/%s", name))
28+
data, err := s.Get(fmt.Sprintf("v1/collectors/name/%s", name))
2929
if err != nil {
3030
return nil, err
3131
}

0 commit comments

Comments
 (0)