Skip to content

Commit

Permalink
Fix go module imports properly to honor semantic versioning (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored May 24, 2019
1 parent 28172b9 commit da91b3b
Show file tree
Hide file tree
Showing 94 changed files with 224 additions and 223 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
- ARCH=i686

go:
- 1.11.x
- 1.12.x
- tip

matrix:
Expand Down
29 changes: 17 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
all: checks

checks:
@go get -t ./...
@go vet ./...
@SERVER_ENDPOINT=play.min.io:9000 ACCESS_KEY=Q3AM3UQ867SPQQA43P2F SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG ENABLE_HTTPS=1 MINT_MODE=full go test -race -v ./...
@go get github.com/dustin/go-humanize/...
@go get github.com/sirupsen/logrus/...
@SERVER_ENDPOINT=play.min.io:9000 ACCESS_KEY=Q3AM3UQ867SPQQA43P2F SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG ENABLE_HTTPS=1 MINT_MODE=full go run functional_tests.go
.PHONY: examples docs

checks: vet test examples docs functional-test

vet:
@GO111MODULE=on go vet ./...

test:
@GO111MODULE=on SERVER_ENDPOINT=play.min.io:9000 ACCESS_KEY=Q3AM3UQ867SPQQA43P2F SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG ENABLE_HTTPS=1 MINT_MODE=full go test -race -v ./...

examples:
@mkdir -p /tmp/examples && for i in $(echo examples/s3/*); do go build -o /tmp/examples/$(basename ${i:0:-3}) ${i}; done
@go get -u github.com/a8m/mark/...
@go get -u github.com/minio/cli/...
@go get -u golang.org/x/tools/cmd/goimports
@go get -u github.com/gernest/wow/...
@go build docs/validator.go && ./validator -m docs/API.md -t docs/checker.go.tpl

docs:
@(cd docs; GO111MODULE=on go build validator.go && ./validator -m ../docs/API.md -t checker.go.tpl)

functional-test:
@GO111MODULE=on SERVER_ENDPOINT=play.min.io:9000 ACCESS_KEY=Q3AM3UQ867SPQQA43P2F SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG ENABLE_HTTPS=1 MINT_MODE=full go run functional_tests.go
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MinIO client requires the following four parameters specified to connect to an A
package main

import (
"github.com/minio/minio-go"
"github.com/minio/minio-go/v6"
"log"
)

Expand Down Expand Up @@ -56,7 +56,7 @@ We will use the MinIO server running at [https://play.min.io:9000](https://play.
package main

import (
"github.com/minio/minio-go"
"github.com/minio/minio-go/v6"
"log"
)

Expand Down
4 changes: 2 additions & 2 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MinIO client需要以下4个参数来连接与Amazon S3兼容的对象存储。
package main

import (
"github.com/minio/minio-go"
"github.com/minio/minio-go/v6"
"log"
)

Expand Down Expand Up @@ -68,7 +68,7 @@ func main() {
package main

import (
"github.com/minio/minio-go"
"github.com/minio/minio-go/v6"
"log"
)

Expand Down
4 changes: 2 additions & 2 deletions api-compose-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"strings"
"time"

"github.com/minio/minio-go/pkg/encrypt"
"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// DestinationInfo - type with information about the object to be
Expand Down
2 changes: 1 addition & 1 deletion api-error-response.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type ErrorResponse struct {
//
// For example:
//
// import s3 "github.com/minio/minio-go"
// import s3 "github.com/minio/minio-go/v6"
// ...
// ...
// reader, stat, err := s3.GetObject(...)
Expand Down
2 changes: 1 addition & 1 deletion api-get-lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"net/http"
"net/url"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// GetBucketLifecycle - get bucket lifecycle.
Expand Down
2 changes: 1 addition & 1 deletion api-get-object-file.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"path/filepath"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// FGetObjectWithContext - download contents of an object to a local file.
Expand Down
2 changes: 1 addition & 1 deletion api-get-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"sync"
"time"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// GetObject - returns an seekable, readable object.
Expand Down
2 changes: 1 addition & 1 deletion api-get-options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"net/http"
"time"

"github.com/minio/minio-go/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/encrypt"
)

// GetObjectOptions are used to specify additional headers or options
Expand Down
2 changes: 1 addition & 1 deletion api-get-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"net/http"
"net/url"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// GetBucketPolicy - get bucket policy at a given path.
Expand Down
2 changes: 1 addition & 1 deletion api-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"net/url"
"strings"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// ListBuckets list all buckets owned by this authenticated user.
Expand Down
19 changes: 6 additions & 13 deletions api-notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import (
"bufio"
"context"
"encoding/json"
"io"
"net/http"
"net/url"
"time"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// GetBucketNotification - get bucket notification at a given path.
Expand Down Expand Up @@ -196,30 +195,24 @@ func (c Client) ListenBucketNotification(bucketName, prefix, suffix string, even
// Initialize a new bufio scanner, to read line by line.
bio := bufio.NewScanner(resp.Body)

// Close the response body.
defer resp.Body.Close()

// Unmarshal each line, returns marshalled values.
for bio.Scan() {
var notificationInfo NotificationInfo
if err = json.Unmarshal(bio.Bytes(), &notificationInfo); err != nil {
closeResponse(resp)
continue
}
// Send notificationInfo
select {
case notificationInfoCh <- notificationInfo:
case <-doneCh:
closeResponse(resp)
return
}
}
// Look for any underlying errors.
if err = bio.Err(); err != nil {
// For an unexpected connection drop from server, we close the body
// and re-connect.
if err == io.ErrUnexpectedEOF {
resp.Body.Close()
}
}

// Close current connection before looping further.
closeResponse(resp)
}
}(notificationInfoCh)

Expand Down
4 changes: 2 additions & 2 deletions api-presigned.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"net/url"
"time"

"github.com/minio/minio-go/pkg/s3signer"
"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3signer"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// presignURL - Returns a presigned URL for an input 'method'.
Expand Down
2 changes: 1 addition & 1 deletion api-put-bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"net/url"
"strings"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

/// Bucket operations
Expand Down
4 changes: 2 additions & 2 deletions api-put-object-common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"math"
"os"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// Verify if reader is *minio.Object
Expand Down Expand Up @@ -105,7 +105,7 @@ func optimalPartInfo(objectSize int64, configuredPartSize uint64) (totalPartsCou
configuredPartSize = minPartSize
// Use floats for part size for all calculations to avoid
// overflows during float64 to int64 conversions.
partSizeFlt = math.Ceil(float64(objectSize / maxPartsCount))
partSizeFlt = float64(objectSize / maxPartsCount)
partSizeFlt = math.Ceil(partSizeFlt/float64(configuredPartSize)) * float64(configuredPartSize)
}

Expand Down
2 changes: 1 addition & 1 deletion api-put-object-copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"io/ioutil"
"net/http"

"github.com/minio/minio-go/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/encrypt"
)

// CopyObject - copy a source object into a new object
Expand Down
2 changes: 1 addition & 1 deletion api-put-object-file-context.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"path/filepath"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// FPutObjectWithContext - Create an object in a bucket, with contents from file at filePath. Allows request cancellation.
Expand Down
4 changes: 2 additions & 2 deletions api-put-object-multipart.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"strconv"
"strings"

"github.com/minio/minio-go/pkg/encrypt"
"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

func (c Client) putObjectMultipart(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64,
Expand Down
2 changes: 1 addition & 1 deletion api-put-object-streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"sort"
"strings"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// putObjectMultipartStream - upload a large object using
Expand Down
4 changes: 2 additions & 2 deletions api-put-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"runtime/debug"
"sort"

"github.com/minio/minio-go/pkg/encrypt"
"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/s3utils"
"golang.org/x/net/http/httpguts"
)

Expand Down
2 changes: 1 addition & 1 deletion api-remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"net/http"
"net/url"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// RemoveBucket deletes the bucket name.
Expand Down
4 changes: 2 additions & 2 deletions api-select.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"net/url"
"strings"

"github.com/minio/minio-go/pkg/encrypt"
"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// CSVFileHeaderInfo - is the parameter for whether to utilize headers.
Expand Down
2 changes: 1 addition & 1 deletion api-stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strings"
"time"

"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// BucketExists verify if bucket exists and you have permission to access it.
Expand Down
14 changes: 5 additions & 9 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import (

"golang.org/x/net/publicsuffix"

"github.com/minio/minio-go/pkg/credentials"
"github.com/minio/minio-go/pkg/s3signer"
"github.com/minio/minio-go/pkg/s3utils"
"github.com/minio/minio-go/v6/pkg/credentials"
"github.com/minio/minio-go/v6/pkg/s3signer"
"github.com/minio/minio-go/v6/pkg/s3utils"
)

// Client implements Amazon S3 compatible methods.
Expand Down Expand Up @@ -264,7 +264,7 @@ func (c *Client) redirectHeaders(req *http.Request, via []*http.Request) error {
case signerType.IsV2():
return errors.New("signature V2 cannot support redirection")
case signerType.IsV4():
req = s3signer.SignV4(*req, accessKeyID, secretAccessKey, sessionToken, getDefaultLocation(*c.endpointURL, region))
s3signer.SignV4(*req, accessKeyID, secretAccessKey, sessionToken, getDefaultLocation(*c.endpointURL, region))
}
}
return nil
Expand Down Expand Up @@ -331,10 +331,6 @@ func privateNew(endpoint string, creds *credentials.Credentials, secure bool, re
func (c *Client) SetAppInfo(appName string, appVersion string) {
// if app name and version not set, we do not set a new user agent.
if appName != "" && appVersion != "" {
c.appInfo = struct {
appName string
appVersion string
}{}
c.appInfo.appName = appName
c.appInfo.appVersion = appVersion
}
Expand Down Expand Up @@ -661,7 +657,7 @@ func (c Client) executeMethod(ctx context.Context, method string, metadata reque
if errResponse.Code == "AuthorizationHeaderMalformed" || errResponse.Code == "InvalidRegion" {
if metadata.bucketName != "" && errResponse.Region != "" {
// Gather Cached location only if bucketName is present.
if _, cachedLocationError := c.bucketLocCache.Get(metadata.bucketName); cachedLocationError != false {
if _, cachedOk := c.bucketLocCache.Get(metadata.bucketName); cachedOk {
c.bucketLocCache.Set(metadata.bucketName, errResponse.Region)
continue // Retry.
}
Expand Down
Loading

0 comments on commit da91b3b

Please sign in to comment.