diff --git a/.gitignore b/.gitignore index 0dc13de08..00e212a73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .release/ .releases/ +cmd/playground/ kopia-*.tar.gz kopia-*.zip combined.cov diff --git a/Makefile b/Makefile index 6a35f6a09..36ab70538 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ play: go run cmd/playground/main.go lint: - -golint github.com/kopia/kopia/... + golint github.com/kopia/kopia/... vet: go tool vet -all . diff --git a/cmd/kopia/main.go b/cmd/kopia/main.go index a8e2ba52b..a7f20f112 100644 --- a/cmd/kopia/main.go +++ b/cmd/kopia/main.go @@ -1,5 +1,5 @@ /* -The 'kopia' utility supports creating and accessing backups from command line. +Command-line tool for creating and accessing backups. Usage: diff --git a/cmd/playground/main.go b/cmd/playground/main.go deleted file mode 100644 index 811546377..000000000 --- a/cmd/playground/main.go +++ /dev/null @@ -1,43 +0,0 @@ -package main - -import ( - "bytes" - "log" - - "github.com/kopia/kopia/repo" - "github.com/kopia/kopia/storage/storagetesting" -) - -func main() { - d := map[string][]byte{} - - s := storagetesting.NewMapStorage(d) - f := repo.Format{ - Version: 1, - MaxBlobSize: 100, - ObjectFormat: "TESTONLY_MD5", - } - r, err := repo.NewRepository(s, &f) - if err != nil { - log.Fatalf("Err: %v", err) - } - w := r.NewWriter(repo.WithDescription("tester")) - - w.Write(bytes.Repeat([]byte("a"), 5000)) - result, err := w.Result(true) - log.Printf("result: %v", result.UIString()) - - log.Printf("attempting to open") - - rdr, err := r.Open(result) - if err != nil { - log.Fatalf("open: %v", err) - } - log.Printf("len: %v\n", rdr.Length()) - log.Printf("----") - // for k, v := range d { - // log.Printf("%v = %v", k, string(v)) - // } - - rdr.Close() -} diff --git a/fuse/fusefs.go b/fuse/fusefs.go index 553adf0f6..3ce771663 100644 --- a/fuse/fusefs.go +++ b/fuse/fusefs.go @@ -1,5 +1,6 @@ // +build !windows +// Package fuse implements Node FUSE filesystem APIs for mounting contents of filesystem stored in repository. package fuse import ( diff --git a/storage/storagetesting/asserts.go b/internal/storagetesting/asserts.go similarity index 100% rename from storage/storagetesting/asserts.go rename to internal/storagetesting/asserts.go diff --git a/storage/storagetesting/map.go b/internal/storagetesting/map.go similarity index 100% rename from storage/storagetesting/map.go rename to internal/storagetesting/map.go diff --git a/storage/storagetesting/map_test.go b/internal/storagetesting/map_test.go similarity index 100% rename from storage/storagetesting/map_test.go rename to internal/storagetesting/map_test.go diff --git a/storage/storagetesting/verify.go b/internal/storagetesting/verify.go similarity index 100% rename from storage/storagetesting/verify.go rename to internal/storagetesting/verify.go diff --git a/repo/repository_test.go b/repo/repository_test.go index 3d2adb85c..52086d97a 100644 --- a/repo/repository_test.go +++ b/repo/repository_test.go @@ -13,8 +13,8 @@ "testing" "github.com/kopia/kopia/internal/jsonstream" + "github.com/kopia/kopia/internal/storagetesting" "github.com/kopia/kopia/storage" - "github.com/kopia/kopia/storage/storagetesting" ) func testFormat() *Format { diff --git a/storage/caching/caching_storage_test.go b/storage/caching/caching_storage_test.go index 48ed89381..6a954741e 100644 --- a/storage/caching/caching_storage_test.go +++ b/storage/caching/caching_storage_test.go @@ -10,8 +10,8 @@ "github.com/kopia/kopia/storage" + "github.com/kopia/kopia/internal/storagetesting" "github.com/kopia/kopia/storage/logging" - "github.com/kopia/kopia/storage/storagetesting" "testing" ) diff --git a/storage/filesystem/filesystem_storage.go b/storage/filesystem/filesystem_storage.go index 151a21974..ced219d29 100644 --- a/storage/filesystem/filesystem_storage.go +++ b/storage/filesystem/filesystem_storage.go @@ -1,3 +1,4 @@ +// Package filesystem implements filesystem-based Storage. package filesystem import ( diff --git a/storage/filesystem/filesystem_storage_test.go b/storage/filesystem/filesystem_storage_test.go index 74dac36c7..c429a02e8 100644 --- a/storage/filesystem/filesystem_storage_test.go +++ b/storage/filesystem/filesystem_storage_test.go @@ -5,7 +5,7 @@ "os" "testing" - "github.com/kopia/kopia/storage/storagetesting" + "github.com/kopia/kopia/internal/storagetesting" ) func TestFileStorage(t *testing.T) { diff --git a/storage/gcs/gcs_storage.go b/storage/gcs/gcs_storage.go index 946352e62..904a30234 100644 --- a/storage/gcs/gcs_storage.go +++ b/storage/gcs/gcs_storage.go @@ -1,3 +1,4 @@ +// Package gcs implements Storage based on Google Cloud Storage bucket. package gcs import ( diff --git a/storage/logging/logging_storage.go b/storage/logging/logging_storage.go index c8bc97a7d..155835e6a 100644 --- a/storage/logging/logging_storage.go +++ b/storage/logging/logging_storage.go @@ -1,3 +1,4 @@ +// Package logging implements wrapper around Storage that logs all activity. package logging import ( @@ -6,9 +7,10 @@ "github.com/kopia/kopia/storage" ) -// Printfer is +// Printfer supports emitting formatted strings to arbitrary outputs. +// The formatting language must be compatible with fmt.Sprintf(). type Printfer interface { - Printf(string, ...interface{}) + Printf(fmt string, args ...interface{}) } type loggingStorage struct { diff --git a/storage/logging/logging_storage_test.go b/storage/logging/logging_storage_test.go index 2ab1d1439..fef06e52f 100644 --- a/storage/logging/logging_storage_test.go +++ b/storage/logging/logging_storage_test.go @@ -3,7 +3,7 @@ import ( "testing" - "github.com/kopia/kopia/storage/storagetesting" + "github.com/kopia/kopia/internal/storagetesting" ) func TestLoggingStorage(t *testing.T) {