minio-go: Vendorize with new changes.

This commit is contained in:
Harshavardhana
2016-02-05 23:10:09 -08:00
parent 4569e519c5
commit 1dea194699
5 changed files with 25 additions and 18 deletions
+15 -14
View File
@@ -51,15 +51,6 @@ func newFactory() func(config *client.Config) (client.Client, *probe.Error) {
return func(config *client.Config) (client.Client, *probe.Error) {
// Creates a parsed URL.
targetURL := client.NewURL(config.HostURL)
transport := http.DefaultTransport
if config.Debug == true {
if config.Signature == "S3v4" {
transport = httptracer.GetNewTraceTransport(NewTraceV4(), http.DefaultTransport)
}
if config.Signature == "S3v2" {
transport = httptracer.GetNewTraceTransport(NewTraceV2(), http.DefaultTransport)
}
}
// By default enable HTTPs.
inSecure := false
if targetURL.Scheme == "http" {
@@ -116,8 +107,18 @@ func newFactory() func(config *client.Config) (client.Client, *probe.Error) {
}
// Set app info.
api.SetAppInfo(config.AppName, config.AppVersion)
// Set custom transport.
api.SetCustomTransport(transport)
if config.Debug {
transport := http.DefaultTransport
if config.Signature == "S3v4" {
transport = httptracer.GetNewTraceTransport(NewTraceV4(), http.DefaultTransport)
}
if config.Signature == "S3v2" {
transport = httptracer.GetNewTraceTransport(NewTraceV2(), http.DefaultTransport)
}
// Set custom transport.
api.SetCustomTransport(transport)
}
// Store the new api object.
s3Clnt.api = api
@@ -283,10 +284,10 @@ func (c *s3Client) Stat() (*client.Content, *probe.Error) {
switch {
// valid case for 'ls -r s3/'
case bucket == "" && object == "":
_, err := c.api.ListBuckets()
if err != nil {
_, e := c.api.ListBuckets()
if e != nil {
c.mutex.Unlock()
return nil, probe.NewError(err)
return nil, probe.NewError(e)
}
c.mutex.Unlock()
return &client.Content{URL: *c.targetURL, Type: os.ModeDir}, nil
+1 -1
View File
@@ -14,7 +14,7 @@
- Have test cases for the new code. If you have questions about how to do it, please ask in your pull request.
- Run `go fmt`
- Squash your commits into a single commit. `git rebase -i`. It's okay to force update your pull request.
- Make sure `go test -race ./...` and `go build` completes.
- Make sure `go test -short -race ./...` and `go build` completes.
* Read [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project
- `minio-go` project is strictly conformant with Golang style
+1 -1
View File
@@ -55,7 +55,7 @@ func shouldUploadPart(objPart objectPart, objectParts map[int]objectPart) bool {
return true
}
// if md5sum mismatches should upload the part.
if objPart.ETag == uploadedPart.ETag {
if objPart.ETag != uploadedPart.ETag {
return true
}
return false
+6
View File
@@ -325,6 +325,12 @@ func (c Client) do(req *http.Request) (*http.Response, error) {
// execute the request.
resp, err := c.httpClient.Do(req)
if err != nil {
// Handle this specifically for now until future Golang
// versions fix this issue properly.
urlErr, ok := err.(*url.Error)
if ok && strings.Contains(urlErr.Err.Error(), "EOF") {
return nil, fmt.Errorf("Connection closed by foreign host %s. Retry again.", urlErr.URL)
}
return resp, err
}
// If trace is enabled, dump http request and response.
+2 -2
View File
@@ -29,8 +29,8 @@
},
{
"path": "github.com/minio/minio-go",
"revision": "c5884ce9ce3ac73b025d0bc58c4d3d72870edc0b",
"revisionTime": "2016-02-02T13:13:10+05:30"
"revision": "e5a223f907d6bf6e6220c716db08fc12285fbb26",
"revisionTime": "2016-02-06T12:33:47+05:30"
},
{
"path": "github.com/minio/minio-xl/pkg/atomic",