Skip to content

Commit 7f505a2

Browse files
committed
refactor code
Signed-off-by: milinddethe15 <[email protected]>
1 parent baca2f7 commit 7f505a2

File tree

7 files changed

+9
-16
lines changed

7 files changed

+9
-16
lines changed

providers/azure/helpers.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import (
2020
const DirDelim = "/"
2121

2222
func getContainerClient(conf Config) (*container.Client, error) {
23-
// Check if a roundtripper has been set in the config
24-
// otherwise build the default transport.
2523
var rt http.RoundTripper
2624
rt, err := exthttp.DefaultTransport(conf.HTTPConfig)
2725
if err != nil {

providers/bos/bos.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func parseConfig(conf []byte) (Config, error) {
6666

6767
// NewBucket new bos bucket.
6868
func NewBucket(logger log.Logger, conf []byte, component string) (*Bucket, error) {
69-
//TODO: Add support for custom roundtripper.
69+
// TODO(https://github.com/thanos-io/objstore/pull/140): Add support for custom roundtripper.
7070
if logger == nil {
7171
logger = log.NewNopLogger()
7272
}

providers/gcs/gcs_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ http_config:
161161
}
162162

163163
func TestNewBucketWithErrorRoundTripper(t *testing.T) {
164-
// Create an error RoundTripper.
165164
rt := &errutil.ErrorRoundTripper{Err: errors.New("RoundTripper error")}
166165
cfg := Config{
167166
Bucket: "test-bucket",

providers/obs/obs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type Bucket struct {
7575
}
7676

7777
func NewBucket(logger log.Logger, conf []byte) (*Bucket, error) {
78-
//TODO: Add support for custom roundtripper.
78+
// TODO(https://github.com/thanos-io/objstore/pull/140): Add support for custom roundtripper.
7979
config, err := parseConfig(conf)
8080
if err != nil {
8181
return nil, errors.Wrap(err, "parsing cos configuration")

providers/oci/oci_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import (
1111
)
1212

1313
func TestNewBucketWithErrorRoundTripper(t *testing.T) {
14-
15-
mockPrivateKey := `-----BEGIN RSA PRIVATE KEY-----
14+
const mockPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
1615
MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF
1716
NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F
1817
UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB

providers/oss/oss.go

-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ func NewBucketWithConfig(logger log.Logger, config Config, component string, rt
173173
}
174174
client, err := alioss.New(config.Endpoint, config.AccessKeyID, config.AccessKeySecret)
175175
if rt != nil {
176-
// custom RoundTripper
177176
clientOption := func(client *alioss.Client) {
178177
client.HTTPClient = &http.Client{Transport: rt}
179178
}

providers/oss/oss_test.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ import (
1111
)
1212

1313
func TestNewBucketWithErrorRoundTripper(t *testing.T) {
14-
15-
var config Config
16-
config.Endpoint = "http://test.com/"
17-
config.AccessKeyID = "123"
18-
config.AccessKeySecret = "123"
19-
config.Bucket = "test"
20-
config.AccessKeySecret = "123"
21-
14+
config := Config{
15+
Endpoint: "http://test.com/",
16+
AccessKeyID: "123",
17+
AccessKeySecret: "123",
18+
Bucket: "test",
19+
}
2220
rt := &errutil.ErrorRoundTripper{Err: errors.New("RoundTripper error")}
2321

2422
bkt, err := NewBucketWithConfig(log.NewNopLogger(), config, "test", rt)

0 commit comments

Comments
 (0)