Add v2 to module name

See https://github.com/tus/tusd/pull/672#issuecomment-1082737523 for context
This commit is contained in:
Marius 2023-03-08 13:03:18 +01:00
parent 158b242fbe
commit a75c24996f
43 changed files with 71 additions and 70 deletions

View File

@ -6,12 +6,12 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/tus/tusd/pkg/azurestore" "github.com/tus/tusd/v2/pkg/azurestore"
"github.com/tus/tusd/pkg/filestore" "github.com/tus/tusd/v2/pkg/filestore"
"github.com/tus/tusd/pkg/gcsstore" "github.com/tus/tusd/v2/pkg/gcsstore"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
"github.com/tus/tusd/pkg/memorylocker" "github.com/tus/tusd/v2/pkg/memorylocker"
"github.com/tus/tusd/pkg/s3store" "github.com/tus/tusd/v2/pkg/s3store"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"

View File

@ -5,7 +5,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/tus/tusd/cmd/tusd/cli/hooks" "github.com/tus/tusd/v2/cmd/tusd/cli/hooks"
) )
var Flags struct { var Flags struct {

View File

@ -4,8 +4,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/tus/tusd/cmd/tusd/cli/hooks" "github.com/tus/tusd/v2/cmd/tusd/cli/hooks"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
var hookHandler hooks.HookHandler = nil var hookHandler hooks.HookHandler = nil

View File

@ -6,7 +6,7 @@ import (
"time" "time"
grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry" grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
pb "github.com/tus/tusd/pkg/proto/v2" pb "github.com/tus/tusd/v2/pkg/proto/v2"
"google.golang.org/grpc" "google.golang.org/grpc"
) )

View File

@ -3,7 +3,7 @@ package hooks
// TODO: Move hooks into a package in /pkg // TODO: Move hooks into a package in /pkg
import ( import (
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
// HookHandler is the main inferface to be implemented by all hook backends. // HookHandler is the main inferface to be implemented by all hook backends.

View File

@ -4,7 +4,7 @@ import (
"log" "log"
"os" "os"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
var stdout = log.New(os.Stdout, "[tusd] ", log.LstdFlags|log.Lmicroseconds) var stdout = log.New(os.Stdout, "[tusd] ", log.LstdFlags|log.Lmicroseconds)

View File

@ -3,8 +3,8 @@ package cli
import ( import (
"net/http" "net/http"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
"github.com/tus/tusd/pkg/prometheuscollector" "github.com/tus/tusd/v2/pkg/prometheuscollector"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
const ( const (

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/tus/tusd/cmd/tusd/cli" "github.com/tus/tusd/v2/cmd/tusd/cli"
) )
func main() { func main() {

View File

@ -9,8 +9,8 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"github.com/tus/tusd/pkg/filestore" "github.com/tus/tusd/v2/pkg/filestore"
tusd "github.com/tus/tusd/pkg/handler" tusd "github.com/tus/tusd/v2/pkg/handler"
) )
func main() { func main() {

View File

@ -6,7 +6,7 @@ import (
"github.com/hashicorp/go-hclog" "github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin" "github.com/hashicorp/go-plugin"
"github.com/tus/tusd/cmd/tusd/cli/hooks" "github.com/tus/tusd/v2/cmd/tusd/cli/hooks"
) )
// Here is the implementation of our hook handler // Here is the implementation of our hook handler

View File

@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"github.com/tus/tusd/pkg/filestore" "github.com/tus/tusd/v2/pkg/filestore"
tusd "github.com/tus/tusd/pkg/handler" tusd "github.com/tus/tusd/v2/pkg/handler"
) )
func main() { func main() {

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/tus/tusd module github.com/tus/tusd/v2
// Specify the Go version needed for the Heroku deployment // Specify the Go version needed for the Heroku deployment
// See https://github.com/heroku/heroku-buildpack-go#go-module-specifics // See https://github.com/heroku/heroku-buildpack-go#go-module-specifics

View File

@ -25,7 +25,7 @@ import (
"strings" "strings"
"github.com/Azure/azure-storage-blob-go/azblob" "github.com/Azure/azure-storage-blob-go/azblob"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
const ( const (

View File

@ -10,8 +10,8 @@ import (
"io" "io"
"strings" "strings"
"github.com/tus/tusd/internal/uid" "github.com/tus/tusd/v2/internal/uid"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
type AzureStore struct { type AzureStore struct {

View File

@ -10,7 +10,7 @@ import (
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
azurestore "github.com/tus/tusd/pkg/azurestore" azurestore "github.com/tus/tusd/v2/pkg/azurestore"
) )
// MockAzService is a mock of AzService interface. // MockAzService is a mock of AzService interface.

View File

@ -11,8 +11,8 @@ import (
"github.com/Azure/azure-storage-blob-go/azblob" "github.com/Azure/azure-storage-blob-go/azblob"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/tus/tusd/pkg/azurestore" "github.com/tus/tusd/v2/pkg/azurestore"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
//go:generate mockgen -destination=./azurestore_mock_test.go -package=azurestore_test github.com/tus/tusd/pkg/azurestore AzService,AzBlob //go:generate mockgen -destination=./azurestore_mock_test.go -package=azurestore_test github.com/tus/tusd/pkg/azurestore AzService,AzBlob

View File

@ -13,7 +13,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
"gopkg.in/Acconut/lockfile.v1" "gopkg.in/Acconut/lockfile.v1"
) )

View File

@ -6,7 +6,7 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
var _ handler.Locker = &FileLocker{} var _ handler.Locker = &FileLocker{}

View File

@ -17,8 +17,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/tus/tusd/internal/uid" "github.com/tus/tusd/v2/internal/uid"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
var defaultFilePerm = os.FileMode(0664) var defaultFilePerm = os.FileMode(0664)
@ -49,7 +49,7 @@ func (store FileStore) UseIn(composer *handler.StoreComposer) {
} }
func (store FileStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error) { func (store FileStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error) {
if info.ID == "" { if info.ID == "" {
info.ID = uid.Uid() info.ID = uid.Uid()
} }
binPath := store.binPath(info.ID) binPath := store.binPath(info.ID)

View File

@ -9,7 +9,7 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
// Test interface implementation of Filestore // Test interface implementation of Filestore

View File

@ -9,7 +9,7 @@ import (
"gopkg.in/h2non/gock.v1" "gopkg.in/h2non/gock.v1"
"cloud.google.com/go/storage" "cloud.google.com/go/storage"
. "github.com/tus/tusd/pkg/gcsstore" . "github.com/tus/tusd/v2/pkg/gcsstore"
"google.golang.org/api/option" "google.golang.org/api/option"
) )

View File

@ -22,8 +22,8 @@ import (
"sync/atomic" "sync/atomic"
"cloud.google.com/go/storage" "cloud.google.com/go/storage"
"github.com/tus/tusd/internal/uid" "github.com/tus/tusd/v2/internal/uid"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
// See the handler.DataStore interface for documentation about the different // See the handler.DataStore interface for documentation about the different

View File

@ -10,7 +10,7 @@ import (
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
gcsstore "github.com/tus/tusd/pkg/gcsstore" gcsstore "github.com/tus/tusd/v2/pkg/gcsstore"
) )
// MockGCSReader is a mock of GCSReader interface. // MockGCSReader is a mock of GCSReader interface.

View File

@ -11,8 +11,8 @@ import (
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/tus/tusd/pkg/gcsstore" "github.com/tus/tusd/v2/pkg/gcsstore"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
//go:generate mockgen -destination=./gcsstore_mock_test.go -package=gcsstore_test github.com/tus/tusd/pkg/gcsstore GCSReader,GCSAPI //go:generate mockgen -destination=./gcsstore_mock_test.go -package=gcsstore_test github.com/tus/tusd/pkg/gcsstore GCSReader,GCSAPI

View File

@ -1,9 +1,9 @@
package handler_test package handler_test
import ( import (
"github.com/tus/tusd/pkg/filestore" "github.com/tus/tusd/v2/pkg/filestore"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
"github.com/tus/tusd/pkg/memorylocker" "github.com/tus/tusd/v2/pkg/memorylocker"
) )
func ExampleNewStoreComposer() { func ExampleNewStoreComposer() {

View File

@ -8,7 +8,7 @@ import (
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
func TestConcat(t *testing.T) { func TestConcat(t *testing.T) {

View File

@ -5,7 +5,7 @@ import (
"net/http/httptest" "net/http/httptest"
"testing" "testing"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
func TestCORS(t *testing.T) { func TestCORS(t *testing.T) {

View File

@ -6,7 +6,7 @@ import (
"testing" "testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
type closingStringReader struct { type closingStringReader struct {

View File

@ -10,7 +10,7 @@ import (
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
handler "github.com/tus/tusd/pkg/handler" handler "github.com/tus/tusd/v2/pkg/handler"
) )
// MockFullDataStore is a mock of FullDataStore interface. // MockFullDataStore is a mock of FullDataStore interface.

View File

@ -5,7 +5,7 @@ import (
"testing" "testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
func TestHead(t *testing.T) { func TestHead(t *testing.T) {

View File

@ -4,7 +4,7 @@ import (
"net/http" "net/http"
"testing" "testing"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
func TestOptions(t *testing.T) { func TestOptions(t *testing.T) {

View File

@ -12,7 +12,7 @@ import (
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
func TestPatch(t *testing.T) { func TestPatch(t *testing.T) {

View File

@ -9,7 +9,7 @@ import (
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
func TestPost(t *testing.T) { func TestPost(t *testing.T) {

View File

@ -3,7 +3,7 @@ package handler_test
import ( import (
"testing" "testing"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
) )

View File

@ -5,7 +5,7 @@ import (
"testing" "testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

View File

@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
. "github.com/tus/tusd/pkg/handler" . "github.com/tus/tusd/v2/pkg/handler"
) )
func TestParseMetadataHeader(t *testing.T) { func TestParseMetadataHeader(t *testing.T) {

View File

@ -10,7 +10,7 @@ import (
"testing" "testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
//go:generate mockgen -package handler_test -source utils_test.go -destination=handler_mock_test.go //go:generate mockgen -package handler_test -source utils_test.go -destination=handler_mock_test.go

View File

@ -15,7 +15,7 @@ import (
"context" "context"
"sync" "sync"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
// MemoryLocker persists locks using memory and therefore allowing a simple and // MemoryLocker persists locks using memory and therefore allowing a simple and

View File

@ -6,7 +6,7 @@ import (
"time" "time"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
var _ handler.Locker = &MemoryLocker{} var _ handler.Locker = &MemoryLocker{}

View File

@ -12,7 +12,7 @@ import (
"strconv" "strconv"
"sync/atomic" "sync/atomic"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -1,22 +1,23 @@
// Package s3store provides a storage backend using AWS S3 or compatible servers. // Package s3store provides a storage backend using AWS S3 or compatible servers.
// //
// Configuration // # Configuration
// //
// In order to allow this backend to function properly, the user accessing the // In order to allow this backend to function properly, the user accessing the
// bucket must have at least following AWS IAM policy permissions for the // bucket must have at least following AWS IAM policy permissions for the
// bucket and all of its subresources: // bucket and all of its subresources:
// s3:AbortMultipartUpload //
// s3:DeleteObject // s3:AbortMultipartUpload
// s3:GetObject // s3:DeleteObject
// s3:ListMultipartUploadParts // s3:GetObject
// s3:PutObject // s3:ListMultipartUploadParts
// s3:PutObject
// //
// While this package uses the official AWS SDK for Go, S3Store is able // While this package uses the official AWS SDK for Go, S3Store is able
// to work with any S3-compatible service such as Riak CS. In order to change // to work with any S3-compatible service such as Riak CS. In order to change
// the HTTP endpoint used for sending requests to, consult the AWS Go SDK // the HTTP endpoint used for sending requests to, consult the AWS Go SDK
// (http://docs.aws.amazon.com/sdk-for-go/api/aws/Config.html#WithEndpoint-instance_method). // (http://docs.aws.amazon.com/sdk-for-go/api/aws/Config.html#WithEndpoint-instance_method).
// //
// Implementation // # Implementation
// //
// Once a new tus upload is initiated, multiple objects in S3 are created: // Once a new tus upload is initiated, multiple objects in S3 are created:
// //
@ -49,7 +50,7 @@
// info object is also deleted. If the upload has been finished already, the // info object is also deleted. If the upload has been finished already, the
// finished object containing the entire upload is also removed. // finished object containing the entire upload is also removed.
// //
// Considerations // # Considerations
// //
// In order to support tus' principle of resumable upload, S3's Multipart-Uploads // In order to support tus' principle of resumable upload, S3's Multipart-Uploads
// are internally used. // are internally used.
@ -85,9 +86,9 @@ import (
"github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/tus/tusd/internal/semaphore" "github.com/tus/tusd/v2/internal/semaphore"
"github.com/tus/tusd/internal/uid" "github.com/tus/tusd/v2/internal/uid"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awserr"

View File

@ -16,7 +16,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/s3" "github.com/aws/aws-sdk-go/service/s3"
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/v2/pkg/handler"
) )
//go:generate mockgen -destination=./s3store_mock_test.go -package=s3store github.com/tus/tusd/pkg/s3store S3API //go:generate mockgen -destination=./s3store_mock_test.go -package=s3store github.com/tus/tusd/pkg/s3store S3API