Repository: peak/s5cmd
Pull request #556 (2023-03-27 17:09:48)

Bump go module version to v2
Go modules with version >= 2.0.0 must have module names ending with `/v2` (or, for version `N`, `/vN`).

Without this, running `go get github.com/peak/s5cmd@v2.0.0` results in the following error:

```
go: github.com/peak/s5cmd@v2.0.0: invalid version: module contains a go.mod file, so module path must match major version ("github.com/peak/s5cmd/v2")
```

This requirement is explained in greater detail in the [official golang wiki](https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher).

itay: Any chance this is going to be approved/merged?
igungor: @justinmanley could you rebase your branch please? 
justinmanley: @igungor rebased!
justinmanley: hi @ilkinulas! could you take a quick look at this when you get a chance?

Patch:
diff --git a/command/app.go b/command/app.go
index ceafb73..2f0e6b1 100644
--- a/command/app.go
+++ b/command/app.go
@@ -8,10 +8,10 @@ import (
 
 	"github.com/urfave/cli/v2"
 
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/parallel"
-	"github.com/peak/s5cmd/storage"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/parallel"
+	"github.com/peak/s5cmd/v2/storage"
 )
 
 const (
diff --git a/command/auto_complete.go b/command/auto_complete.go
index 7c37df7..fe01f94 100644
--- a/command/auto_complete.go
+++ b/command/auto_complete.go
@@ -7,8 +7,8 @@ import (
 	"path/filepath"
 	"strings"
 
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 	"github.com/urfave/cli/v2"
 )
 
diff --git a/command/bucket_version.go b/command/bucket_version.go
index fb0875b..5bd9127 100644
--- a/command/bucket_version.go
+++ b/command/bucket_version.go
@@ -7,10 +7,10 @@ import (
 
 	"github.com/urfave/cli/v2"
 
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 var bucketVersionHelpTemplate = `Name:
diff --git a/command/cat.go b/command/cat.go
index 6ed2af5..931f3f2 100644
--- a/command/cat.go
+++ b/command/cat.go
@@ -8,9 +8,9 @@ import (
 
 	"github.com/urfave/cli/v2"
 
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 var catHelpTemplate = `Name:
diff --git a/command/context.go b/command/context.go
index b6d9190..3e3f5d0 100644
--- a/command/context.go
+++ b/command/context.go
@@ -7,7 +7,7 @@ import (
 	"strconv"
 	"strings"
 
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/storage/url"
 	"github.com/urfave/cli/v2"
 )
 
diff --git a/command/cp.go b/command/cp.go
index cb94076..3ae2f4a 100644
--- a/command/cp.go
+++ b/command/cp.go
@@ -14,12 +14,12 @@ import (
 	"github.com/hashicorp/go-multierror"
 	"github.com/urfave/cli/v2"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/parallel"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/parallel"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 const (
diff --git a/command/du.go b/command/du.go
index a380f42..3a46aab 100644
--- a/command/du.go
+++ b/command/du.go
@@ -9,12 +9,12 @@ import (
 	"github.com/hashicorp/go-multierror"
 	"github.com/urfave/cli/v2"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
-	"github.com/peak/s5cmd/strutil"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 var sizeHelpTemplate = `Name:
diff --git a/command/error.go b/command/error.go
index 659246a..66b91a3 100644
--- a/command/error.go
+++ b/command/error.go
@@ -6,9 +6,9 @@ import (
 
 	"github.com/hashicorp/go-multierror"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/storage/url"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 func printDebug(op string, err error, urls ...*url.URL) {
diff --git a/command/exclude.go b/command/exclude.go
index 8bdea1a..36d9a9a 100644
--- a/command/exclude.go
+++ b/command/exclude.go
@@ -5,7 +5,7 @@ import (
 	"regexp"
 	"strings"
 
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 // createExcludesFromWildcard creates regex strings from wildcard.
diff --git a/command/expand.go b/command/expand.go
index 9f41983..f428937 100644
--- a/command/expand.go
+++ b/command/expand.go
@@ -5,9 +5,9 @@ import (
 	"errors"
 	"sync"
 
-	"github.com/peak/s5cmd/atomic"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/atomic"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 // expandSource returns the full list of objects from the given src argument.
diff --git a/command/ls.go b/command/ls.go
index 86e6efb..ae14519 100644
--- a/command/ls.go
+++ b/command/ls.go
@@ -7,12 +7,12 @@ import (
 	"github.com/hashicorp/go-multierror"
 	"github.com/urfave/cli/v2"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
-	"github.com/peak/s5cmd/strutil"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 var listHelpTemplate = `Name:
diff --git a/command/mb.go b/command/mb.go
index 6b5eabe..d642ac7 100644
--- a/command/mb.go
+++ b/command/mb.go
@@ -9,10 +9,10 @@ import (
 
 	"github.com/urfave/cli/v2"
 
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 var makeBucketHelpTemplate = `Name:
diff --git a/command/mv.go b/command/mv.go
index ade2f41..e6c6937 100644
--- a/command/mv.go
+++ b/command/mv.go
@@ -1,7 +1,7 @@
 package command
 
 import (
-	"github.com/peak/s5cmd/log/stat"
+	"github.com/peak/s5cmd/v2/log/stat"
 
 	"github.com/urfave/cli/v2"
 )
diff --git a/command/rb.go b/command/rb.go
index db4723c..d09c73e 100644
--- a/command/rb.go
+++ b/command/rb.go
@@ -5,10 +5,10 @@ import (
 
 	"github.com/urfave/cli/v2"
 
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 var removeBucketHelpTemplate = `Name:
diff --git a/command/rm.go b/command/rm.go
index 9f1e9bc..94698ab 100644
--- a/command/rm.go
+++ b/command/rm.go
@@ -7,11 +7,11 @@ import (
 	"github.com/hashicorp/go-multierror"
 	"github.com/urfave/cli/v2"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 var deleteHelpTemplate = `Name:
diff --git a/command/run.go b/command/run.go
index 0b17748..f6ac668 100644
--- a/command/run.go
+++ b/command/run.go
@@ -13,7 +13,7 @@ import (
 	"github.com/kballard/go-shellquote"
 	"github.com/urfave/cli/v2"
 
-	"github.com/peak/s5cmd/parallel"
+	"github.com/peak/s5cmd/v2/parallel"
 )
 
 var runHelpTemplate = `Name:
diff --git a/command/select.go b/command/select.go
index d391f48..9127bc8 100644
--- a/command/select.go
+++ b/command/select.go
@@ -10,11 +10,11 @@ import (
 	"github.com/hashicorp/go-multierror"
 	"github.com/urfave/cli/v2"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/parallel"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/parallel"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 var selectHelpTemplate = `Name:
diff --git a/command/sync.go b/command/sync.go
index 23413fd..bb7db04 100644
--- a/command/sync.go
+++ b/command/sync.go
@@ -13,11 +13,11 @@ import (
 	"github.com/lanrat/extsort"
 	"github.com/urfave/cli/v2"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/log/stat"
-	"github.com/peak/s5cmd/parallel"
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/log/stat"
+	"github.com/peak/s5cmd/v2/parallel"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 const (
diff --git a/command/sync_strategy.go b/command/sync_strategy.go
index cd6db2d..fe6e948 100644
--- a/command/sync_strategy.go
+++ b/command/sync_strategy.go
@@ -1,8 +1,8 @@
 package command
 
 import (
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/storage"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/storage"
 )
 
 // SyncStrategy is the interface to make decision whether given source object should be synced
diff --git a/command/validation.go b/command/validation.go
index 8dc2a9f..6530fe8 100644
--- a/command/validation.go
+++ b/command/validation.go
@@ -4,8 +4,8 @@ import (
 	"fmt"
 	urlpkg "net/url"
 
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 	"github.com/urfave/cli/v2"
 )
 
diff --git a/command/version.go b/command/version.go
index 0e988ee..c71462d 100644
--- a/command/version.go
+++ b/command/version.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/urfave/cli/v2"
 
-	"github.com/peak/s5cmd/version"
+	"github.com/peak/s5cmd/v2/version"
 )
 
 func NewVersionCommand() *cli.Command {
diff --git a/error/error.go b/error/error.go
index e962b6f..e6dddfd 100644
--- a/error/error.go
+++ b/error/error.go
@@ -7,8 +7,8 @@ import (
 
 	"github.com/hashicorp/go-multierror"
 
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 // Error is the type that implements error interface.
diff --git a/go.mod b/go.mod
index 3980c6b..30cbd57 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/peak/s5cmd
+module github.com/peak/s5cmd/v2
 
 go 1.17
 
diff --git a/log/message.go b/log/message.go
index b296218..8fcbbad 100644
--- a/log/message.go
+++ b/log/message.go
@@ -3,8 +3,8 @@ package log
 import (
 	"fmt"
 
-	"github.com/peak/s5cmd/storage/url"
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/storage/url"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 // Message is an interface to print structured logs.
diff --git a/log/stat/stat.go b/log/stat/stat.go
index 4685467..5e0ed49 100644
--- a/log/stat/stat.go
+++ b/log/stat/stat.go
@@ -7,7 +7,7 @@ import (
 	"sync"
 	"text/tabwriter"
 
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 const (
diff --git a/main.go b/main.go
index 678321a..3d835cb 100644
--- a/main.go
+++ b/main.go
@@ -6,7 +6,7 @@ import (
 	"os/signal"
 	"syscall"
 
-	"github.com/peak/s5cmd/command"
+	"github.com/peak/s5cmd/v2/command"
 )
 
 func main() {
diff --git a/parallel/global.go b/parallel/global.go
index 843d4b2..61d117e 100644
--- a/parallel/global.go
+++ b/parallel/global.go
@@ -1,6 +1,6 @@
 package parallel
 
-import "github.com/peak/s5cmd/parallel/fdlimit"
+import "github.com/peak/s5cmd/v2/parallel/fdlimit"
 
 var global *Manager
 
diff --git a/storage/fs.go b/storage/fs.go
index 3626414..50e3743 100644
--- a/storage/fs.go
+++ b/storage/fs.go
@@ -9,7 +9,7 @@ import (
 	"github.com/karrick/godirwalk"
 	"github.com/termie/go-shutil"
 
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 // Filesystem is the Storage implementation of a local filesystem.
diff --git a/storage/mock_storage.go b/storage/mock_storage.go
index 9887955..487b3eb 100644
--- a/storage/mock_storage.go
+++ b/storage/mock_storage.go
@@ -7,7 +7,7 @@ import (
 
 	mock "github.com/stretchr/testify/mock"
 
-	url "github.com/peak/s5cmd/storage/url"
+	url "github.com/peak/s5cmd/v2/storage/url"
 )
 
 // MockStorage is an autogenerated mock type for the Storage type
diff --git a/storage/s3.go b/storage/s3.go
index a3e73ab..58bd96a 100644
--- a/storage/s3.go
+++ b/storage/s3.go
@@ -30,8 +30,8 @@ import (
 	"github.com/aws/aws-sdk-go/service/s3/s3manager"
 	"github.com/aws/aws-sdk-go/service/s3/s3manager/s3manageriface"
 
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 var sentinelURL = urlpkg.URL{}
diff --git a/storage/storage.go b/storage/storage.go
index 7725d93..953bb80 100644
--- a/storage/storage.go
+++ b/storage/storage.go
@@ -11,9 +11,9 @@ import (
 	"time"
 
 	"github.com/lanrat/extsort"
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/storage/url"
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/storage/url"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 var (
diff --git a/storage/url/url.go b/storage/url/url.go
index f03298e..5141e1e 100644
--- a/storage/url/url.go
+++ b/storage/url/url.go
@@ -14,7 +14,7 @@ import (
 	"strings"
 
 	"github.com/lanrat/extsort"
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 const (


Test patch:
diff --git a/command/context_test.go b/command/context_test.go
index cad4b66..3e75363 100644
--- a/command/context_test.go
+++ b/command/context_test.go
@@ -6,7 +6,7 @@ import (
 	"testing"
 
 	"github.com/google/go-cmp/cmp"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/storage/url"
 	"github.com/urfave/cli/v2"
 )
 
diff --git a/command/expand_test.go b/command/expand_test.go
index 0681c86..f7a7dd2 100644
--- a/command/expand_test.go
+++ b/command/expand_test.go
@@ -12,8 +12,8 @@ import (
 
 	"github.com/stretchr/testify/mock"
 
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 func TestExpandSources(t *testing.T) {
diff --git a/command/sync_strategy_test.go b/command/sync_strategy_test.go
index ecfafa6..ba15929 100644
--- a/command/sync_strategy_test.go
+++ b/command/sync_strategy_test.go
@@ -4,8 +4,8 @@ import (
 	"testing"
 	"time"
 
-	errorpkg "github.com/peak/s5cmd/error"
-	"github.com/peak/s5cmd/storage"
+	errorpkg "github.com/peak/s5cmd/v2/error"
+	"github.com/peak/s5cmd/v2/storage"
 )
 
 func TestSizeAndModificationStrategy_ShouldSync(t *testing.T) {
diff --git a/e2e/app_test.go b/e2e/app_test.go
index 3446fb0..6ebfd68 100644
--- a/e2e/app_test.go
+++ b/e2e/app_test.go
@@ -8,7 +8,7 @@ import (
 	"strings"
 	"testing"
 
-	"github.com/peak/s5cmd/command"
+	"github.com/peak/s5cmd/v2/command"
 
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/icmd"
diff --git a/e2e/util_test.go b/e2e/util_test.go
index 3bf64ef..83a361e 100644
--- a/e2e/util_test.go
+++ b/e2e/util_test.go
@@ -23,8 +23,8 @@ import (
 	"testing"
 	"time"
 
-	"github.com/peak/s5cmd/storage"
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/storage"
+	"github.com/peak/s5cmd/v2/strutil"
 
 	"github.com/aws/aws-sdk-go/aws"
 	"github.com/aws/aws-sdk-go/aws/awserr"
diff --git a/storage/s3_test.go b/storage/s3_test.go
index 7c4f00a..d101946 100644
--- a/storage/s3_test.go
+++ b/storage/s3_test.go
@@ -29,8 +29,8 @@ import (
 	"github.com/google/go-cmp/cmp"
 	"gotest.tools/v3/assert"
 
-	"github.com/peak/s5cmd/log"
-	"github.com/peak/s5cmd/storage/url"
+	"github.com/peak/s5cmd/v2/log"
+	"github.com/peak/s5cmd/v2/storage/url"
 )
 
 func TestS3ImplementsStorageInterface(t *testing.T) {
diff --git a/storage/url/url_test.go b/storage/url/url_test.go
index 87237cb..be37467 100644
--- a/storage/url/url_test.go
+++ b/storage/url/url_test.go
@@ -8,7 +8,7 @@ import (
 
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-cmp/cmp/cmpopts"
-	"github.com/peak/s5cmd/strutil"
+	"github.com/peak/s5cmd/v2/strutil"
 )
 
 func TestHasWild(t *testing.T) {