diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3ff702b3..2a9d9da2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -20,17 +20,17 @@ $ mc --help
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
-* If you have additional dependencies for ``mc``, ``mc`` manages its depedencies using [godep](https://github.com/tools/godep)
+* If you have additional dependencies for ``mc``, ``mc`` manages its depedencies using [govendor](https://github.com/kardianos/govendor)
- Run `go get foo/bar`
- Edit your code to import foo/bar
- - Run `make save` from top-level folder (or `godep restore && godep save ./...`).
+ - Run `govendor add foo/bar` from top-level folder
* When you're ready to create a pull request, be sure to:
- 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 `make build` completes.
* Read [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project
- - `mc` project is strictly conformant with Golang style
+ - `mc` project is conformant with Golang style
- if you happen to observe offending code, please feel free to send a pull request
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
deleted file mode 100644
index d0a5db12..00000000
--- a/Godeps/Godeps.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "ImportPath": "github.com/minio/mc",
- "GoVersion": "go1.4.2",
- "Packages": [
- "./..."
- ],
- "Deps": [
- {
- "ImportPath": "github.com/dustin/go-humanize",
- "Rev": "1c212aae1d02984808182b98b0da7a3e07e4c770"
- },
- {
- "ImportPath": "github.com/fatih/color",
- "Comment": "v0.1-3-ga56f483",
- "Rev": "a56f4833e47f827a93836d8d3f76c63459a1b310"
- },
- {
- "ImportPath": "github.com/fatih/structs",
- "Rev": "a9f7daa9c2729e97450c2da2feda19130a367d8f"
- },
- {
- "ImportPath": "github.com/mattn/go-isatty",
- "Rev": "ae0b1f8f8004be68d791a576e3d8e7648ab41449"
- },
- {
- "ImportPath": "github.com/minio/cli",
- "Comment": "1.2.0-114-g9280cba",
- "Rev": "9280cbaadcdd26d50b5ae85123682e37944701de"
- },
- {
- "ImportPath": "github.com/minio/minio-go",
- "Comment": "v0.2.1-4-g69b0564",
- "Rev": "69b05646606fd39171e16d6bf4edc84bb77787e0"
- },
- {
- "ImportPath": "github.com/minio/minio/pkg/probe",
- "Comment": "release-1434511043-302-gb4c8b48",
- "Rev": "b4c8b4877ea5e79b9c81c02be50ad4c4e112d53d"
- },
- {
- "ImportPath": "github.com/minio/pb",
- "Rev": "e3e099c334cd89a6fe993f0683eaafd85604290f"
- },
- {
- "ImportPath": "github.com/olekukonko/ts",
- "Rev": "ecf753e7c962639ab5a1fb46f7da627d4c0a04b8"
- },
- {
- "ImportPath": "github.com/shiena/ansicolor",
- "Rev": "a5e2b567a4dd6cc74545b8a4f27c9d63b9e7735b"
- },
- {
- "ImportPath": "github.com/tchap/go-patricia/patricia",
- "Comment": "v2.2.0",
- "Rev": "a560f85131e8aafc2cc4bcb1e265ae3fc6ee5f50"
- },
- {
- "ImportPath": "gopkg.in/check.v1",
- "Rev": "11d3bc7aa68e238947792f30573146a3231fc0f1"
- }
- ]
-}
diff --git a/Godeps/Readme b/Godeps/Readme
deleted file mode 100644
index 4cdaa53d..00000000
--- a/Godeps/Readme
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory tree is generated automatically by godep.
-
-Please do not edit.
-
-See https://github.com/tools/godep for more information.
diff --git a/Godeps/_workspace/.gitignore b/Godeps/_workspace/.gitignore
deleted file mode 100644
index f037d684..00000000
--- a/Godeps/_workspace/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/pkg
-/bin
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/.gitignore b/Godeps/_workspace/src/github.com/dustin/go-humanize/.gitignore
deleted file mode 100644
index 05b40514..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-#*
-*.[568]
-*.a
-*~
-[568].out
-_*
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/bigbytes_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/bigbytes_test.go
deleted file mode 100644
index da367d41..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/bigbytes_test.go
+++ /dev/null
@@ -1,219 +0,0 @@
-package humanize
-
-import (
- "math/big"
- "testing"
-)
-
-func TestBigByteParsing(t *testing.T) {
- tests := []struct {
- in string
- exp uint64
- }{
- {"42", 42},
- {"42MB", 42000000},
- {"42MiB", 44040192},
- {"42mb", 42000000},
- {"42mib", 44040192},
- {"42MIB", 44040192},
- {"42 MB", 42000000},
- {"42 MiB", 44040192},
- {"42 mb", 42000000},
- {"42 mib", 44040192},
- {"42 MIB", 44040192},
- {"42.5MB", 42500000},
- {"42.5MiB", 44564480},
- {"42.5 MB", 42500000},
- {"42.5 MiB", 44564480},
- // No need to say B
- {"42M", 42000000},
- {"42Mi", 44040192},
- {"42m", 42000000},
- {"42mi", 44040192},
- {"42MI", 44040192},
- {"42 M", 42000000},
- {"42 Mi", 44040192},
- {"42 m", 42000000},
- {"42 mi", 44040192},
- {"42 MI", 44040192},
- {"42.5M", 42500000},
- {"42.5Mi", 44564480},
- {"42.5 M", 42500000},
- {"42.5 Mi", 44564480},
- // Large testing, breaks when too much larger than
- // this.
- {"12.5 EB", uint64(12.5 * float64(EByte))},
- {"12.5 E", uint64(12.5 * float64(EByte))},
- {"12.5 EiB", uint64(12.5 * float64(EiByte))},
- }
-
- for _, p := range tests {
- got, err := ParseBigBytes(p.in)
- if err != nil {
- t.Errorf("Couldn't parse %v: %v", p.in, err)
- } else {
- if got.Uint64() != p.exp {
- t.Errorf("Expected %v for %v, got %v",
- p.exp, p.in, got)
- }
- }
- }
-}
-
-func TestBigByteErrors(t *testing.T) {
- got, err := ParseBigBytes("84 JB")
- if err == nil {
- t.Errorf("Expected error, got %v", got)
- }
- got, err = ParseBigBytes("")
- if err == nil {
- t.Errorf("Expected error parsing nothing")
- }
-}
-
-func bbyte(in uint64) string {
- return BigBytes((&big.Int{}).SetUint64(in))
-}
-
-func bibyte(in uint64) string {
- return BigIBytes((&big.Int{}).SetUint64(in))
-}
-
-func TestBigBytes(t *testing.T) {
- testList{
- {"bytes(0)", bbyte(0), "0B"},
- {"bytes(1)", bbyte(1), "1B"},
- {"bytes(803)", bbyte(803), "803B"},
- {"bytes(999)", bbyte(999), "999B"},
-
- {"bytes(1024)", bbyte(1024), "1.0kB"},
- {"bytes(1MB - 1)", bbyte(MByte - Byte), "1000kB"},
-
- {"bytes(1MB)", bbyte(1024 * 1024), "1.0MB"},
- {"bytes(1GB - 1K)", bbyte(GByte - KByte), "1000MB"},
-
- {"bytes(1GB)", bbyte(GByte), "1.0GB"},
- {"bytes(1TB - 1M)", bbyte(TByte - MByte), "1000GB"},
-
- {"bytes(1TB)", bbyte(TByte), "1.0TB"},
- {"bytes(1PB - 1T)", bbyte(PByte - TByte), "999TB"},
-
- {"bytes(1PB)", bbyte(PByte), "1.0PB"},
- {"bytes(1PB - 1T)", bbyte(EByte - PByte), "999PB"},
-
- {"bytes(1EB)", bbyte(EByte), "1.0EB"},
- // Overflows.
- // {"bytes(1EB - 1P)", Bytes((KByte*EByte)-PByte), "1023EB"},
-
- {"bytes(0)", bibyte(0), "0B"},
- {"bytes(1)", bibyte(1), "1B"},
- {"bytes(803)", bibyte(803), "803B"},
- {"bytes(1023)", bibyte(1023), "1023B"},
-
- {"bytes(1024)", bibyte(1024), "1.0KiB"},
- {"bytes(1MB - 1)", bibyte(MiByte - IByte), "1024KiB"},
-
- {"bytes(1MB)", bibyte(1024 * 1024), "1.0MiB"},
- {"bytes(1GB - 1K)", bibyte(GiByte - KiByte), "1024MiB"},
-
- {"bytes(1GB)", bibyte(GiByte), "1.0GiB"},
- {"bytes(1TB - 1M)", bibyte(TiByte - MiByte), "1024GiB"},
-
- {"bytes(1TB)", bibyte(TiByte), "1.0TiB"},
- {"bytes(1PB - 1T)", bibyte(PiByte - TiByte), "1023TiB"},
-
- {"bytes(1PB)", bibyte(PiByte), "1.0PiB"},
- {"bytes(1PB - 1T)", bibyte(EiByte - PiByte), "1023PiB"},
-
- {"bytes(1EiB)", bibyte(EiByte), "1.0EiB"},
- // Overflows.
- // {"bytes(1EB - 1P)", bibyte((KIByte*EIByte)-PiByte), "1023EB"},
-
- {"bytes(5.5GiB)", bibyte(5.5 * GiByte), "5.5GiB"},
-
- {"bytes(5.5GB)", bbyte(5.5 * GByte), "5.5GB"},
- }.validate(t)
-}
-
-func TestVeryBigBytes(t *testing.T) {
- b, _ := (&big.Int{}).SetString("15347691069326346944512", 10)
- s := BigBytes(b)
- if s != "15ZB" {
- t.Errorf("Expected 15ZB, got %v", s)
- }
- s = BigIBytes(b)
- if s != "13ZiB" {
- t.Errorf("Expected 13ZiB, got %v", s)
- }
-
- b, _ = (&big.Int{}).SetString("15716035654990179271180288", 10)
- s = BigBytes(b)
- if s != "16YB" {
- t.Errorf("Expected 16YB, got %v", s)
- }
- s = BigIBytes(b)
- if s != "13YiB" {
- t.Errorf("Expected 13YiB, got %v", s)
- }
-}
-
-func TestVeryVeryBigBytes(t *testing.T) {
- b, _ := (&big.Int{}).SetString("16093220510709943573688614912", 10)
- s := BigBytes(b)
- if s != "16093YB" {
- t.Errorf("Expected 16093YB, got %v", s)
- }
- s = BigIBytes(b)
- if s != "13312YiB" {
- t.Errorf("Expected 13312YiB, got %v", s)
- }
-}
-
-func TestParseVeryBig(t *testing.T) {
- tests := []struct {
- in string
- out string
- }{
- {"16ZB", "16000000000000000000000"},
- {"16ZiB", "18889465931478580854784"},
- {"16.5ZB", "16500000000000000000000"},
- {"16.5ZiB", "19479761741837286506496"},
- {"16Z", "16000000000000000000000"},
- {"16Zi", "18889465931478580854784"},
- {"16.5Z", "16500000000000000000000"},
- {"16.5Zi", "19479761741837286506496"},
-
- {"16YB", "16000000000000000000000000"},
- {"16YiB", "19342813113834066795298816"},
- {"16.5YB", "16500000000000000000000000"},
- {"16.5YiB", "19947276023641381382651904"},
- {"16Y", "16000000000000000000000000"},
- {"16Yi", "19342813113834066795298816"},
- {"16.5Y", "16500000000000000000000000"},
- {"16.5Yi", "19947276023641381382651904"},
- }
-
- for _, test := range tests {
- x, err := ParseBigBytes(test.in)
- if err != nil {
- t.Errorf("Error parsing %q: %v", test.in, err)
- continue
- }
-
- if x.String() != test.out {
- t.Errorf("Expected %q for %q, got %v", test.out, test.in, x)
- }
- }
-}
-
-func BenchmarkParseBigBytes(b *testing.B) {
- for i := 0; i < b.N; i++ {
- ParseBigBytes("16.5Z")
- }
-}
-
-func BenchmarkBigBytes(b *testing.B) {
- for i := 0; i < b.N; i++ {
- bibyte(16.5 * GByte)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/bytes_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/bytes_test.go
deleted file mode 100644
index 7497fa00..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/bytes_test.go
+++ /dev/null
@@ -1,144 +0,0 @@
-package humanize
-
-import (
- "testing"
-)
-
-func TestByteParsing(t *testing.T) {
- tests := []struct {
- in string
- exp uint64
- }{
- {"42", 42},
- {"42MB", 42000000},
- {"42MiB", 44040192},
- {"42mb", 42000000},
- {"42mib", 44040192},
- {"42MIB", 44040192},
- {"42 MB", 42000000},
- {"42 MiB", 44040192},
- {"42 mb", 42000000},
- {"42 mib", 44040192},
- {"42 MIB", 44040192},
- {"42.5MB", 42500000},
- {"42.5MiB", 44564480},
- {"42.5 MB", 42500000},
- {"42.5 MiB", 44564480},
- // No need to say B
- {"42M", 42000000},
- {"42Mi", 44040192},
- {"42m", 42000000},
- {"42mi", 44040192},
- {"42MI", 44040192},
- {"42 M", 42000000},
- {"42 Mi", 44040192},
- {"42 m", 42000000},
- {"42 mi", 44040192},
- {"42 MI", 44040192},
- {"42.5M", 42500000},
- {"42.5Mi", 44564480},
- {"42.5 M", 42500000},
- {"42.5 Mi", 44564480},
- // Large testing, breaks when too much larger than
- // this.
- {"12.5 EB", uint64(12.5 * float64(EByte))},
- {"12.5 E", uint64(12.5 * float64(EByte))},
- {"12.5 EiB", uint64(12.5 * float64(EiByte))},
- }
-
- for _, p := range tests {
- got, err := ParseBytes(p.in)
- if err != nil {
- t.Errorf("Couldn't parse %v: %v", p.in, err)
- }
- if got != p.exp {
- t.Errorf("Expected %v for %v, got %v",
- p.exp, p.in, got)
- }
- }
-}
-
-func TestByteErrors(t *testing.T) {
- got, err := ParseBytes("84 JB")
- if err == nil {
- t.Errorf("Expected error, got %v", got)
- }
- got, err = ParseBytes("")
- if err == nil {
- t.Errorf("Expected error parsing nothing")
- }
- got, err = ParseBytes("16 EiB")
- if err == nil {
- t.Errorf("Expected error, got %v", got)
- }
-}
-
-func TestBytes(t *testing.T) {
- testList{
- {"bytes(0)", Bytes(0), "0B"},
- {"bytes(1)", Bytes(1), "1B"},
- {"bytes(803)", Bytes(803), "803B"},
- {"bytes(999)", Bytes(999), "999B"},
-
- {"bytes(1024)", Bytes(1024), "1.0kB"},
- {"bytes(9999)", Bytes(9999), "10kB"},
- {"bytes(1MB - 1)", Bytes(MByte - Byte), "1000kB"},
-
- {"bytes(1MB)", Bytes(1024 * 1024), "1.0MB"},
- {"bytes(1GB - 1K)", Bytes(GByte - KByte), "1000MB"},
-
- {"bytes(1GB)", Bytes(GByte), "1.0GB"},
- {"bytes(1TB - 1M)", Bytes(TByte - MByte), "1000GB"},
- {"bytes(10MB)", Bytes(9999 * 1000), "10MB"},
-
- {"bytes(1TB)", Bytes(TByte), "1.0TB"},
- {"bytes(1PB - 1T)", Bytes(PByte - TByte), "999TB"},
-
- {"bytes(1PB)", Bytes(PByte), "1.0PB"},
- {"bytes(1PB - 1T)", Bytes(EByte - PByte), "999PB"},
-
- {"bytes(1EB)", Bytes(EByte), "1.0EB"},
- // Overflows.
- // {"bytes(1EB - 1P)", Bytes((KByte*EByte)-PByte), "1023EB"},
-
- {"bytes(0)", IBytes(0), "0B"},
- {"bytes(1)", IBytes(1), "1B"},
- {"bytes(803)", IBytes(803), "803B"},
- {"bytes(1023)", IBytes(1023), "1023B"},
-
- {"bytes(1024)", IBytes(1024), "1.0KiB"},
- {"bytes(1MB - 1)", IBytes(MiByte - IByte), "1024KiB"},
-
- {"bytes(1MB)", IBytes(1024 * 1024), "1.0MiB"},
- {"bytes(1GB - 1K)", IBytes(GiByte - KiByte), "1024MiB"},
-
- {"bytes(1GB)", IBytes(GiByte), "1.0GiB"},
- {"bytes(1TB - 1M)", IBytes(TiByte - MiByte), "1024GiB"},
-
- {"bytes(1TB)", IBytes(TiByte), "1.0TiB"},
- {"bytes(1PB - 1T)", IBytes(PiByte - TiByte), "1023TiB"},
-
- {"bytes(1PB)", IBytes(PiByte), "1.0PiB"},
- {"bytes(1PB - 1T)", IBytes(EiByte - PiByte), "1023PiB"},
-
- {"bytes(1EiB)", IBytes(EiByte), "1.0EiB"},
- // Overflows.
- // {"bytes(1EB - 1P)", IBytes((KIByte*EIByte)-PiByte), "1023EB"},
-
- {"bytes(5.5GiB)", IBytes(5.5 * GiByte), "5.5GiB"},
-
- {"bytes(5.5GB)", Bytes(5.5 * GByte), "5.5GB"},
- }.validate(t)
-}
-
-func BenchmarkParseBytes(b *testing.B) {
- for i := 0; i < b.N; i++ {
- ParseBytes("16.5GB")
- }
-}
-
-func BenchmarkBytes(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Bytes(16.5 * GByte)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/comma_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/comma_test.go
deleted file mode 100644
index 49040fb7..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/comma_test.go
+++ /dev/null
@@ -1,134 +0,0 @@
-package humanize
-
-import (
- "math"
- "math/big"
- "testing"
-)
-
-func TestCommas(t *testing.T) {
- testList{
- {"0", Comma(0), "0"},
- {"10", Comma(10), "10"},
- {"100", Comma(100), "100"},
- {"1,000", Comma(1000), "1,000"},
- {"10,000", Comma(10000), "10,000"},
- {"100,000", Comma(100000), "100,000"},
- {"10,000,000", Comma(10000000), "10,000,000"},
- {"10,100,000", Comma(10100000), "10,100,000"},
- {"10,010,000", Comma(10010000), "10,010,000"},
- {"10,001,000", Comma(10001000), "10,001,000"},
- {"123,456,789", Comma(123456789), "123,456,789"},
- {"maxint", Comma(9.223372e+18), "9,223,372,000,000,000,000"},
- {"minint", Comma(-9.223372e+18), "-9,223,372,000,000,000,000"},
- {"-123,456,789", Comma(-123456789), "-123,456,789"},
- {"-10,100,000", Comma(-10100000), "-10,100,000"},
- {"-10,010,000", Comma(-10010000), "-10,010,000"},
- {"-10,001,000", Comma(-10001000), "-10,001,000"},
- {"-10,000,000", Comma(-10000000), "-10,000,000"},
- {"-100,000", Comma(-100000), "-100,000"},
- {"-10,000", Comma(-10000), "-10,000"},
- {"-1,000", Comma(-1000), "-1,000"},
- {"-100", Comma(-100), "-100"},
- {"-10", Comma(-10), "-10"},
- }.validate(t)
-}
-
-func TestCommafs(t *testing.T) {
- testList{
- {"0", Commaf(0), "0"},
- {"10.11", Commaf(10.11), "10.11"},
- {"100", Commaf(100), "100"},
- {"1,000", Commaf(1000), "1,000"},
- {"10,000", Commaf(10000), "10,000"},
- {"100,000", Commaf(100000), "100,000"},
- {"834,142.32", Commaf(834142.32), "834,142.32"},
- {"10,000,000", Commaf(10000000), "10,000,000"},
- {"10,100,000", Commaf(10100000), "10,100,000"},
- {"10,010,000", Commaf(10010000), "10,010,000"},
- {"10,001,000", Commaf(10001000), "10,001,000"},
- {"123,456,789", Commaf(123456789), "123,456,789"},
- {"maxf64", Commaf(math.MaxFloat64), "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000"},
- {"minf64", Commaf(math.SmallestNonzeroFloat64), "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005"},
- {"-123,456,789", Commaf(-123456789), "-123,456,789"},
- {"-10,100,000", Commaf(-10100000), "-10,100,000"},
- {"-10,010,000", Commaf(-10010000), "-10,010,000"},
- {"-10,001,000", Commaf(-10001000), "-10,001,000"},
- {"-10,000,000", Commaf(-10000000), "-10,000,000"},
- {"-100,000", Commaf(-100000), "-100,000"},
- {"-10,000", Commaf(-10000), "-10,000"},
- {"-1,000", Commaf(-1000), "-1,000"},
- {"-100.11", Commaf(-100.11), "-100.11"},
- {"-10", Commaf(-10), "-10"},
- }.validate(t)
-}
-
-func BenchmarkCommas(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Comma(1234567890)
- }
-}
-
-func BenchmarkCommaf(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Commaf(1234567890.83584)
- }
-}
-
-func BenchmarkBigCommas(b *testing.B) {
- for i := 0; i < b.N; i++ {
- BigComma(big.NewInt(1234567890))
- }
-}
-
-func bigComma(i int64) string {
- return BigComma(big.NewInt(i))
-}
-
-func TestBigCommas(t *testing.T) {
- testList{
- {"0", bigComma(0), "0"},
- {"10", bigComma(10), "10"},
- {"100", bigComma(100), "100"},
- {"1,000", bigComma(1000), "1,000"},
- {"10,000", bigComma(10000), "10,000"},
- {"100,000", bigComma(100000), "100,000"},
- {"10,000,000", bigComma(10000000), "10,000,000"},
- {"10,100,000", bigComma(10100000), "10,100,000"},
- {"10,010,000", bigComma(10010000), "10,010,000"},
- {"10,001,000", bigComma(10001000), "10,001,000"},
- {"123,456,789", bigComma(123456789), "123,456,789"},
- {"maxint", bigComma(9.223372e+18), "9,223,372,000,000,000,000"},
- {"minint", bigComma(-9.223372e+18), "-9,223,372,000,000,000,000"},
- {"-123,456,789", bigComma(-123456789), "-123,456,789"},
- {"-10,100,000", bigComma(-10100000), "-10,100,000"},
- {"-10,010,000", bigComma(-10010000), "-10,010,000"},
- {"-10,001,000", bigComma(-10001000), "-10,001,000"},
- {"-10,000,000", bigComma(-10000000), "-10,000,000"},
- {"-100,000", bigComma(-100000), "-100,000"},
- {"-10,000", bigComma(-10000), "-10,000"},
- {"-1,000", bigComma(-1000), "-1,000"},
- {"-100", bigComma(-100), "-100"},
- {"-10", bigComma(-10), "-10"},
- }.validate(t)
-}
-
-func TestVeryBigCommas(t *testing.T) {
- tests := []struct{ in, exp string }{
- {
- "84889279597249724975972597249849757294578485",
- "84,889,279,597,249,724,975,972,597,249,849,757,294,578,485",
- },
- {
- "-84889279597249724975972597249849757294578485",
- "-84,889,279,597,249,724,975,972,597,249,849,757,294,578,485",
- },
- }
- for _, test := range tests {
- n, _ := (&big.Int{}).SetString(test.in, 10)
- got := BigComma(n)
- if test.exp != got {
- t.Errorf("Expected %q, got %q", test.exp, got)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/common_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/common_test.go
deleted file mode 100644
index fc7db151..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/common_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package humanize
-
-import (
- "testing"
-)
-
-type testList []struct {
- name, got, exp string
-}
-
-func (tl testList) validate(t *testing.T) {
- for _, test := range tl {
- if test.got != test.exp {
- t.Errorf("On %v, expected '%v', but got '%v'",
- test.name, test.exp, test.got)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/ftoa_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/ftoa_test.go
deleted file mode 100644
index 40d13bd7..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/ftoa_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package humanize
-
-import (
- "fmt"
- "regexp"
- "strconv"
- "testing"
-)
-
-func TestFtoa(t *testing.T) {
- testList{
- {"200", Ftoa(200), "200"},
- {"2", Ftoa(2), "2"},
- {"2.2", Ftoa(2.2), "2.2"},
- {"2.02", Ftoa(2.02), "2.02"},
- {"200.02", Ftoa(200.02), "200.02"},
- }.validate(t)
-}
-
-func BenchmarkFtoaRegexTrailing(b *testing.B) {
- trailingZerosRegex := regexp.MustCompile(`\.?0+$`)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- trailingZerosRegex.ReplaceAllString("2.00000", "")
- trailingZerosRegex.ReplaceAllString("2.0000", "")
- trailingZerosRegex.ReplaceAllString("2.000", "")
- trailingZerosRegex.ReplaceAllString("2.00", "")
- trailingZerosRegex.ReplaceAllString("2.0", "")
- trailingZerosRegex.ReplaceAllString("2", "")
- }
-}
-
-func BenchmarkFtoaFunc(b *testing.B) {
- for i := 0; i < b.N; i++ {
- stripTrailingZeros("2.00000")
- stripTrailingZeros("2.0000")
- stripTrailingZeros("2.000")
- stripTrailingZeros("2.00")
- stripTrailingZeros("2.0")
- stripTrailingZeros("2")
- }
-}
-
-func BenchmarkFmtF(b *testing.B) {
- for i := 0; i < b.N; i++ {
- fmt.Sprintf("%f", 2.03584)
- }
-}
-
-func BenchmarkStrconvF(b *testing.B) {
- for i := 0; i < b.N; i++ {
- strconv.FormatFloat(2.03584, 'f', 6, 64)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/number_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/number_test.go
deleted file mode 100644
index dd38a5bb..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/number_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package humanize
-
-import (
- "math"
- "testing"
-)
-
-type TestStruct struct {
- name string
- format string
- num float64
- formatted string
-}
-
-func TestFormatFloat(t *testing.T) {
- tests := []TestStruct{
- {"default", "", 12345.6789, "12,345.68"},
- {"#", "#", 12345.6789, "12345.678900000"},
- {"#.", "#.", 12345.6789, "12346"},
- {"#,#", "#,#", 12345.6789, "12345,7"},
- {"#,##", "#,##", 12345.6789, "12345,68"},
- {"#,###", "#,###", 12345.6789, "12345,679"},
- {"#,###.", "#,###.", 12345.6789, "12,346"},
- {"#,###.##", "#,###.##", 12345.6789, "12,345.68"},
- {"#,###.###", "#,###.###", 12345.6789, "12,345.679"},
- {"#,###.####", "#,###.####", 12345.6789, "12,345.6789"},
- {"#.###,######", "#.###,######", 12345.6789, "12.345,678900"},
- {"#\u202f###,##", "#\u202f###,##", 12345.6789, "12 345,68"},
-
- // special cases
- {"NaN", "#", math.NaN(), "NaN"},
- {"+Inf", "#", math.Inf(1), "Infinity"},
- {"-Inf", "#", math.Inf(-1), "-Infinity"},
- {"signStr <= -0.000000001", "", -0.000000002, "-0.00"},
- {"signStr = 0", "", 0, "0.00"},
- {"Format directive must start with +", "+000", 12345.6789, "+12345.678900000"},
- }
-
- for _, test := range tests {
- got := FormatFloat(test.format, test.num)
- if got != test.formatted {
- t.Errorf("On %v (%v, %v), got %v, wanted %v",
- test.name, test.format, test.num, got, test.formatted)
- }
- }
- // Test a single integer
- got := FormatInteger("#", 12345)
- if got != "12345.000000000" {
- t.Errorf("On %v (%v, %v), got %v, wanted %v",
- "integerTest", "#", 12345, got, "12345.000000000")
- }
- // Test the things that could panic
- panictests := []TestStruct{
- {"RenderFloat(): invalid positive sign directive", "-", 12345.6789, "12,345.68"},
- {"RenderFloat(): thousands separator directive must be followed by 3 digit-specifiers", "0.01", 12345.6789, "12,345.68"},
- }
- for _, test := range panictests {
- didPanic := false
- var message interface{}
- func() {
-
- defer func() {
- if message = recover(); message != nil {
- didPanic = true
- }
- }()
-
- // call the target function
- _ = FormatFloat(test.format, test.num)
-
- }()
- if didPanic != true {
- t.Errorf("On %v, should have panic and did not.",
- test.name)
- }
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/ordinals_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/ordinals_test.go
deleted file mode 100644
index 51d85ee7..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/ordinals_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package humanize
-
-import (
- "testing"
-)
-
-func TestOrdinals(t *testing.T) {
- testList{
- {"0", Ordinal(0), "0th"},
- {"1", Ordinal(1), "1st"},
- {"2", Ordinal(2), "2nd"},
- {"3", Ordinal(3), "3rd"},
- {"4", Ordinal(4), "4th"},
- {"10", Ordinal(10), "10th"},
- {"11", Ordinal(11), "11th"},
- {"12", Ordinal(12), "12th"},
- {"13", Ordinal(13), "13th"},
- {"101", Ordinal(101), "101st"},
- {"102", Ordinal(102), "102nd"},
- {"103", Ordinal(103), "103rd"},
- }.validate(t)
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/si_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/si_test.go
deleted file mode 100644
index 32fb386b..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/si_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package humanize
-
-import (
- "math"
- "testing"
-)
-
-func TestSI(t *testing.T) {
- tests := []struct {
- name string
- num float64
- formatted string
- }{
- {"e-24", 1e-24, "1yF"},
- {"e-21", 1e-21, "1zF"},
- {"e-18", 1e-18, "1aF"},
- {"e-15", 1e-15, "1fF"},
- {"e-12", 1e-12, "1pF"},
- {"e-12", 2.2345e-12, "2.2345pF"},
- {"e-12", 2.23e-12, "2.23pF"},
- {"e-11", 2.23e-11, "22.3pF"},
- {"e-10", 2.2e-10, "220pF"},
- {"e-9", 2.2e-9, "2.2nF"},
- {"e-8", 2.2e-8, "22nF"},
- {"e-7", 2.2e-7, "220nF"},
- {"e-6", 2.2e-6, "2.2µF"},
- {"e-6", 1e-6, "1µF"},
- {"e-5", 2.2e-5, "22µF"},
- {"e-4", 2.2e-4, "220µF"},
- {"e-3", 2.2e-3, "2.2mF"},
- {"e-2", 2.2e-2, "22mF"},
- {"e-1", 2.2e-1, "220mF"},
- {"e+0", 2.2e-0, "2.2F"},
- {"e+0", 2.2, "2.2F"},
- {"e+1", 2.2e+1, "22F"},
- {"0", 0, "0F"},
- {"e+1", 22, "22F"},
- {"e+2", 2.2e+2, "220F"},
- {"e+2", 220, "220F"},
- {"e+3", 2.2e+3, "2.2kF"},
- {"e+3", 2200, "2.2kF"},
- {"e+4", 2.2e+4, "22kF"},
- {"e+4", 22000, "22kF"},
- {"e+5", 2.2e+5, "220kF"},
- {"e+6", 2.2e+6, "2.2MF"},
- {"e+6", 1e+6, "1MF"},
- {"e+7", 2.2e+7, "22MF"},
- {"e+8", 2.2e+8, "220MF"},
- {"e+9", 2.2e+9, "2.2GF"},
- {"e+10", 2.2e+10, "22GF"},
- {"e+11", 2.2e+11, "220GF"},
- {"e+12", 2.2e+12, "2.2TF"},
- {"e+15", 2.2e+15, "2.2PF"},
- {"e+18", 2.2e+18, "2.2EF"},
- {"e+21", 2.2e+21, "2.2ZF"},
- {"e+24", 2.2e+24, "2.2YF"},
-
- // special case
- {"1F", 1000 * 1000, "1MF"},
- {"1F", 1e6, "1MF"},
- }
-
- for _, test := range tests {
- got := SI(test.num, "F")
- if got != test.formatted {
- t.Errorf("On %v (%v), got %v, wanted %v",
- test.name, test.num, got, test.formatted)
- }
-
- gotf, gotu, err := ParseSI(test.formatted)
- if err != nil {
- t.Errorf("Error parsing %v (%v): %v", test.name, test.formatted, err)
- continue
- }
-
- if math.Abs(1-(gotf/test.num)) > 0.01 {
- t.Errorf("On %v (%v), got %v, wanted %v (±%v)",
- test.name, test.formatted, gotf, test.num,
- math.Abs(1-(gotf/test.num)))
- }
- if gotu != "F" {
- t.Errorf("On %v (%v), expected unit F, got %v",
- test.name, test.formatted, gotu)
- }
- }
-
- // Parse error
- gotf, gotu, err := ParseSI("x1.21JW") // 1.21 jigga whats
- if err == nil {
- t.Errorf("Expected error on x1.21JW, got %v %v", gotf, gotu)
- }
-}
-
-func BenchmarkParseSI(b *testing.B) {
- for i := 0; i < b.N; i++ {
- ParseSI("2.2346ZB")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/times_test.go b/Godeps/_workspace/src/github.com/dustin/go-humanize/times_test.go
deleted file mode 100644
index 528daa4e..00000000
--- a/Godeps/_workspace/src/github.com/dustin/go-humanize/times_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package humanize
-
-import (
- "math"
- "testing"
- "time"
-)
-
-func TestPast(t *testing.T) {
- now := time.Now().Unix()
- testList{
- {"now", Time(time.Unix(now, 0)), "now"},
- {"1 second ago", Time(time.Unix(now-1, 0)), "1 second ago"},
- {"12 seconds ago", Time(time.Unix(now-12, 0)), "12 seconds ago"},
- {"30 seconds ago", Time(time.Unix(now-30, 0)), "30 seconds ago"},
- {"45 seconds ago", Time(time.Unix(now-45, 0)), "45 seconds ago"},
- {"1 minute ago", Time(time.Unix(now-63, 0)), "1 minute ago"},
- {"15 minutes ago", Time(time.Unix(now-15*Minute, 0)), "15 minutes ago"},
- {"1 hour ago", Time(time.Unix(now-63*Minute, 0)), "1 hour ago"},
- {"2 hours ago", Time(time.Unix(now-2*Hour, 0)), "2 hours ago"},
- {"21 hours ago", Time(time.Unix(now-21*Hour, 0)), "21 hours ago"},
- {"1 day ago", Time(time.Unix(now-26*Hour, 0)), "1 day ago"},
- {"2 days ago", Time(time.Unix(now-49*Hour, 0)), "2 days ago"},
- {"3 days ago", Time(time.Unix(now-3*Day, 0)), "3 days ago"},
- {"1 week ago (1)", Time(time.Unix(now-7*Day, 0)), "1 week ago"},
- {"1 week ago (2)", Time(time.Unix(now-12*Day, 0)), "1 week ago"},
- {"2 weeks ago", Time(time.Unix(now-15*Day, 0)), "2 weeks ago"},
- {"1 month ago", Time(time.Unix(now-39*Day, 0)), "1 month ago"},
- {"3 months ago", Time(time.Unix(now-99*Day, 0)), "3 months ago"},
- {"1 year ago (1)", Time(time.Unix(now-365*Day, 0)), "1 year ago"},
- {"1 year ago (1)", Time(time.Unix(now-400*Day, 0)), "1 year ago"},
- {"2 years ago (1)", Time(time.Unix(now-548*Day, 0)), "2 years ago"},
- {"2 years ago (2)", Time(time.Unix(now-725*Day, 0)), "2 years ago"},
- {"2 years ago (3)", Time(time.Unix(now-800*Day, 0)), "2 years ago"},
- {"3 years ago", Time(time.Unix(now-3*Year, 0)), "3 years ago"},
- {"long ago", Time(time.Unix(now-LongTime, 0)), "a long while ago"},
- }.validate(t)
-}
-
-func TestFuture(t *testing.T) {
- now := time.Now().Unix()
- testList{
- {"now", Time(time.Unix(now, 0)), "now"},
- {"1 second from now", Time(time.Unix(now+1, 0)), "1 second from now"},
- {"12 seconds from now", Time(time.Unix(now+12, 0)), "12 seconds from now"},
- {"30 seconds from now", Time(time.Unix(now+30, 0)), "30 seconds from now"},
- {"45 seconds from now", Time(time.Unix(now+45, 0)), "45 seconds from now"},
- {"15 minutes from now", Time(time.Unix(now+15*Minute, 0)), "15 minutes from now"},
- {"2 hours from now", Time(time.Unix(now+2*Hour, 0)), "2 hours from now"},
- {"21 hours from now", Time(time.Unix(now+21*Hour, 0)), "21 hours from now"},
- {"1 day from now", Time(time.Unix(now+26*Hour, 0)), "1 day from now"},
- {"2 days from now", Time(time.Unix(now+49*Hour, 0)), "2 days from now"},
- {"3 days from now", Time(time.Unix(now+3*Day, 0)), "3 days from now"},
- {"1 week from now (1)", Time(time.Unix(now+7*Day, 0)), "1 week from now"},
- {"1 week from now (2)", Time(time.Unix(now+12*Day, 0)), "1 week from now"},
- {"2 weeks from now", Time(time.Unix(now+15*Day, 0)), "2 weeks from now"},
- {"1 month from now", Time(time.Unix(now+30*Day, 0)), "1 month from now"},
- {"1 year from now", Time(time.Unix(now+365*Day, 0)), "1 year from now"},
- {"2 years from now", Time(time.Unix(now+2*Year, 0)), "2 years from now"},
- {"a while from now", Time(time.Unix(now+LongTime, 0)), "a long while from now"},
- }.validate(t)
-}
-
-func TestRange(t *testing.T) {
- start := time.Time{}
- end := time.Unix(math.MaxInt64, math.MaxInt64)
- x := RelTime(start, end, "ago", "from now")
- if x != "a long while from now" {
- t.Errorf("Expected a long while from now, got %q", x)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/fatih/color/.travis.yml b/Godeps/_workspace/src/github.com/fatih/color/.travis.yml
deleted file mode 100644
index 2405aef3..00000000
--- a/Godeps/_workspace/src/github.com/fatih/color/.travis.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-language: go
-go: 1.3
-
diff --git a/Godeps/_workspace/src/github.com/fatih/color/color_test.go b/Godeps/_workspace/src/github.com/fatih/color/color_test.go
deleted file mode 100644
index a1192b55..00000000
--- a/Godeps/_workspace/src/github.com/fatih/color/color_test.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package color
-
-import (
- "bytes"
- "fmt"
- "os"
- "testing"
-
- "github.com/shiena/ansicolor"
-)
-
-// Testing colors is kinda different. First we test for given colors and their
-// escaped formatted results. Next we create some visual tests to be tested.
-// Each visual test includes the color name to be compared.
-func TestColor(t *testing.T) {
- rb := new(bytes.Buffer)
- Output = rb
-
- testColors := []struct {
- text string
- code Attribute
- }{
- {text: "black", code: FgBlack},
- {text: "red", code: FgRed},
- {text: "green", code: FgGreen},
- {text: "yellow", code: FgYellow},
- {text: "blue", code: FgBlue},
- {text: "magent", code: FgMagenta},
- {text: "cyan", code: FgCyan},
- {text: "white", code: FgWhite},
- }
-
- for _, c := range testColors {
- New(c.code).Print(c.text)
-
- line, _ := rb.ReadString('\n')
- scannedLine := fmt.Sprintf("%q", line)
- colored := fmt.Sprintf("\x1b[%dm%s\x1b[0m", c.code, c.text)
- escapedForm := fmt.Sprintf("%q", colored)
-
- fmt.Printf("%s\t: %s\n", c.text, line)
-
- if scannedLine != escapedForm {
- t.Errorf("Expecting %s, got '%s'\n", escapedForm, scannedLine)
- }
- }
-}
-
-func TestNoColor(t *testing.T) {
- rb := new(bytes.Buffer)
- Output = rb
-
- testColors := []struct {
- text string
- code Attribute
- }{
- {text: "black", code: FgBlack},
- {text: "red", code: FgRed},
- {text: "green", code: FgGreen},
- {text: "yellow", code: FgYellow},
- {text: "blue", code: FgBlue},
- {text: "magent", code: FgMagenta},
- {text: "cyan", code: FgCyan},
- {text: "white", code: FgWhite},
- }
-
- for _, c := range testColors {
- p := New(c.code)
- p.DisableColor()
- p.Print(c.text)
-
- line, _ := rb.ReadString('\n')
- if line != c.text {
- t.Errorf("Expecting %s, got '%s'\n", c.text, line)
- }
- }
-
- // global check
- NoColor = true
- defer func() {
- NoColor = false
- }()
- for _, c := range testColors {
- p := New(c.code)
- p.Print(c.text)
-
- line, _ := rb.ReadString('\n')
- if line != c.text {
- t.Errorf("Expecting %s, got '%s'\n", c.text, line)
- }
- }
-
-}
-
-func TestColorVisual(t *testing.T) {
- // First Visual Test
- fmt.Println("")
- Output = ansicolor.NewAnsiColorWriter(os.Stdout)
-
- New(FgRed).Printf("red\t")
- New(BgRed).Print(" ")
- New(FgRed, Bold).Println(" red")
-
- New(FgGreen).Printf("green\t")
- New(BgGreen).Print(" ")
- New(FgGreen, Bold).Println(" green")
-
- New(FgYellow).Printf("yellow\t")
- New(BgYellow).Print(" ")
- New(FgYellow, Bold).Println(" yellow")
-
- New(FgBlue).Printf("blue\t")
- New(BgBlue).Print(" ")
- New(FgBlue, Bold).Println(" blue")
-
- New(FgMagenta).Printf("magenta\t")
- New(BgMagenta).Print(" ")
- New(FgMagenta, Bold).Println(" magenta")
-
- New(FgCyan).Printf("cyan\t")
- New(BgCyan).Print(" ")
- New(FgCyan, Bold).Println(" cyan")
-
- New(FgWhite).Printf("white\t")
- New(BgWhite).Print(" ")
- New(FgWhite, Bold).Println(" white")
- fmt.Println("")
-
- // Second Visual test
- Black("black")
- Red("red")
- Green("green")
- Yellow("yellow")
- Blue("blue")
- Magenta("magenta")
- Cyan("cyan")
- White("white")
-
- // Third visual test
- fmt.Println()
- Set(FgBlue)
- fmt.Println("is this blue?")
- Unset()
-
- Set(FgMagenta)
- fmt.Println("and this magenta?")
- Unset()
-
- // Fourth Visual test
- fmt.Println()
- blue := New(FgBlue).PrintlnFunc()
- blue("blue text with custom print func")
-
- red := New(FgRed).PrintfFunc()
- red("red text with a printf func: %d\n", 123)
-
- put := New(FgYellow).SprintFunc()
- warn := New(FgRed).SprintFunc()
-
- fmt.Fprintf(Output, "this is a %s and this is %s.\n", put("warning"), warn("error"))
-
- info := New(FgWhite, BgGreen).SprintFunc()
- fmt.Fprintf(Output, "this %s rocks!\n", info("package"))
-
- // Fifth Visual Test
- fmt.Println()
-
- fmt.Fprintln(Output, BlackString("black"))
- fmt.Fprintln(Output, RedString("red"))
- fmt.Fprintln(Output, GreenString("green"))
- fmt.Fprintln(Output, YellowString("yellow"))
- fmt.Fprintln(Output, BlueString("blue"))
- fmt.Fprintln(Output, MagentaString("magenta"))
- fmt.Fprintln(Output, CyanString("cyan"))
- fmt.Fprintln(Output, WhiteString("white"))
-}
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/.gitignore b/Godeps/_workspace/src/github.com/fatih/structs/.gitignore
deleted file mode 100644
index 83656241..00000000
--- a/Godeps/_workspace/src/github.com/fatih/structs/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/.travis.yml b/Godeps/_workspace/src/github.com/fatih/structs/.travis.yml
deleted file mode 100644
index 28381ef8..00000000
--- a/Godeps/_workspace/src/github.com/fatih/structs/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: go
-go: 1.3
-before_install:
-- go get github.com/axw/gocov/gocov
-- go get github.com/mattn/goveralls
-- go get code.google.com/p/go.tools/cmd/cover
-script:
-- $HOME/gopath/bin/goveralls -repotoken $COVERALLS_TOKEN
-env:
- global:
- - secure: hkc+92KPmMFqIH9n4yWdnH1JpZjahmOyDJwpTh8Yl0JieJNG0XEXpOqNao27eA0cLF+UHdyjFeGcPUJKNmgE46AoQjtovt+ICjCXKR2yF6S2kKJcUOz/Vd6boZF7qHV06jjxyxOebpID5iSoW6UfFr001bFxpd3jaSLFTzSHWRQ=
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/field_test.go b/Godeps/_workspace/src/github.com/fatih/structs/field_test.go
deleted file mode 100644
index 46187d65..00000000
--- a/Godeps/_workspace/src/github.com/fatih/structs/field_test.go
+++ /dev/null
@@ -1,324 +0,0 @@
-package structs
-
-import (
- "reflect"
- "testing"
-)
-
-// A test struct that defines all cases
-type Foo struct {
- A string
- B int `structs:"y"`
- C bool `json:"c"`
- d string // not exported
- E *Baz
- x string `xml:"x"` // not exported, with tag
- Y []string
- Z map[string]interface{}
- *Bar // embedded
-}
-
-type Baz struct {
- A string
- B int
-}
-
-type Bar struct {
- E string
- F int
- g []string
-}
-
-func newStruct() *Struct {
- b := &Bar{
- E: "example",
- F: 2,
- g: []string{"zeynep", "fatih"},
- }
-
- // B and x is not initialized for testing
- f := &Foo{
- A: "gopher",
- C: true,
- d: "small",
- E: nil,
- Y: []string{"example"},
- Z: nil,
- }
- f.Bar = b
-
- return New(f)
-}
-
-func TestField_Set(t *testing.T) {
- s := newStruct()
-
- f := s.Field("A")
- err := f.Set("fatih")
- if err != nil {
- t.Error(err)
- }
-
- if f.Value().(string) != "fatih" {
- t.Errorf("Setted value is wrong: %s want: %s", f.Value().(string), "fatih")
- }
-
- f = s.Field("Y")
- err = f.Set([]string{"override", "with", "this"})
- if err != nil {
- t.Error(err)
- }
-
- sliceLen := len(f.Value().([]string))
- if sliceLen != 3 {
- t.Errorf("Setted values slice length is wrong: %d, want: %d", sliceLen, 3)
- }
-
- f = s.Field("C")
- err = f.Set(false)
- if err != nil {
- t.Error(err)
- }
-
- if f.Value().(bool) {
- t.Errorf("Setted value is wrong: %s want: %s", f.Value().(bool), false)
- }
-
- // let's pass a different type
- f = s.Field("A")
- err = f.Set(123) // Field A is of type string, but we are going to pass an integer
- if err == nil {
- t.Error("Setting a field's value with a different type than the field's type should return an error")
- }
-
- // old value should be still there :)
- if f.Value().(string) != "fatih" {
- t.Errorf("Setted value is wrong: %s want: %s", f.Value().(string), "fatih")
- }
-
- // let's access an unexported field, which should give an error
- f = s.Field("d")
- err = f.Set("large")
- if err != errNotExported {
- t.Error(err)
- }
-
- // let's set a pointer to struct
- b := &Bar{
- E: "gopher",
- F: 2,
- }
-
- f = s.Field("Bar")
- err = f.Set(b)
- if err != nil {
- t.Error(err)
- }
-
- baz := &Baz{
- A: "helloWorld",
- B: 42,
- }
-
- f = s.Field("E")
- err = f.Set(baz)
- if err != nil {
- t.Error(err)
- }
-
- ba := s.Field("E").Value().(*Baz)
-
- if ba.A != "helloWorld" {
- t.Errorf("could not set baz. Got: %s Want: helloWorld", ba.A)
- }
-}
-
-func TestField(t *testing.T) {
- s := newStruct()
-
- defer func() {
- err := recover()
- if err == nil {
- t.Error("Retrieveing a non existing field from the struct should panic")
- }
- }()
-
- _ = s.Field("no-field")
-}
-
-func TestField_Kind(t *testing.T) {
- s := newStruct()
-
- f := s.Field("A")
- if f.Kind() != reflect.String {
- t.Errorf("Field A has wrong kind: %s want: %s", f.Kind(), reflect.String)
- }
-
- f = s.Field("B")
- if f.Kind() != reflect.Int {
- t.Errorf("Field B has wrong kind: %s want: %s", f.Kind(), reflect.Int)
- }
-
- // unexported
- f = s.Field("d")
- if f.Kind() != reflect.String {
- t.Errorf("Field d has wrong kind: %s want: %s", f.Kind(), reflect.String)
- }
-}
-
-func TestField_Tag(t *testing.T) {
- s := newStruct()
-
- v := s.Field("B").Tag("json")
- if v != "" {
- t.Errorf("Field's tag value of a non existing tag should return empty, got: %s", v)
- }
-
- v = s.Field("C").Tag("json")
- if v != "c" {
- t.Errorf("Field's tag value of the existing field C should return 'c', got: %s", v)
- }
-
- v = s.Field("d").Tag("json")
- if v != "" {
- t.Errorf("Field's tag value of a non exported field should return empty, got: %s", v)
- }
-
- v = s.Field("x").Tag("xml")
- if v != "x" {
- t.Errorf("Field's tag value of a non exported field with a tag should return 'x', got: %s", v)
- }
-
- v = s.Field("A").Tag("json")
- if v != "" {
- t.Errorf("Field's tag value of a existing field without a tag should return empty, got: %s", v)
- }
-}
-
-func TestField_Value(t *testing.T) {
- s := newStruct()
-
- v := s.Field("A").Value()
- val, ok := v.(string)
- if !ok {
- t.Errorf("Field's value of a A should be string")
- }
-
- if val != "gopher" {
- t.Errorf("Field's value of a existing tag should return 'gopher', got: %s", val)
- }
-
- defer func() {
- err := recover()
- if err == nil {
- t.Error("Value of a non exported field from the field should panic")
- }
- }()
-
- // should panic
- _ = s.Field("d").Value()
-}
-
-func TestField_IsEmbedded(t *testing.T) {
- s := newStruct()
-
- if !s.Field("Bar").IsEmbedded() {
- t.Errorf("Fields 'Bar' field is an embedded field")
- }
-
- if s.Field("d").IsEmbedded() {
- t.Errorf("Fields 'd' field is not an embedded field")
- }
-}
-
-func TestField_IsExported(t *testing.T) {
- s := newStruct()
-
- if !s.Field("Bar").IsExported() {
- t.Errorf("Fields 'Bar' field is an exported field")
- }
-
- if !s.Field("A").IsExported() {
- t.Errorf("Fields 'A' field is an exported field")
- }
-
- if s.Field("d").IsExported() {
- t.Errorf("Fields 'd' field is not an exported field")
- }
-}
-
-func TestField_IsZero(t *testing.T) {
- s := newStruct()
-
- if s.Field("A").IsZero() {
- t.Errorf("Fields 'A' field is an initialized field")
- }
-
- if !s.Field("B").IsZero() {
- t.Errorf("Fields 'B' field is not an initialized field")
- }
-}
-
-func TestField_Name(t *testing.T) {
- s := newStruct()
-
- if s.Field("A").Name() != "A" {
- t.Errorf("Fields 'A' field should have the name 'A'")
- }
-}
-
-func TestField_Field(t *testing.T) {
- s := newStruct()
-
- e := s.Field("Bar").Field("E")
-
- val, ok := e.Value().(string)
- if !ok {
- t.Error("The value of the field 'e' inside 'Bar' struct should be string")
- }
-
- if val != "example" {
- t.Errorf("The value of 'e' should be 'example, got: %s", val)
- }
-
- defer func() {
- err := recover()
- if err == nil {
- t.Error("Field of a non existing nested struct should panic")
- }
- }()
-
- _ = s.Field("Bar").Field("e")
-}
-
-func TestField_Fields(t *testing.T) {
- s := newStruct()
- fields := s.Field("Bar").Fields()
-
- if len(fields) != 3 {
- t.Errorf("We expect 3 fields in embedded struct, was: %d", len(fields))
- }
-}
-
-func TestField_FieldOk(t *testing.T) {
- s := newStruct()
-
- b, ok := s.FieldOk("Bar")
- if !ok {
- t.Error("The field 'Bar' should exists.")
- }
-
- e, ok := b.FieldOk("E")
- if !ok {
- t.Error("The field 'E' should exists.")
- }
-
- val, ok := e.Value().(string)
- if !ok {
- t.Error("The value of the field 'e' inside 'Bar' struct should be string")
- }
-
- if val != "example" {
- t.Errorf("The value of 'e' should be 'example, got: %s", val)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/structs_example_test.go b/Godeps/_workspace/src/github.com/fatih/structs/structs_example_test.go
deleted file mode 100644
index 32bb8293..00000000
--- a/Godeps/_workspace/src/github.com/fatih/structs/structs_example_test.go
+++ /dev/null
@@ -1,351 +0,0 @@
-package structs
-
-import (
- "fmt"
- "time"
-)
-
-func ExampleNew() {
- type Server struct {
- Name string
- ID int32
- Enabled bool
- }
-
- server := &Server{
- Name: "Arslan",
- ID: 123456,
- Enabled: true,
- }
-
- s := New(server)
-
- fmt.Printf("Name : %v\n", s.Name())
- fmt.Printf("Values : %v\n", s.Values())
- fmt.Printf("Value of ID : %v\n", s.Field("ID").Value())
- // Output:
- // Name : Server
- // Values : [Arslan 123456 true]
- // Value of ID : 123456
-
-}
-
-func ExampleMap() {
- type Server struct {
- Name string
- ID int32
- Enabled bool
- }
-
- s := &Server{
- Name: "Arslan",
- ID: 123456,
- Enabled: true,
- }
-
- m := Map(s)
-
- fmt.Printf("%#v\n", m["Name"])
- fmt.Printf("%#v\n", m["ID"])
- fmt.Printf("%#v\n", m["Enabled"])
- // Output:
- // "Arslan"
- // 123456
- // true
-
-}
-
-func ExampleMap_tags() {
- // Custom tags can change the map keys instead of using the fields name
- type Server struct {
- Name string `structs:"server_name"`
- ID int32 `structs:"server_id"`
- Enabled bool `structs:"enabled"`
- }
-
- s := &Server{
- Name: "Zeynep",
- ID: 789012,
- }
-
- m := Map(s)
-
- // access them by the custom tags defined above
- fmt.Printf("%#v\n", m["server_name"])
- fmt.Printf("%#v\n", m["server_id"])
- fmt.Printf("%#v\n", m["enabled"])
- // Output:
- // "Zeynep"
- // 789012
- // false
-
-}
-
-func ExampleMap_nested() {
- // By default field with struct types are processed too. We can stop
- // processing them via "omitnested" tag option.
- type Server struct {
- Name string `structs:"server_name"`
- ID int32 `structs:"server_id"`
- Time time.Time `structs:"time,omitnested"` // do not convert to map[string]interface{}
- }
-
- const shortForm = "2006-Jan-02"
- t, _ := time.Parse("2006-Jan-02", "2013-Feb-03")
-
- s := &Server{
- Name: "Zeynep",
- ID: 789012,
- Time: t,
- }
-
- m := Map(s)
-
- // access them by the custom tags defined above
- fmt.Printf("%v\n", m["server_name"])
- fmt.Printf("%v\n", m["server_id"])
- fmt.Printf("%v\n", m["time"].(time.Time))
- // Output:
- // Zeynep
- // 789012
- // 2013-02-03 00:00:00 +0000 UTC
-}
-
-func ExampleMap_omitEmpty() {
- // By default field with struct types of zero values are processed too. We
- // can stop processing them via "omitempty" tag option.
- type Server struct {
- Name string `structs:",omitempty"`
- ID int32 `structs:"server_id,omitempty"`
- Location string
- }
-
- // Only add location
- s := &Server{
- Location: "Tokyo",
- }
-
- m := Map(s)
-
- // map contains only the Location field
- fmt.Printf("%v\n", m)
- // Output:
- // map[Location:Tokyo]
-}
-
-func ExampleValues() {
- type Server struct {
- Name string
- ID int32
- Enabled bool
- }
-
- s := &Server{
- Name: "Fatih",
- ID: 135790,
- Enabled: false,
- }
-
- m := Values(s)
-
- fmt.Printf("Values: %+v\n", m)
- // Output:
- // Values: [Fatih 135790 false]
-}
-
-func ExampleValues_omitEmpty() {
- // By default field with struct types of zero values are processed too. We
- // can stop processing them via "omitempty" tag option.
- type Server struct {
- Name string `structs:",omitempty"`
- ID int32 `structs:"server_id,omitempty"`
- Location string
- }
-
- // Only add location
- s := &Server{
- Location: "Ankara",
- }
-
- m := Values(s)
-
- // values contains only the Location field
- fmt.Printf("Values: %+v\n", m)
- // Output:
- // Values: [Ankara]
-}
-
-func ExampleValues_tags() {
- type Location struct {
- City string
- Country string
- }
-
- type Server struct {
- Name string
- ID int32
- Enabled bool
- Location Location `structs:"-"` // values from location are not included anymore
- }
-
- s := &Server{
- Name: "Fatih",
- ID: 135790,
- Enabled: false,
- Location: Location{City: "Ankara", Country: "Turkey"},
- }
-
- // Let get all values from the struct s. Note that we don't include values
- // from the Location field
- m := Values(s)
-
- fmt.Printf("Values: %+v\n", m)
- // Output:
- // Values: [Fatih 135790 false]
-}
-
-func ExampleFields() {
- type Access struct {
- Name string
- LastAccessed time.Time
- Number int
- }
-
- s := &Access{
- Name: "Fatih",
- LastAccessed: time.Now(),
- Number: 1234567,
- }
-
- fields := Fields(s)
-
- for i, field := range fields {
- fmt.Printf("[%d] %+v\n", i, field.Name())
- }
-
- // Output:
- // [0] Name
- // [1] LastAccessed
- // [2] Number
-}
-
-func ExampleFields_nested() {
- type Person struct {
- Name string
- Number int
- }
-
- type Access struct {
- Person Person
- HasPermission bool
- LastAccessed time.Time
- }
-
- s := &Access{
- Person: Person{Name: "fatih", Number: 1234567},
- LastAccessed: time.Now(),
- HasPermission: true,
- }
-
- // Let's get all fields from the struct s.
- fields := Fields(s)
-
- for _, field := range fields {
- if field.Name() == "Person" {
- fmt.Printf("Access.Person.Name: %+v\n", field.Field("Name").Value())
- }
- }
-
- // Output:
- // Access.Person.Name: fatih
-}
-
-func ExampleField() {
- type Person struct {
- Name string
- Number int
- }
-
- type Access struct {
- Person Person
- HasPermission bool
- LastAccessed time.Time
- }
-
- access := &Access{
- Person: Person{Name: "fatih", Number: 1234567},
- LastAccessed: time.Now(),
- HasPermission: true,
- }
-
- // Create a new Struct type
- s := New(access)
-
- // Get the Field type for "Person" field
- p := s.Field("Person")
-
- // Get the underlying "Name field" and print the value of it
- name := p.Field("Name")
-
- fmt.Printf("Value of Person.Access.Name: %+v\n", name.Value())
-
- // Output:
- // Value of Person.Access.Name: fatih
-
-}
-
-func ExampleIsZero() {
- type Server struct {
- Name string
- ID int32
- Enabled bool
- }
-
- // Nothing is initalized
- a := &Server{}
- isZeroA := IsZero(a)
-
- // Name and Enabled is initialized, but not ID
- b := &Server{
- Name: "Golang",
- Enabled: true,
- }
- isZeroB := IsZero(b)
-
- fmt.Printf("%#v\n", isZeroA)
- fmt.Printf("%#v\n", isZeroB)
- // Output:
- // true
- // false
-}
-
-func ExampleHasZero() {
- // Let's define an Access struct. Note that the "Enabled" field is not
- // going to be checked because we added the "structs" tag to the field.
- type Access struct {
- Name string
- LastAccessed time.Time
- Number int
- Enabled bool `structs:"-"`
- }
-
- // Name and Number is not initialized.
- a := &Access{
- LastAccessed: time.Now(),
- }
- hasZeroA := HasZero(a)
-
- // Name and Number is initialized.
- b := &Access{
- Name: "Fatih",
- LastAccessed: time.Now(),
- Number: 12345,
- }
- hasZeroB := HasZero(b)
-
- fmt.Printf("%#v\n", hasZeroA)
- fmt.Printf("%#v\n", hasZeroB)
- // Output:
- // true
- // false
-}
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/structs_test.go b/Godeps/_workspace/src/github.com/fatih/structs/structs_test.go
deleted file mode 100644
index 14e3de72..00000000
--- a/Godeps/_workspace/src/github.com/fatih/structs/structs_test.go
+++ /dev/null
@@ -1,898 +0,0 @@
-package structs
-
-import (
- "fmt"
- "reflect"
- "testing"
- "time"
-)
-
-func TestMapNonStruct(t *testing.T) {
- foo := []string{"foo"}
-
- defer func() {
- err := recover()
- if err == nil {
- t.Error("Passing a non struct into Map should panic")
- }
- }()
-
- // this should panic. We are going to recover and and test it
- _ = Map(foo)
-}
-
-func TestStructIndexes(t *testing.T) {
- type C struct {
- something int
- Props map[string]interface{}
- }
-
- defer func() {
- err := recover()
- if err != nil {
- fmt.Printf("err %+v\n", err)
- t.Error("Using mixed indexes should not panic")
- }
- }()
-
- // They should not panic
- _ = Map(&C{})
- _ = Fields(&C{})
- _ = Values(&C{})
- _ = IsZero(&C{})
- _ = HasZero(&C{})
-}
-
-func TestMap(t *testing.T) {
- var T = struct {
- A string
- B int
- C bool
- }{
- A: "a-value",
- B: 2,
- C: true,
- }
-
- a := Map(T)
-
- if typ := reflect.TypeOf(a).Kind(); typ != reflect.Map {
- t.Errorf("Map should return a map type, got: %v", typ)
- }
-
- // we have three fields
- if len(a) != 3 {
- t.Errorf("Map should return a map of len 3, got: %d", len(a))
- }
-
- inMap := func(val interface{}) bool {
- for _, v := range a {
- if reflect.DeepEqual(v, val) {
- return true
- }
- }
-
- return false
- }
-
- for _, val := range []interface{}{"a-value", 2, true} {
- if !inMap(val) {
- t.Errorf("Map should have the value %v", val)
- }
- }
-
-}
-
-func TestMap_Tag(t *testing.T) {
- var T = struct {
- A string `structs:"x"`
- B int `structs:"y"`
- C bool `structs:"z"`
- }{
- A: "a-value",
- B: 2,
- C: true,
- }
-
- a := Map(T)
-
- inMap := func(key interface{}) bool {
- for k := range a {
- if reflect.DeepEqual(k, key) {
- return true
- }
- }
- return false
- }
-
- for _, key := range []string{"x", "y", "z"} {
- if !inMap(key) {
- t.Errorf("Map should have the key %v", key)
- }
- }
-
-}
-
-func TestMap_CustomTag(t *testing.T) {
- var T = struct {
- A string `json:"x"`
- B int `json:"y"`
- C bool `json:"z"`
- D struct {
- E string `json:"jkl"`
- } `json:"nested"`
- }{
- A: "a-value",
- B: 2,
- C: true,
- }
- T.D.E = "e-value"
-
- s := New(T)
- s.TagName = "json"
-
- a := s.Map()
-
- inMap := func(key interface{}) bool {
- for k := range a {
- if reflect.DeepEqual(k, key) {
- return true
- }
- }
- return false
- }
-
- for _, key := range []string{"x", "y", "z"} {
- if !inMap(key) {
- t.Errorf("Map should have the key %v", key)
- }
- }
-
- nested, ok := a["nested"].(map[string]interface{})
- if !ok {
- t.Fatalf("Map should contain the D field that is tagged as 'nested'")
- }
-
- e, ok := nested["jkl"].(string)
- if !ok {
- t.Fatalf("Map should contain the D.E field that is tagged as 'jkl'")
- }
-
- if e != "e-value" {
- t.Errorf("D.E field should be equal to 'e-value', got: '%v'", e)
- }
-
-}
-
-func TestMap_MultipleCustomTag(t *testing.T) {
- var A = struct {
- X string `aa:"ax"`
- }{"a_value"}
-
- aStruct := New(A)
- aStruct.TagName = "aa"
-
- var B = struct {
- X string `bb:"bx"`
- }{"b_value"}
-
- bStruct := New(B)
- bStruct.TagName = "bb"
-
- a, b := aStruct.Map(), bStruct.Map()
- if !reflect.DeepEqual(a, map[string]interface{}{"ax": "a_value"}) {
- t.Error("Map should have field ax with value a_value")
- }
-
- if !reflect.DeepEqual(b, map[string]interface{}{"bx": "b_value"}) {
- t.Error("Map should have field bx with value b_value")
- }
-}
-
-func TestMap_OmitEmpty(t *testing.T) {
- type A struct {
- Name string
- Value string `structs:",omitempty"`
- Time time.Time `structs:",omitempty"`
- }
- a := A{}
-
- m := Map(a)
-
- _, ok := m["Value"].(map[string]interface{})
- if ok {
- t.Error("Map should not contain the Value field that is tagged as omitempty")
- }
-
- _, ok = m["Time"].(map[string]interface{})
- if ok {
- t.Error("Map should not contain the Time field that is tagged as omitempty")
- }
-}
-
-func TestMap_OmitNested(t *testing.T) {
- type A struct {
- Name string
- Value string
- Time time.Time `structs:",omitnested"`
- }
- a := A{Time: time.Now()}
-
- type B struct {
- Desc string
- A A
- }
- b := &B{A: a}
-
- m := Map(b)
-
- in, ok := m["A"].(map[string]interface{})
- if !ok {
- t.Error("Map nested structs is not available in the map")
- }
-
- // should not happen
- if _, ok := in["Time"].(map[string]interface{}); ok {
- t.Error("Map nested struct should omit recursiving parsing of Time")
- }
-
- if _, ok := in["Time"].(time.Time); !ok {
- t.Error("Map nested struct should stop parsing of Time at is current value")
- }
-}
-
-func TestMap_Nested(t *testing.T) {
- type A struct {
- Name string
- }
- a := &A{Name: "example"}
-
- type B struct {
- A *A
- }
- b := &B{A: a}
-
- m := Map(b)
-
- if typ := reflect.TypeOf(m).Kind(); typ != reflect.Map {
- t.Errorf("Map should return a map type, got: %v", typ)
- }
-
- in, ok := m["A"].(map[string]interface{})
- if !ok {
- t.Error("Map nested structs is not available in the map")
- }
-
- if name := in["Name"].(string); name != "example" {
- t.Errorf("Map nested struct's name field should give example, got: %s", name)
- }
-}
-
-func TestMap_Anonymous(t *testing.T) {
- type A struct {
- Name string
- }
- a := &A{Name: "example"}
-
- type B struct {
- *A
- }
- b := &B{}
- b.A = a
-
- m := Map(b)
-
- if typ := reflect.TypeOf(m).Kind(); typ != reflect.Map {
- t.Errorf("Map should return a map type, got: %v", typ)
- }
-
- in, ok := m["A"].(map[string]interface{})
- if !ok {
- t.Error("Embedded structs is not available in the map")
- }
-
- if name := in["Name"].(string); name != "example" {
- t.Errorf("Embedded A struct's Name field should give example, got: %s", name)
- }
-}
-
-func TestStruct(t *testing.T) {
- var T = struct{}{}
-
- if !IsStruct(T) {
- t.Errorf("T should be a struct, got: %T", T)
- }
-
- if !IsStruct(&T) {
- t.Errorf("T should be a struct, got: %T", T)
- }
-
-}
-
-func TestValues(t *testing.T) {
- var T = struct {
- A string
- B int
- C bool
- }{
- A: "a-value",
- B: 2,
- C: true,
- }
-
- s := Values(T)
-
- if typ := reflect.TypeOf(s).Kind(); typ != reflect.Slice {
- t.Errorf("Values should return a slice type, got: %v", typ)
- }
-
- inSlice := func(val interface{}) bool {
- for _, v := range s {
- if reflect.DeepEqual(v, val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []interface{}{"a-value", 2, true} {
- if !inSlice(val) {
- t.Errorf("Values should have the value %v", val)
- }
- }
-}
-
-func TestValues_OmitEmpty(t *testing.T) {
- type A struct {
- Name string
- Value int `structs:",omitempty"`
- }
-
- a := A{Name: "example"}
- s := Values(a)
-
- if len(s) != 1 {
- t.Errorf("Values of omitted empty fields should be not counted")
- }
-
- if s[0].(string) != "example" {
- t.Errorf("Values of omitted empty fields should left the value example")
- }
-}
-
-func TestValues_OmitNested(t *testing.T) {
- type A struct {
- Name string
- Value int
- }
-
- a := A{
- Name: "example",
- Value: 123,
- }
-
- type B struct {
- A A `structs:",omitnested"`
- C int
- }
- b := &B{A: a, C: 123}
-
- s := Values(b)
-
- if len(s) != 2 {
- t.Errorf("Values of omitted nested struct should be not counted")
- }
-
- inSlice := func(val interface{}) bool {
- for _, v := range s {
- if reflect.DeepEqual(v, val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []interface{}{123, a} {
- if !inSlice(val) {
- t.Errorf("Values should have the value %v", val)
- }
- }
-}
-
-func TestValues_Nested(t *testing.T) {
- type A struct {
- Name string
- }
- a := A{Name: "example"}
-
- type B struct {
- A A
- C int
- }
- b := &B{A: a, C: 123}
-
- s := Values(b)
-
- inSlice := func(val interface{}) bool {
- for _, v := range s {
- if reflect.DeepEqual(v, val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []interface{}{"example", 123} {
- if !inSlice(val) {
- t.Errorf("Values should have the value %v", val)
- }
- }
-}
-
-func TestValues_Anonymous(t *testing.T) {
- type A struct {
- Name string
- }
- a := A{Name: "example"}
-
- type B struct {
- A
- C int
- }
- b := &B{C: 123}
- b.A = a
-
- s := Values(b)
-
- inSlice := func(val interface{}) bool {
- for _, v := range s {
- if reflect.DeepEqual(v, val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []interface{}{"example", 123} {
- if !inSlice(val) {
- t.Errorf("Values should have the value %v", val)
- }
- }
-}
-
-func TestNames(t *testing.T) {
- var T = struct {
- A string
- B int
- C bool
- }{
- A: "a-value",
- B: 2,
- C: true,
- }
-
- s := Names(T)
-
- if len(s) != 3 {
- t.Errorf("Names should return a slice of len 3, got: %d", len(s))
- }
-
- inSlice := func(val string) bool {
- for _, v := range s {
- if reflect.DeepEqual(v, val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []string{"A", "B", "C"} {
- if !inSlice(val) {
- t.Errorf("Names should have the value %v", val)
- }
- }
-}
-
-func TestFields(t *testing.T) {
- var T = struct {
- A string
- B int
- C bool
- }{
- A: "a-value",
- B: 2,
- C: true,
- }
-
- s := Fields(T)
-
- if len(s) != 3 {
- t.Errorf("Fields should return a slice of len 3, got: %d", len(s))
- }
-
- inSlice := func(val string) bool {
- for _, v := range s {
- if reflect.DeepEqual(v.Name(), val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []string{"A", "B", "C"} {
- if !inSlice(val) {
- t.Errorf("Fields should have the value %v", val)
- }
- }
-}
-
-func TestFields_OmitNested(t *testing.T) {
- type A struct {
- Name string
- Enabled bool
- }
- a := A{Name: "example"}
-
- type B struct {
- A A
- C int
- Value string `structs:"-"`
- Number int
- }
- b := &B{A: a, C: 123}
-
- s := Fields(b)
-
- if len(s) != 3 {
- t.Errorf("Fields should omit nested struct. Expecting 2 got: %d", len(s))
- }
-
- inSlice := func(val interface{}) bool {
- for _, v := range s {
- if reflect.DeepEqual(v.Name(), val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []interface{}{"A", "C"} {
- if !inSlice(val) {
- t.Errorf("Fields should have the value %v", val)
- }
- }
-}
-
-func TestFields_Anonymous(t *testing.T) {
- type A struct {
- Name string
- }
- a := A{Name: "example"}
-
- type B struct {
- A
- C int
- }
- b := &B{C: 123}
- b.A = a
-
- s := Fields(b)
-
- inSlice := func(val interface{}) bool {
- for _, v := range s {
- if reflect.DeepEqual(v.Name(), val) {
- return true
- }
- }
- return false
- }
-
- for _, val := range []interface{}{"A", "C"} {
- if !inSlice(val) {
- t.Errorf("Fields should have the value %v", val)
- }
- }
-}
-
-func TestIsZero(t *testing.T) {
- var T = struct {
- A string
- B int
- C bool `structs:"-"`
- D []string
- }{}
-
- ok := IsZero(T)
- if !ok {
- t.Error("IsZero should return true because none of the fields are initialized.")
- }
-
- var X = struct {
- A string
- F *bool
- }{
- A: "a-value",
- }
-
- ok = IsZero(X)
- if ok {
- t.Error("IsZero should return false because A is initialized")
- }
-
- var Y = struct {
- A string
- B int
- }{
- A: "a-value",
- B: 123,
- }
-
- ok = IsZero(Y)
- if ok {
- t.Error("IsZero should return false because A and B is initialized")
- }
-}
-
-func TestIsZero_OmitNested(t *testing.T) {
- type A struct {
- Name string
- D string
- }
- a := A{Name: "example"}
-
- type B struct {
- A A `structs:",omitnested"`
- C int
- }
- b := &B{A: a, C: 123}
-
- ok := IsZero(b)
- if ok {
- t.Error("IsZero should return false because A, B and C are initialized")
- }
-
- aZero := A{}
- bZero := &B{A: aZero}
-
- ok = IsZero(bZero)
- if !ok {
- t.Error("IsZero should return true because neither A nor B is initialized")
- }
-
-}
-
-func TestIsZero_Nested(t *testing.T) {
- type A struct {
- Name string
- D string
- }
- a := A{Name: "example"}
-
- type B struct {
- A A
- C int
- }
- b := &B{A: a, C: 123}
-
- ok := IsZero(b)
- if ok {
- t.Error("IsZero should return false because A, B and C are initialized")
- }
-
- aZero := A{}
- bZero := &B{A: aZero}
-
- ok = IsZero(bZero)
- if !ok {
- t.Error("IsZero should return true because neither A nor B is initialized")
- }
-
-}
-
-func TestIsZero_Anonymous(t *testing.T) {
- type A struct {
- Name string
- D string
- }
- a := A{Name: "example"}
-
- type B struct {
- A
- C int
- }
- b := &B{C: 123}
- b.A = a
-
- ok := IsZero(b)
- if ok {
- t.Error("IsZero should return false because A, B and C are initialized")
- }
-
- aZero := A{}
- bZero := &B{}
- bZero.A = aZero
-
- ok = IsZero(bZero)
- if !ok {
- t.Error("IsZero should return true because neither A nor B is initialized")
- }
-}
-
-func TestHasZero(t *testing.T) {
- var T = struct {
- A string
- B int
- C bool `structs:"-"`
- D []string
- }{
- A: "a-value",
- B: 2,
- }
-
- ok := HasZero(T)
- if !ok {
- t.Error("HasZero should return true because A and B are initialized.")
- }
-
- var X = struct {
- A string
- F *bool
- }{
- A: "a-value",
- }
-
- ok = HasZero(X)
- if !ok {
- t.Error("HasZero should return true because A is initialized")
- }
-
- var Y = struct {
- A string
- B int
- }{
- A: "a-value",
- B: 123,
- }
-
- ok = HasZero(Y)
- if ok {
- t.Error("HasZero should return false because A and B is initialized")
- }
-}
-
-func TestHasZero_OmitNested(t *testing.T) {
- type A struct {
- Name string
- D string
- }
- a := A{Name: "example"}
-
- type B struct {
- A A `structs:",omitnested"`
- C int
- }
- b := &B{A: a, C: 123}
-
- // Because the Field A inside B is omitted HasZero should return false
- // because it will stop iterating deeper andnot going to lookup for D
- ok := HasZero(b)
- if ok {
- t.Error("HasZero should return false because A and C are initialized")
- }
-}
-
-func TestHasZero_Nested(t *testing.T) {
- type A struct {
- Name string
- D string
- }
- a := A{Name: "example"}
-
- type B struct {
- A A
- C int
- }
- b := &B{A: a, C: 123}
-
- ok := HasZero(b)
- if !ok {
- t.Error("HasZero should return true because D is not initialized")
- }
-}
-
-func TestHasZero_Anonymous(t *testing.T) {
- type A struct {
- Name string
- D string
- }
- a := A{Name: "example"}
-
- type B struct {
- A
- C int
- }
- b := &B{C: 123}
- b.A = a
-
- ok := HasZero(b)
- if !ok {
- t.Error("HasZero should return false because D is not initialized")
- }
-}
-
-func TestName(t *testing.T) {
- type Foo struct {
- A string
- B bool
- }
- f := &Foo{}
-
- n := Name(f)
- if n != "Foo" {
- t.Errorf("Name should return Foo, got: %s", n)
- }
-
- unnamed := struct{ Name string }{Name: "Cihangir"}
- m := Name(unnamed)
- if m != "" {
- t.Errorf("Name should return empty string for unnamed struct, got: %s", n)
- }
-
- defer func() {
- err := recover()
- if err == nil {
- t.Error("Name should panic if a non struct is passed")
- }
- }()
-
- Name([]string{})
-}
-
-func TestNestedNilPointer(t *testing.T) {
- type Collar struct {
- Engraving string
- }
-
- type Dog struct {
- Name string
- Collar *Collar
- }
-
- type Person struct {
- Name string
- Dog *Dog
- }
-
- person := &Person{
- Name: "John",
- }
-
- personWithDog := &Person{
- Name: "Ron",
- Dog: &Dog{
- Name: "Rover",
- },
- }
-
- personWithDogWithCollar := &Person{
- Name: "Kon",
- Dog: &Dog{
- Name: "Ruffles",
- Collar: &Collar{
- Engraving: "If lost, call Kon",
- },
- },
- }
-
- defer func() {
- err := recover()
- if err != nil {
- fmt.Printf("err %+v\n", err)
- t.Error("Internal nil pointer should not panic")
- }
- }()
-
- _ = Map(person) // Panics
- _ = Map(personWithDog) // Panics
- _ = Map(personWithDogWithCollar) // Doesn't panic
-}
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/tags_test.go b/Godeps/_workspace/src/github.com/fatih/structs/tags_test.go
deleted file mode 100644
index 5d12724f..00000000
--- a/Godeps/_workspace/src/github.com/fatih/structs/tags_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package structs
-
-import "testing"
-
-func TestParseTag_Name(t *testing.T) {
- tags := []struct {
- tag string
- has bool
- }{
- {"", false},
- {"name", true},
- {"name,opt", true},
- {"name , opt, opt2", false}, // has a single whitespace
- {", opt, opt2", false},
- }
-
- for _, tag := range tags {
- name, _ := parseTag(tag.tag)
-
- if (name != "name") && tag.has {
- t.Errorf("Parse tag should return name: %#v", tag)
- }
- }
-}
-
-func TestParseTag_Opts(t *testing.T) {
- tags := []struct {
- opts string
- has bool
- }{
- {"name", false},
- {"name,opt", true},
- {"name , opt, opt2", false}, // has a single whitespace
- {",opt, opt2", true},
- {", opt3, opt4", false},
- }
-
- // search for "opt"
- for _, tag := range tags {
- _, opts := parseTag(tag.opts)
-
- if opts.Has("opt") != tag.has {
- t.Errorf("Tag opts should have opt: %#v", tag)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/cli/.travis.yml b/Godeps/_workspace/src/github.com/minio/cli/.travis.yml
deleted file mode 100644
index baf46abc..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-language: go
-go: 1.1
-
-script:
-- go vet ./...
-- go test -v ./...
diff --git a/Godeps/_workspace/src/github.com/minio/cli/app_test.go b/Godeps/_workspace/src/github.com/minio/cli/app_test.go
deleted file mode 100644
index 98653c42..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/app_test.go
+++ /dev/null
@@ -1,587 +0,0 @@
-package cli_test
-
-import (
- "flag"
- "fmt"
- "os"
- "testing"
-
- "github.com/minio/cli"
-)
-
-func ExampleApp() {
- // set args for examples sake
- os.Args = []string{"greet", "--name", "Jeremy"}
-
- app := cli.NewApp()
- app.Name = "greet"
- app.Flags = []cli.Flag{
- cli.StringFlag{Name: "name", Value: "bob", Usage: "a name to say"},
- }
- app.Action = func(c *cli.Context) {
- fmt.Printf("Hello %v\n", c.String("name"))
- }
- app.Author = "Harrison"
- app.Email = "harrison@lolwut.com"
- app.Authors = []cli.Author{{Name: "Oliver Allen", Email: "oliver@toyshop.com"}}
- app.Run(os.Args)
- // Output:
- // Hello Jeremy
-}
-
-func ExampleAppSubcommand() {
- // set args for examples sake
- os.Args = []string{"say", "hi", "english", "--name", "Jeremy"}
- app := cli.NewApp()
- app.Name = "say"
- app.Commands = []cli.Command{
- {
- Name: "hello",
- Aliases: []string{"hi"},
- Usage: "use it to see a description",
- Description: "This is how we describe hello the function",
- Subcommands: []cli.Command{
- {
- Name: "english",
- Aliases: []string{"en"},
- Usage: "sends a greeting in english",
- Description: "greets someone in english",
- Flags: []cli.Flag{
- cli.StringFlag{
- Name: "name",
- Value: "Bob",
- Usage: "Name of the person to greet",
- },
- },
- Action: func(c *cli.Context) {
- fmt.Println("Hello,", c.String("name"))
- },
- },
- },
- },
- }
-
- app.Run(os.Args)
- // Output:
- // Hello, Jeremy
-}
-
-func ExampleAppHelp() {
- // set args for examples sake
- os.Args = []string{"greet", "h", "describeit"}
-
- app := cli.NewApp()
- app.Name = "greet"
- app.Flags = []cli.Flag{
- cli.StringFlag{Name: "name", Value: "bob", Usage: "a name to say"},
- }
- app.Commands = []cli.Command{
- {
- Name: "describeit",
- Aliases: []string{"d"},
- Usage: "use it to see a description",
- Description: "This is how we describe describeit the function",
- Action: func(c *cli.Context) {
- fmt.Printf("i like to describe things")
- },
- },
- }
- app.Run(os.Args)
- // Output:
- // NAME:
- // describeit - use it to see a description
- //
- // USAGE:
- // command describeit [arguments...]
- //
- // DESCRIPTION:
- // This is how we describe describeit the function
-}
-
-func TestApp_Run(t *testing.T) {
- s := ""
-
- app := cli.NewApp()
- app.Action = func(c *cli.Context) {
- s = s + c.Args().First()
- }
-
- err := app.Run([]string{"command", "foo"})
- expect(t, err, nil)
- err = app.Run([]string{"command", "bar"})
- expect(t, err, nil)
- expect(t, s, "foobar")
-}
-
-var commandAppTests = []struct {
- name string
- expected bool
-}{
- {"foobar", true},
- {"batbaz", true},
- {"b", true},
- {"f", true},
- {"bat", false},
- {"nothing", false},
-}
-
-func TestApp_Command(t *testing.T) {
- app := cli.NewApp()
- fooCommand := cli.Command{Name: "foobar", Aliases: []string{"f"}}
- batCommand := cli.Command{Name: "batbaz", Aliases: []string{"b"}}
- app.Commands = []cli.Command{
- fooCommand,
- batCommand,
- }
-
- for _, test := range commandAppTests {
- expect(t, app.Command(test.name) != nil, test.expected)
- }
-}
-
-func TestApp_CommandWithArgBeforeFlags(t *testing.T) {
- var parsedOption, firstArg string
-
- app := cli.NewApp()
- command := cli.Command{
- Name: "cmd",
- Flags: []cli.Flag{
- cli.StringFlag{Name: "option", Value: "", Usage: "some option"},
- },
- Action: func(c *cli.Context) {
- parsedOption = c.String("option")
- firstArg = c.Args().First()
- },
- }
- app.Commands = []cli.Command{command}
-
- app.Run([]string{"", "cmd", "my-arg", "--option", "my-option"})
-
- expect(t, parsedOption, "my-option")
- expect(t, firstArg, "my-arg")
-}
-
-func TestApp_RunAsSubcommandParseFlags(t *testing.T) {
- var context *cli.Context
-
- a := cli.NewApp()
- a.Commands = []cli.Command{
- {
- Name: "foo",
- Action: func(c *cli.Context) {
- context = c
- },
- Flags: []cli.Flag{
- cli.StringFlag{
- Name: "lang",
- Value: "english",
- Usage: "language for the greeting",
- },
- },
- Before: func(_ *cli.Context) error { return nil },
- },
- }
- a.Run([]string{"", "foo", "--lang", "spanish", "abcd"})
-
- expect(t, context.Args().Get(0), "abcd")
- expect(t, context.String("lang"), "spanish")
-}
-
-func TestApp_CommandWithFlagBeforeTerminator(t *testing.T) {
- var parsedOption string
- var args []string
-
- app := cli.NewApp()
- command := cli.Command{
- Name: "cmd",
- Flags: []cli.Flag{
- cli.StringFlag{Name: "option", Value: "", Usage: "some option"},
- },
- Action: func(c *cli.Context) {
- parsedOption = c.String("option")
- args = c.Args()
- },
- }
- app.Commands = []cli.Command{command}
-
- app.Run([]string{"", "cmd", "my-arg", "--option", "my-option", "--", "--notARealFlag"})
-
- expect(t, parsedOption, "my-option")
- expect(t, args[0], "my-arg")
- expect(t, args[1], "--")
- expect(t, args[2], "--notARealFlag")
-}
-
-func TestApp_CommandWithNoFlagBeforeTerminator(t *testing.T) {
- var args []string
-
- app := cli.NewApp()
- command := cli.Command{
- Name: "cmd",
- Action: func(c *cli.Context) {
- args = c.Args()
- },
- }
- app.Commands = []cli.Command{command}
-
- app.Run([]string{"", "cmd", "my-arg", "--", "notAFlagAtAll"})
-
- expect(t, args[0], "my-arg")
- expect(t, args[1], "--")
- expect(t, args[2], "notAFlagAtAll")
-}
-
-func TestApp_Float64Flag(t *testing.T) {
- var meters float64
-
- app := cli.NewApp()
- app.Flags = []cli.Flag{
- cli.Float64Flag{Name: "height", Value: 1.5, Usage: "Set the height, in meters"},
- }
- app.Action = func(c *cli.Context) {
- meters = c.Float64("height")
- }
-
- app.Run([]string{"", "--height", "1.93"})
- expect(t, meters, 1.93)
-}
-
-func TestApp_ParseSliceFlags(t *testing.T) {
- var parsedOption, firstArg string
- var parsedIntSlice []int
- var parsedStringSlice []string
-
- app := cli.NewApp()
- command := cli.Command{
- Name: "cmd",
- Flags: []cli.Flag{
- cli.IntSliceFlag{Name: "p", Value: &cli.IntSlice{}, Usage: "set one or more ip addr"},
- cli.StringSliceFlag{Name: "ip", Value: &cli.StringSlice{}, Usage: "set one or more ports to open"},
- },
- Action: func(c *cli.Context) {
- parsedIntSlice = c.IntSlice("p")
- parsedStringSlice = c.StringSlice("ip")
- parsedOption = c.String("option")
- firstArg = c.Args().First()
- },
- }
- app.Commands = []cli.Command{command}
-
- app.Run([]string{"", "cmd", "my-arg", "-p", "22", "-p", "80", "-ip", "8.8.8.8", "-ip", "8.8.4.4"})
-
- IntsEquals := func(a, b []int) bool {
- if len(a) != len(b) {
- return false
- }
- for i, v := range a {
- if v != b[i] {
- return false
- }
- }
- return true
- }
-
- StrsEquals := func(a, b []string) bool {
- if len(a) != len(b) {
- return false
- }
- for i, v := range a {
- if v != b[i] {
- return false
- }
- }
- return true
- }
- var expectedIntSlice = []int{22, 80}
- var expectedStringSlice = []string{"8.8.8.8", "8.8.4.4"}
-
- if !IntsEquals(parsedIntSlice, expectedIntSlice) {
- t.Errorf("%v does not match %v", parsedIntSlice, expectedIntSlice)
- }
-
- if !StrsEquals(parsedStringSlice, expectedStringSlice) {
- t.Errorf("%v does not match %v", parsedStringSlice, expectedStringSlice)
- }
-}
-
-func TestApp_DefaultStdout(t *testing.T) {
- app := cli.NewApp()
-
- if app.Writer != os.Stdout {
- t.Error("Default output writer not set.")
- }
-}
-
-type mockWriter struct {
- written []byte
-}
-
-func (fw *mockWriter) Write(p []byte) (n int, err error) {
- if fw.written == nil {
- fw.written = p
- } else {
- fw.written = append(fw.written, p...)
- }
-
- return len(p), nil
-}
-
-func (fw *mockWriter) GetWritten() (b []byte) {
- return fw.written
-}
-
-func TestApp_SetStdout(t *testing.T) {
- w := &mockWriter{}
-
- app := cli.NewApp()
- app.Name = "test"
- app.Writer = w
-
- err := app.Run([]string{"help"})
-
- if err != nil {
- t.Fatalf("Run error: %s", err)
- }
-
- if len(w.written) == 0 {
- t.Error("App did not write output to desired writer.")
- }
-}
-
-func TestApp_BeforeFunc(t *testing.T) {
- beforeRun, subcommandRun := false, false
- beforeError := fmt.Errorf("fail")
- var err error
-
- app := cli.NewApp()
-
- app.Before = func(c *cli.Context) error {
- beforeRun = true
- s := c.String("opt")
- if s == "fail" {
- return beforeError
- }
-
- return nil
- }
-
- app.Commands = []cli.Command{
- {
- Name: "sub",
- Action: func(c *cli.Context) {
- subcommandRun = true
- },
- },
- }
-
- app.Flags = []cli.Flag{
- cli.StringFlag{Name: "opt"},
- }
-
- // run with the Before() func succeeding
- err = app.Run([]string{"command", "--opt", "succeed", "sub"})
-
- if err != nil {
- t.Fatalf("Run error: %s", err)
- }
-
- if beforeRun == false {
- t.Errorf("Before() not executed when expected")
- }
-
- if subcommandRun == false {
- t.Errorf("Subcommand not executed when expected")
- }
-
- // reset
- beforeRun, subcommandRun = false, false
-
- // run with the Before() func failing
- err = app.Run([]string{"command", "--opt", "fail", "sub"})
-
- // should be the same error produced by the Before func
- if err != beforeError {
- t.Errorf("Run error expected, but not received")
- }
-
- if beforeRun == false {
- t.Errorf("Before() not executed when expected")
- }
-
- if subcommandRun == true {
- t.Errorf("Subcommand executed when NOT expected")
- }
-
-}
-
-func TestApp_AfterFunc(t *testing.T) {
- afterRun, subcommandRun := false, false
- afterError := fmt.Errorf("fail")
- var err error
-
- app := cli.NewApp()
-
- app.After = func(c *cli.Context) error {
- afterRun = true
- s := c.String("opt")
- if s == "fail" {
- return afterError
- }
-
- return nil
- }
-
- app.Commands = []cli.Command{
- {
- Name: "sub",
- Action: func(c *cli.Context) {
- subcommandRun = true
- },
- },
- }
-
- app.Flags = []cli.Flag{
- cli.StringFlag{Name: "opt"},
- }
-
- // run with the After() func succeeding
- err = app.Run([]string{"command", "--opt", "succeed", "sub"})
-
- if err != nil {
- t.Fatalf("Run error: %s", err)
- }
-
- if afterRun == false {
- t.Errorf("After() not executed when expected")
- }
-
- if subcommandRun == false {
- t.Errorf("Subcommand not executed when expected")
- }
-
- // reset
- afterRun, subcommandRun = false, false
-
- // run with the Before() func failing
- err = app.Run([]string{"command", "--opt", "fail", "sub"})
-
- // should be the same error produced by the Before func
- if err != afterError {
- t.Errorf("Run error expected, but not received")
- }
-
- if afterRun == false {
- t.Errorf("After() not executed when expected")
- }
-
- if subcommandRun == false {
- t.Errorf("Subcommand not executed when expected")
- }
-}
-
-func TestAppNoHelpFlag(t *testing.T) {
- oldFlag := cli.HelpFlag
- defer func() {
- cli.HelpFlag = oldFlag
- }()
-
- cli.HelpFlag = cli.BoolFlag{}
-
- app := cli.NewApp()
- err := app.Run([]string{"test", "-h"})
-
- if err != flag.ErrHelp {
- t.Errorf("expected error about missing help flag, but got: %s (%T)", err, err)
- }
-}
-
-func TestAppHelpPrinter(t *testing.T) {
- oldPrinter := cli.HelpPrinter
- defer func() {
- cli.HelpPrinter = oldPrinter
- }()
-
- var wasCalled = false
- cli.HelpPrinter = func(template string, data interface{}) {
- wasCalled = true
- }
-
- app := cli.NewApp()
- app.Run([]string{"-h"})
-
- if wasCalled == false {
- t.Errorf("Help printer expected to be called, but was not")
- }
-}
-
-func TestAppVersionPrinter(t *testing.T) {
- oldPrinter := cli.VersionPrinter
- defer func() {
- cli.VersionPrinter = oldPrinter
- }()
-
- var wasCalled = false
- cli.VersionPrinter = func(c *cli.Context) {
- wasCalled = true
- }
-
- app := cli.NewApp()
- ctx := cli.NewContext(app, nil, nil)
- cli.ShowVersion(ctx)
-
- if wasCalled == false {
- t.Errorf("Version printer expected to be called, but was not")
- }
-}
-
-func TestAppCommandNotFound(t *testing.T) {
- beforeRun, subcommandRun := false, false
- app := cli.NewApp()
-
- app.CommandNotFound = func(c *cli.Context, command string) {
- beforeRun = true
- }
-
- app.Commands = []cli.Command{
- {
- Name: "bar",
- Action: func(c *cli.Context) {
- subcommandRun = true
- },
- },
- }
-
- app.Run([]string{"command", "foo"})
-
- expect(t, beforeRun, true)
- expect(t, subcommandRun, false)
-}
-
-func TestGlobalFlagsInSubcommands(t *testing.T) {
- subcommandRun := false
- app := cli.NewApp()
-
- app.Flags = []cli.Flag{
- cli.BoolFlag{Name: "debug, d", Usage: "Enable debugging"},
- }
-
- app.Commands = []cli.Command{
- {
- Name: "foo",
- Subcommands: []cli.Command{
- {
- Name: "bar",
- Action: func(c *cli.Context) {
- if c.GlobalBool("debug") {
- subcommandRun = true
- }
- },
- },
- },
- },
- }
-
- app.Run([]string{"command", "-d", "foo", "bar"})
-
- expect(t, subcommandRun, true)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/cli/autocomplete/bash_autocomplete b/Godeps/_workspace/src/github.com/minio/cli/autocomplete/bash_autocomplete
deleted file mode 100644
index 9b55dd99..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/autocomplete/bash_autocomplete
+++ /dev/null
@@ -1,13 +0,0 @@
-#! /bin/bash
-
-_cli_bash_autocomplete() {
- local cur prev opts base
- COMPREPLY=()
- cur="${COMP_WORDS[COMP_CWORD]}"
- prev="${COMP_WORDS[COMP_CWORD-1]}"
- opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
- COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
- return 0
- }
-
- complete -F _cli_bash_autocomplete $PROG
\ No newline at end of file
diff --git a/Godeps/_workspace/src/github.com/minio/cli/autocomplete/zsh_autocomplete b/Godeps/_workspace/src/github.com/minio/cli/autocomplete/zsh_autocomplete
deleted file mode 100644
index 5430a18f..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/autocomplete/zsh_autocomplete
+++ /dev/null
@@ -1,5 +0,0 @@
-autoload -U compinit && compinit
-autoload -U bashcompinit && bashcompinit
-
-script_dir=$(dirname $0)
-source ${script_dir}/bash_autocomplete
diff --git a/Godeps/_workspace/src/github.com/minio/cli/cli_test.go b/Godeps/_workspace/src/github.com/minio/cli/cli_test.go
deleted file mode 100644
index c097b3b8..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/cli_test.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package cli_test
-
-import (
- "os"
-
- "github.com/minio/cli"
-)
-
-func Example() {
- app := cli.NewApp()
- app.Name = "todo"
- app.Usage = "task list on the command line"
- app.Commands = []cli.Command{
- {
- Name: "add",
- Aliases: []string{"a"},
- Usage: "add a task to the list",
- Action: func(c *cli.Context) {
- println("added task: ", c.Args().First())
- },
- },
- {
- Name: "complete",
- Aliases: []string{"c"},
- Usage: "complete a task on the list",
- Action: func(c *cli.Context) {
- println("completed task: ", c.Args().First())
- },
- },
- }
-
- app.Run(os.Args)
-}
-
-func ExampleSubcommand() {
- app := cli.NewApp()
- app.Name = "say"
- app.Commands = []cli.Command{
- {
- Name: "hello",
- Aliases: []string{"hi"},
- Usage: "use it to see a description",
- Description: "This is how we describe hello the function",
- Subcommands: []cli.Command{
- {
- Name: "english",
- Aliases: []string{"en"},
- Usage: "sends a greeting in english",
- Description: "greets someone in english",
- Flags: []cli.Flag{
- cli.StringFlag{
- Name: "name",
- Value: "Bob",
- Usage: "Name of the person to greet",
- },
- },
- Action: func(c *cli.Context) {
- println("Hello, ", c.String("name"))
- },
- }, {
- Name: "spanish",
- Aliases: []string{"sp"},
- Usage: "sends a greeting in spanish",
- Flags: []cli.Flag{
- cli.StringFlag{
- Name: "surname",
- Value: "Jones",
- Usage: "Surname of the person to greet",
- },
- },
- Action: func(c *cli.Context) {
- println("Hola, ", c.String("surname"))
- },
- }, {
- Name: "french",
- Aliases: []string{"fr"},
- Usage: "sends a greeting in french",
- Flags: []cli.Flag{
- cli.StringFlag{
- Name: "nickname",
- Value: "Stevie",
- Usage: "Nickname of the person to greet",
- },
- },
- Action: func(c *cli.Context) {
- println("Bonjour, ", c.String("nickname"))
- },
- },
- },
- }, {
- Name: "bye",
- Usage: "says goodbye",
- Action: func(c *cli.Context) {
- println("bye")
- },
- },
- }
-
- app.Run(os.Args)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/cli/command_test.go b/Godeps/_workspace/src/github.com/minio/cli/command_test.go
deleted file mode 100644
index 08adc15d..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/command_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package cli_test
-
-import (
- "flag"
- "testing"
-
- "github.com/minio/cli"
-)
-
-func TestCommandDoNotIgnoreFlags(t *testing.T) {
- app := cli.NewApp()
- set := flag.NewFlagSet("test", 0)
- test := []string{"blah", "blah", "-break"}
- set.Parse(test)
-
- c := cli.NewContext(app, set, set)
-
- command := cli.Command{
- Name: "test-cmd",
- Aliases: []string{"tc"},
- Usage: "this is for testing",
- Description: "testing",
- Action: func(_ *cli.Context) {},
- }
- err := command.Run(c)
-
- expect(t, err.Error(), "flag provided but not defined: -break")
-}
-
-func TestCommandIgnoreFlags(t *testing.T) {
- app := cli.NewApp()
- set := flag.NewFlagSet("test", 0)
- test := []string{"blah", "blah"}
- set.Parse(test)
-
- c := cli.NewContext(app, set, set)
-
- command := cli.Command{
- Name: "test-cmd",
- Aliases: []string{"tc"},
- Usage: "this is for testing",
- Description: "testing",
- Action: func(_ *cli.Context) {},
- SkipFlagParsing: true,
- }
- err := command.Run(c)
-
- expect(t, err, nil)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/cli/context_test.go b/Godeps/_workspace/src/github.com/minio/cli/context_test.go
deleted file mode 100644
index 207161d7..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/context_test.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package cli_test
-
-import (
- "flag"
- "testing"
- "time"
-
- "github.com/minio/cli"
-)
-
-func TestNewContext(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Int("myflag", 12, "doc")
- globalSet := flag.NewFlagSet("test", 0)
- globalSet.Int("myflag", 42, "doc")
- command := cli.Command{Name: "mycommand"}
- c := cli.NewContext(nil, set, globalSet)
- c.Command = command
- expect(t, c.Int("myflag"), 12)
- expect(t, c.GlobalInt("myflag"), 42)
- expect(t, c.Command.Name, "mycommand")
-}
-
-func TestContext_Int(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Int("myflag", 12, "doc")
- c := cli.NewContext(nil, set, set)
- expect(t, c.Int("myflag"), 12)
-}
-
-func TestContext_Duration(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Duration("myflag", time.Duration(12*time.Second), "doc")
- c := cli.NewContext(nil, set, set)
- expect(t, c.Duration("myflag"), time.Duration(12*time.Second))
-}
-
-func TestContext_String(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.String("myflag", "hello world", "doc")
- c := cli.NewContext(nil, set, set)
- expect(t, c.String("myflag"), "hello world")
-}
-
-func TestContext_Bool(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Bool("myflag", false, "doc")
- c := cli.NewContext(nil, set, set)
- expect(t, c.Bool("myflag"), false)
-}
-
-func TestContext_BoolT(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Bool("myflag", true, "doc")
- c := cli.NewContext(nil, set, set)
- expect(t, c.BoolT("myflag"), true)
-}
-
-func TestContext_Args(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Bool("myflag", false, "doc")
- c := cli.NewContext(nil, set, set)
- set.Parse([]string{"--myflag", "bat", "baz"})
- expect(t, len(c.Args()), 2)
- expect(t, c.Bool("myflag"), true)
-}
-
-func TestContext_IsSet(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Bool("myflag", false, "doc")
- set.String("otherflag", "hello world", "doc")
- globalSet := flag.NewFlagSet("test", 0)
- globalSet.Bool("myflagGlobal", true, "doc")
- c := cli.NewContext(nil, set, globalSet)
- set.Parse([]string{"--myflag", "bat", "baz"})
- globalSet.Parse([]string{"--myflagGlobal", "bat", "baz"})
- expect(t, c.IsSet("myflag"), true)
- expect(t, c.IsSet("otherflag"), false)
- expect(t, c.IsSet("bogusflag"), false)
- expect(t, c.IsSet("myflagGlobal"), false)
-}
-
-func TestContext_GlobalIsSet(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Bool("myflag", false, "doc")
- set.String("otherflag", "hello world", "doc")
- globalSet := flag.NewFlagSet("test", 0)
- globalSet.Bool("myflagGlobal", true, "doc")
- globalSet.Bool("myflagGlobalUnset", true, "doc")
- c := cli.NewContext(nil, set, globalSet)
- set.Parse([]string{"--myflag", "bat", "baz"})
- globalSet.Parse([]string{"--myflagGlobal", "bat", "baz"})
- expect(t, c.GlobalIsSet("myflag"), false)
- expect(t, c.GlobalIsSet("otherflag"), false)
- expect(t, c.GlobalIsSet("bogusflag"), false)
- expect(t, c.GlobalIsSet("myflagGlobal"), true)
- expect(t, c.GlobalIsSet("myflagGlobalUnset"), false)
- expect(t, c.GlobalIsSet("bogusGlobal"), false)
-}
-
-func TestContext_NumFlags(t *testing.T) {
- set := flag.NewFlagSet("test", 0)
- set.Bool("myflag", false, "doc")
- set.String("otherflag", "hello world", "doc")
- globalSet := flag.NewFlagSet("test", 0)
- globalSet.Bool("myflagGlobal", true, "doc")
- c := cli.NewContext(nil, set, globalSet)
- set.Parse([]string{"--myflag", "--otherflag=foo"})
- globalSet.Parse([]string{"--myflagGlobal"})
- expect(t, c.NumFlags(), 2)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/cli/flag_test.go b/Godeps/_workspace/src/github.com/minio/cli/flag_test.go
deleted file mode 100644
index cda91c55..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/flag_test.go
+++ /dev/null
@@ -1,742 +0,0 @@
-package cli_test
-
-import (
- "fmt"
- "os"
- "reflect"
- "strings"
- "testing"
-
- "github.com/minio/cli"
-)
-
-var boolFlagTests = []struct {
- name string
- expected string
-}{
- {"help", "--help\t"},
- {"h", "-h\t"},
-}
-
-func TestBoolFlagHelpOutput(t *testing.T) {
-
- for _, test := range boolFlagTests {
- flag := cli.BoolFlag{Name: test.name}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%s does not match %s", output, test.expected)
- }
- }
-}
-
-var stringFlagTests = []struct {
- name string
- value string
- expected string
-}{
- {"help", "", "--help \t"},
- {"h", "", "-h \t"},
- {"h", "", "-h \t"},
- {"test", "Something", "--test \"Something\"\t"},
-}
-
-func TestStringFlagHelpOutput(t *testing.T) {
-
- for _, test := range stringFlagTests {
- flag := cli.StringFlag{Name: test.name, Value: test.value}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%s does not match %s", output, test.expected)
- }
- }
-}
-
-func TestStringFlagWithEnvVarHelpOutput(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_FOO", "derp")
- for _, test := range stringFlagTests {
- flag := cli.StringFlag{Name: test.name, Value: test.value, EnvVar: "APP_FOO"}
- output := flag.String()
-
- if !strings.HasSuffix(output, " [$APP_FOO]") {
- t.Errorf("%s does not end with [$APP_FOO]", output)
- }
- }
-}
-
-var stringSliceFlagTests = []struct {
- name string
- value *cli.StringSlice
- expected string
-}{
- {"help", func() *cli.StringSlice {
- s := &cli.StringSlice{}
- s.Set("")
- return s
- }(), "--help [--help option --help option]\t"},
- {"h", func() *cli.StringSlice {
- s := &cli.StringSlice{}
- s.Set("")
- return s
- }(), "-h [-h option -h option]\t"},
- {"h", func() *cli.StringSlice {
- s := &cli.StringSlice{}
- s.Set("")
- return s
- }(), "-h [-h option -h option]\t"},
- {"test", func() *cli.StringSlice {
- s := &cli.StringSlice{}
- s.Set("Something")
- return s
- }(), "--test [--test option --test option]\t"},
-}
-
-func TestStringSliceFlagHelpOutput(t *testing.T) {
-
- for _, test := range stringSliceFlagTests {
- flag := cli.StringSliceFlag{Name: test.name, Value: test.value}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%q does not match %q", output, test.expected)
- }
- }
-}
-
-func TestStringSliceFlagWithEnvVarHelpOutput(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_QWWX", "11,4")
- for _, test := range stringSliceFlagTests {
- flag := cli.StringSliceFlag{Name: test.name, Value: test.value, EnvVar: "APP_QWWX"}
- output := flag.String()
-
- if !strings.HasSuffix(output, " [$APP_QWWX]") {
- t.Errorf("%q does not end with [$APP_QWWX]", output)
- }
- }
-}
-
-var intFlagTests = []struct {
- name string
- expected string
-}{
- {"help", "--help \"0\"\t"},
- {"h", "-h \"0\"\t"},
-}
-
-func TestIntFlagHelpOutput(t *testing.T) {
-
- for _, test := range intFlagTests {
- flag := cli.IntFlag{Name: test.name}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%s does not match %s", output, test.expected)
- }
- }
-}
-
-func TestIntFlagWithEnvVarHelpOutput(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_BAR", "2")
- for _, test := range intFlagTests {
- flag := cli.IntFlag{Name: test.name, EnvVar: "APP_BAR"}
- output := flag.String()
-
- if !strings.HasSuffix(output, " [$APP_BAR]") {
- t.Errorf("%s does not end with [$APP_BAR]", output)
- }
- }
-}
-
-var durationFlagTests = []struct {
- name string
- expected string
-}{
- {"help", "--help \"0\"\t"},
- {"h", "-h \"0\"\t"},
-}
-
-func TestDurationFlagHelpOutput(t *testing.T) {
-
- for _, test := range durationFlagTests {
- flag := cli.DurationFlag{Name: test.name}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%s does not match %s", output, test.expected)
- }
- }
-}
-
-func TestDurationFlagWithEnvVarHelpOutput(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_BAR", "2h3m6s")
- for _, test := range durationFlagTests {
- flag := cli.DurationFlag{Name: test.name, EnvVar: "APP_BAR"}
- output := flag.String()
-
- if !strings.HasSuffix(output, " [$APP_BAR]") {
- t.Errorf("%s does not end with [$APP_BAR]", output)
- }
- }
-}
-
-var intSliceFlagTests = []struct {
- name string
- value *cli.IntSlice
- expected string
-}{
- {"help", &cli.IntSlice{}, "--help [--help option --help option]\t"},
- {"h", &cli.IntSlice{}, "-h [-h option -h option]\t"},
- {"h", &cli.IntSlice{}, "-h [-h option -h option]\t"},
- {"test", func() *cli.IntSlice {
- i := &cli.IntSlice{}
- i.Set("9")
- return i
- }(), "--test [--test option --test option]\t"},
-}
-
-func TestIntSliceFlagHelpOutput(t *testing.T) {
-
- for _, test := range intSliceFlagTests {
- flag := cli.IntSliceFlag{Name: test.name, Value: test.value}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%q does not match %q", output, test.expected)
- }
- }
-}
-
-func TestIntSliceFlagWithEnvVarHelpOutput(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_SMURF", "42,3")
- for _, test := range intSliceFlagTests {
- flag := cli.IntSliceFlag{Name: test.name, Value: test.value, EnvVar: "APP_SMURF"}
- output := flag.String()
-
- if !strings.HasSuffix(output, " [$APP_SMURF]") {
- t.Errorf("%q does not end with [$APP_SMURF]", output)
- }
- }
-}
-
-var float64FlagTests = []struct {
- name string
- expected string
-}{
- {"help", "--help \"0\"\t"},
- {"h", "-h \"0\"\t"},
-}
-
-func TestFloat64FlagHelpOutput(t *testing.T) {
-
- for _, test := range float64FlagTests {
- flag := cli.Float64Flag{Name: test.name}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%s does not match %s", output, test.expected)
- }
- }
-}
-
-func TestFloat64FlagWithEnvVarHelpOutput(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_BAZ", "99.4")
- for _, test := range float64FlagTests {
- flag := cli.Float64Flag{Name: test.name, EnvVar: "APP_BAZ"}
- output := flag.String()
-
- if !strings.HasSuffix(output, " [$APP_BAZ]") {
- t.Errorf("%s does not end with [$APP_BAZ]", output)
- }
- }
-}
-
-var genericFlagTests = []struct {
- name string
- value cli.Generic
- expected string
-}{
- {"test", &Parser{"abc", "def"}, "--test \"abc,def\"\ttest flag"},
- {"t", &Parser{"abc", "def"}, "-t \"abc,def\"\ttest flag"},
-}
-
-func TestGenericFlagHelpOutput(t *testing.T) {
-
- for _, test := range genericFlagTests {
- flag := cli.GenericFlag{Name: test.name, Value: test.value, Usage: "test flag"}
- output := flag.String()
-
- if output != test.expected {
- t.Errorf("%q does not match %q", output, test.expected)
- }
- }
-}
-
-func TestGenericFlagWithEnvVarHelpOutput(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_ZAP", "3")
- for _, test := range genericFlagTests {
- flag := cli.GenericFlag{Name: test.name, EnvVar: "APP_ZAP"}
- output := flag.String()
-
- if !strings.HasSuffix(output, " [$APP_ZAP]") {
- t.Errorf("%s does not end with [$APP_ZAP]", output)
- }
- }
-}
-
-func TestParseMultiString(t *testing.T) {
- (&cli.App{
- Flags: []cli.Flag{
- cli.StringFlag{Name: "serve, s"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.String("serve") != "10" {
- t.Errorf("main name not set")
- }
- if ctx.String("s") != "10" {
- t.Errorf("short name not set")
- }
- },
- }).Run([]string{"run", "-s", "10"})
-}
-
-func TestParseMultiStringFromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_COUNT", "20")
- (&cli.App{
- Flags: []cli.Flag{
- cli.StringFlag{Name: "count, c", EnvVar: "APP_COUNT"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.String("count") != "20" {
- t.Errorf("main name not set")
- }
- if ctx.String("c") != "20" {
- t.Errorf("short name not set")
- }
- },
- }).Run([]string{"run"})
-}
-
-func TestParseMultiStringFromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_COUNT", "20")
- (&cli.App{
- Flags: []cli.Flag{
- cli.StringFlag{Name: "count, c", EnvVar: "COMPAT_COUNT,APP_COUNT"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.String("count") != "20" {
- t.Errorf("main name not set")
- }
- if ctx.String("c") != "20" {
- t.Errorf("short name not set")
- }
- },
- }).Run([]string{"run"})
-}
-
-func TestParseMultiStringSlice(t *testing.T) {
- (&cli.App{
- Flags: []cli.Flag{
- cli.StringSliceFlag{Name: "serve, s", Value: &cli.StringSlice{}},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.StringSlice("serve"), []string{"10", "20"}) {
- t.Errorf("main name not set")
- }
- if !reflect.DeepEqual(ctx.StringSlice("s"), []string{"10", "20"}) {
- t.Errorf("short name not set")
- }
- },
- }).Run([]string{"run", "-s", "10", "-s", "20"})
-}
-
-func TestParseMultiStringSliceFromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_INTERVALS", "20,30,40")
-
- (&cli.App{
- Flags: []cli.Flag{
- cli.StringSliceFlag{Name: "intervals, i", Value: &cli.StringSlice{}, EnvVar: "APP_INTERVALS"},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.StringSlice("intervals"), []string{"20", "30", "40"}) {
- t.Errorf("main name not set from env")
- }
- if !reflect.DeepEqual(ctx.StringSlice("i"), []string{"20", "30", "40"}) {
- t.Errorf("short name not set from env")
- }
- },
- }).Run([]string{"run"})
-}
-
-func TestParseMultiStringSliceFromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_INTERVALS", "20,30,40")
-
- (&cli.App{
- Flags: []cli.Flag{
- cli.StringSliceFlag{Name: "intervals, i", Value: &cli.StringSlice{}, EnvVar: "COMPAT_INTERVALS,APP_INTERVALS"},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.StringSlice("intervals"), []string{"20", "30", "40"}) {
- t.Errorf("main name not set from env")
- }
- if !reflect.DeepEqual(ctx.StringSlice("i"), []string{"20", "30", "40"}) {
- t.Errorf("short name not set from env")
- }
- },
- }).Run([]string{"run"})
-}
-
-func TestParseMultiInt(t *testing.T) {
- a := cli.App{
- Flags: []cli.Flag{
- cli.IntFlag{Name: "serve, s"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Int("serve") != 10 {
- t.Errorf("main name not set")
- }
- if ctx.Int("s") != 10 {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run", "-s", "10"})
-}
-
-func TestParseMultiIntFromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_TIMEOUT_SECONDS", "10")
- a := cli.App{
- Flags: []cli.Flag{
- cli.IntFlag{Name: "timeout, t", EnvVar: "APP_TIMEOUT_SECONDS"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Int("timeout") != 10 {
- t.Errorf("main name not set")
- }
- if ctx.Int("t") != 10 {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseMultiIntFromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_TIMEOUT_SECONDS", "10")
- a := cli.App{
- Flags: []cli.Flag{
- cli.IntFlag{Name: "timeout, t", EnvVar: "COMPAT_TIMEOUT_SECONDS,APP_TIMEOUT_SECONDS"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Int("timeout") != 10 {
- t.Errorf("main name not set")
- }
- if ctx.Int("t") != 10 {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseMultiIntSlice(t *testing.T) {
- (&cli.App{
- Flags: []cli.Flag{
- cli.IntSliceFlag{Name: "serve, s", Value: &cli.IntSlice{}},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.IntSlice("serve"), []int{10, 20}) {
- t.Errorf("main name not set")
- }
- if !reflect.DeepEqual(ctx.IntSlice("s"), []int{10, 20}) {
- t.Errorf("short name not set")
- }
- },
- }).Run([]string{"run", "-s", "10", "-s", "20"})
-}
-
-func TestParseMultiIntSliceFromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_INTERVALS", "20,30,40")
-
- (&cli.App{
- Flags: []cli.Flag{
- cli.IntSliceFlag{Name: "intervals, i", Value: &cli.IntSlice{}, EnvVar: "APP_INTERVALS"},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.IntSlice("intervals"), []int{20, 30, 40}) {
- t.Errorf("main name not set from env")
- }
- if !reflect.DeepEqual(ctx.IntSlice("i"), []int{20, 30, 40}) {
- t.Errorf("short name not set from env")
- }
- },
- }).Run([]string{"run"})
-}
-
-func TestParseMultiIntSliceFromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_INTERVALS", "20,30,40")
-
- (&cli.App{
- Flags: []cli.Flag{
- cli.IntSliceFlag{Name: "intervals, i", Value: &cli.IntSlice{}, EnvVar: "COMPAT_INTERVALS,APP_INTERVALS"},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.IntSlice("intervals"), []int{20, 30, 40}) {
- t.Errorf("main name not set from env")
- }
- if !reflect.DeepEqual(ctx.IntSlice("i"), []int{20, 30, 40}) {
- t.Errorf("short name not set from env")
- }
- },
- }).Run([]string{"run"})
-}
-
-func TestParseMultiFloat64(t *testing.T) {
- a := cli.App{
- Flags: []cli.Flag{
- cli.Float64Flag{Name: "serve, s"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Float64("serve") != 10.2 {
- t.Errorf("main name not set")
- }
- if ctx.Float64("s") != 10.2 {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run", "-s", "10.2"})
-}
-
-func TestParseMultiFloat64FromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_TIMEOUT_SECONDS", "15.5")
- a := cli.App{
- Flags: []cli.Flag{
- cli.Float64Flag{Name: "timeout, t", EnvVar: "APP_TIMEOUT_SECONDS"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Float64("timeout") != 15.5 {
- t.Errorf("main name not set")
- }
- if ctx.Float64("t") != 15.5 {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseMultiFloat64FromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_TIMEOUT_SECONDS", "15.5")
- a := cli.App{
- Flags: []cli.Flag{
- cli.Float64Flag{Name: "timeout, t", EnvVar: "COMPAT_TIMEOUT_SECONDS,APP_TIMEOUT_SECONDS"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Float64("timeout") != 15.5 {
- t.Errorf("main name not set")
- }
- if ctx.Float64("t") != 15.5 {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseMultiBool(t *testing.T) {
- a := cli.App{
- Flags: []cli.Flag{
- cli.BoolFlag{Name: "serve, s"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Bool("serve") != true {
- t.Errorf("main name not set")
- }
- if ctx.Bool("s") != true {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run", "--serve"})
-}
-
-func TestParseMultiBoolFromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_DEBUG", "1")
- a := cli.App{
- Flags: []cli.Flag{
- cli.BoolFlag{Name: "debug, d", EnvVar: "APP_DEBUG"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Bool("debug") != true {
- t.Errorf("main name not set from env")
- }
- if ctx.Bool("d") != true {
- t.Errorf("short name not set from env")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseMultiBoolFromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_DEBUG", "1")
- a := cli.App{
- Flags: []cli.Flag{
- cli.BoolFlag{Name: "debug, d", EnvVar: "COMPAT_DEBUG,APP_DEBUG"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.Bool("debug") != true {
- t.Errorf("main name not set from env")
- }
- if ctx.Bool("d") != true {
- t.Errorf("short name not set from env")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseMultiBoolT(t *testing.T) {
- a := cli.App{
- Flags: []cli.Flag{
- cli.BoolTFlag{Name: "serve, s"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.BoolT("serve") != true {
- t.Errorf("main name not set")
- }
- if ctx.BoolT("s") != true {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run", "--serve"})
-}
-
-func TestParseMultiBoolTFromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_DEBUG", "0")
- a := cli.App{
- Flags: []cli.Flag{
- cli.BoolTFlag{Name: "debug, d", EnvVar: "APP_DEBUG"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.BoolT("debug") != false {
- t.Errorf("main name not set from env")
- }
- if ctx.BoolT("d") != false {
- t.Errorf("short name not set from env")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseMultiBoolTFromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_DEBUG", "0")
- a := cli.App{
- Flags: []cli.Flag{
- cli.BoolTFlag{Name: "debug, d", EnvVar: "COMPAT_DEBUG,APP_DEBUG"},
- },
- Action: func(ctx *cli.Context) {
- if ctx.BoolT("debug") != false {
- t.Errorf("main name not set from env")
- }
- if ctx.BoolT("d") != false {
- t.Errorf("short name not set from env")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-type Parser [2]string
-
-func (p *Parser) Set(value string) error {
- parts := strings.Split(value, ",")
- if len(parts) != 2 {
- return fmt.Errorf("invalid format")
- }
-
- (*p)[0] = parts[0]
- (*p)[1] = parts[1]
-
- return nil
-}
-
-func (p *Parser) String() string {
- return fmt.Sprintf("%s,%s", p[0], p[1])
-}
-
-func TestParseGeneric(t *testing.T) {
- a := cli.App{
- Flags: []cli.Flag{
- cli.GenericFlag{Name: "serve, s", Value: &Parser{}},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.Generic("serve"), &Parser{"10", "20"}) {
- t.Errorf("main name not set")
- }
- if !reflect.DeepEqual(ctx.Generic("s"), &Parser{"10", "20"}) {
- t.Errorf("short name not set")
- }
- },
- }
- a.Run([]string{"run", "-s", "10,20"})
-}
-
-func TestParseGenericFromEnv(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_SERVE", "20,30")
- a := cli.App{
- Flags: []cli.Flag{
- cli.GenericFlag{Name: "serve, s", Value: &Parser{}, EnvVar: "APP_SERVE"},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.Generic("serve"), &Parser{"20", "30"}) {
- t.Errorf("main name not set from env")
- }
- if !reflect.DeepEqual(ctx.Generic("s"), &Parser{"20", "30"}) {
- t.Errorf("short name not set from env")
- }
- },
- }
- a.Run([]string{"run"})
-}
-
-func TestParseGenericFromEnvCascade(t *testing.T) {
- os.Clearenv()
- os.Setenv("APP_FOO", "99,2000")
- a := cli.App{
- Flags: []cli.Flag{
- cli.GenericFlag{Name: "foos", Value: &Parser{}, EnvVar: "COMPAT_FOO,APP_FOO"},
- },
- Action: func(ctx *cli.Context) {
- if !reflect.DeepEqual(ctx.Generic("foos"), &Parser{"99", "2000"}) {
- t.Errorf("value not set from env")
- }
- },
- }
- a.Run([]string{"run"})
-}
diff --git a/Godeps/_workspace/src/github.com/minio/cli/helpers_test.go b/Godeps/_workspace/src/github.com/minio/cli/helpers_test.go
deleted file mode 100644
index cdc4feb2..00000000
--- a/Godeps/_workspace/src/github.com/minio/cli/helpers_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package cli_test
-
-import (
- "reflect"
- "testing"
-)
-
-/* Test Helpers */
-func expect(t *testing.T, a interface{}, b interface{}) {
- if a != b {
- t.Errorf("Expected %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
- }
-}
-
-func refute(t *testing.T, a interface{}, b interface{}) {
- if a == b {
- t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/.travis.yml b/Godeps/_workspace/src/github.com/minio/minio-go/.travis.yml
deleted file mode 100644
index d67f43b8..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
-- 1.4.2
-script:
-- go vet ./...
-- go test -race -v ./...
-notifications:
- slack:
- secure: HrOX2k6F/sEl6Rr4m5vHOdJCIwV42be0kz1Jy/WSMvrl/fQ8YkldKviLeWh4aWt1kclsYhNQ4FqGML+RIZYsdOqej4fAw9Vi5pZkI1MzPJq0UjrtMqkqzvD90eDGQYCKwaXjEIN8cohwJeb6X0B0HKAd9sqJW5GH5SwnhH5WWP8=
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/api_handlers_test.go b/Godeps/_workspace/src/github.com/minio/minio-go/api_handlers_test.go
deleted file mode 100644
index 45b432ce..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/api_handlers_test.go
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package minio_test
-
-// bucketHandler is an http.Handler that verifies bucket responses and validates incoming requests
-import (
- "bytes"
- "io"
- "net/http"
- "strconv"
- "time"
-)
-
-type bucketHandler struct {
- resource string
-}
-
-func (h bucketHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- switch {
- case r.Method == "GET":
- switch {
- case r.URL.Path == "/":
- response := []byte("bucket2015-05-20T23:05:09.230Zminiominio")
- w.Header().Set("Content-Length", strconv.Itoa(len(response)))
- w.Write(response)
- case r.URL.Path == "/bucket":
- _, ok := r.URL.Query()["acl"]
- if ok {
- response := []byte("75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06aCustomersName@amazon.com75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06aCustomersName@amazon.comFULL_CONTROL")
- w.Header().Set("Content-Length", strconv.Itoa(len(response)))
- w.Write(response)
- return
- }
- fallthrough
- case r.URL.Path == "/bucket":
- response := []byte("\"259d04a13802ae09c7e41be50ccc6baa\"object2015-05-21T18:24:21.097Z22061miniominioSTANDARDfalse1000testbucket")
- w.Header().Set("Content-Length", strconv.Itoa(len(response)))
- w.Write(response)
- }
- case r.Method == "PUT":
- switch {
- case r.URL.Path == h.resource:
- _, ok := r.URL.Query()["acl"]
- if ok {
- if r.Header.Get("x-amz-acl") != "public-read-write" {
- w.WriteHeader(http.StatusNotImplemented)
- }
- }
- w.WriteHeader(http.StatusOK)
- default:
- w.WriteHeader(http.StatusBadRequest)
- }
- case r.Method == "HEAD":
- switch {
- case r.URL.Path == h.resource:
- w.WriteHeader(http.StatusOK)
- default:
- w.WriteHeader(http.StatusForbidden)
- }
- case r.Method == "DELETE":
- switch {
- case r.URL.Path != h.resource:
- w.WriteHeader(http.StatusNotFound)
- default:
- h.resource = ""
- w.WriteHeader(http.StatusOK)
- }
- }
-}
-
-// objectHandler is an http.Handler that verifies object responses and validates incoming requests
-type objectHandler struct {
- resource string
- data []byte
-}
-
-func (h objectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- switch {
- case r.Method == "PUT":
- length, err := strconv.Atoi(r.Header.Get("Content-Length"))
- if err != nil {
- w.WriteHeader(http.StatusBadRequest)
- return
- }
- var buffer bytes.Buffer
- _, err = io.CopyN(&buffer, r.Body, int64(length))
- if err != nil {
- w.WriteHeader(http.StatusInternalServerError)
- return
- }
- if !bytes.Equal(h.data, buffer.Bytes()) {
- w.WriteHeader(http.StatusInternalServerError)
- return
- }
- w.Header().Set("ETag", "\"9af2f8218b150c351ad802c6f3d66abe\"")
- w.WriteHeader(http.StatusOK)
- case r.Method == "HEAD":
- if r.URL.Path != h.resource {
- w.WriteHeader(http.StatusNotFound)
- return
- }
- w.Header().Set("Content-Length", strconv.Itoa(len(h.data)))
- w.Header().Set("Last-Modified", time.Now().UTC().Format(http.TimeFormat))
- w.Header().Set("ETag", "\"9af2f8218b150c351ad802c6f3d66abe\"")
- w.WriteHeader(http.StatusOK)
- case r.Method == "POST":
- _, ok := r.URL.Query()["uploads"]
- if ok {
- response := []byte("example-bucketobjectXXBsb2FkIElEIGZvciBlbHZpbmcncyVcdS1tb3ZpZS5tMnRzEEEwbG9hZA")
- w.Header().Set("Content-Length", strconv.Itoa(len(response)))
- w.Write(response)
- return
- }
- case r.Method == "GET":
- _, ok := r.URL.Query()["uploadId"]
- if ok {
- uploadID := r.URL.Query().Get("uploadId")
- if uploadID != "XXBsb2FkIElEIGZvciBlbHZpbmcncyVcdS1tb3ZpZS5tMnRzEEEwbG9hZA" {
- w.WriteHeader(http.StatusNotFound)
- return
- }
- response := []byte("example-bucketexample-objectXXBsb2FkIElEIGZvciBlbHZpbmcncyVcdS1tb3ZpZS5tMnRzEEEwbG9hZAarn:aws:iam::111122223333:user/some-user-11116a31-17b5-4fb7-9df5-b288870f11xxumat-user-11116a31-17b5-4fb7-9df5-b288870f11xx75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06asomeNameSTANDARD132true22010-11-10T20:48:34.000Z\"7778aef83f66abc1fa1e8477f296d394\"1048576032010-11-10T20:48:33.000Z\"aaaa18db4cc2f85cedef654fccc4a4x8\"10485760")
- w.Header().Set("Content-Length", strconv.Itoa(len(response)))
- w.Write(response)
- return
- }
- if r.URL.Path != h.resource {
- w.WriteHeader(http.StatusNotFound)
- return
- }
- w.Header().Set("Content-Length", strconv.Itoa(len(h.data)))
- w.Header().Set("Last-Modified", time.Now().UTC().Format(http.TimeFormat))
- w.Header().Set("ETag", "\"9af2f8218b150c351ad802c6f3d66abe\"")
- w.WriteHeader(http.StatusOK)
- io.Copy(w, bytes.NewReader(h.data))
- case r.Method == "DELETE":
- if r.URL.Path != h.resource {
- w.WriteHeader(http.StatusNotFound)
- return
- }
- h.resource = ""
- h.data = nil
- w.WriteHeader(http.StatusOK)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/api_private_test.go b/Godeps/_workspace/src/github.com/minio/minio-go/api_private_test.go
deleted file mode 100644
index b79a48cf..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/api_private_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package minio
-
-import (
- "strings"
- "testing"
-)
-
-func TestACLTypes(t *testing.T) {
- want := map[string]bool{
- "private": true,
- "public-read": true,
- "public-read-write": true,
- "authenticated-read": true,
- "invalid": false,
- }
- for acl, ok := range want {
- if BucketACL(acl).isValidBucketACL() != ok {
- t.Fatal("Error")
- }
- }
-}
-
-func TestUserAgent(t *testing.T) {
- conf := new(Config)
- conf.SetUserAgent("minio", "1.0", "amd64")
- if !strings.Contains(conf.userAgent, "minio") {
- t.Fatalf("Error")
- }
-}
-
-func TestGetRegion(t *testing.T) {
- region, err := getRegion("s3.amazonaws.com")
- if err != nil {
- t.Fatalf("Error")
- }
- if region != "us-east-1" {
- t.Fatalf("Error")
- }
- region, err = getRegion("localhost:9000")
- if err != nil {
- t.Fatalf("Error")
- }
- if region != "milkyway" {
- t.Fatalf("Error")
- }
-}
-
-func TestPartSize(t *testing.T) {
- var maxPartSize int64 = 1024 * 1024 * 1024 * 5
- partSize := getPartSize(5000000000000000000)
- if partSize > minimumPartSize {
- if partSize > maxPartSize {
- t.Fatal("invalid result, cannot be bigger than maxPartSize 5GB")
- }
- }
- partSize = getPartSize(50000000000)
- if partSize > minimumPartSize {
- t.Fatal("invalid result, cannot be bigger than minimumPartSize 5MB")
- }
-}
-
-func TestURLEncoding(t *testing.T) {
- type urlStrings struct {
- name string
- encodedName string
- }
-
- want := []urlStrings{
- {
- name: "bigfile-1._%",
- encodedName: "bigfile-1._%25",
- },
- {
- name: "本語",
- encodedName: "%E6%9C%AC%E8%AA%9E",
- },
- {
- name: "本語.1",
- encodedName: "%E6%9C%AC%E8%AA%9E.1",
- },
- {
- name: ">123>3123123",
- encodedName: "%3E123%3E3123123",
- },
- {
- name: "test 1 2.txt",
- encodedName: "test%201%202.txt",
- },
- }
-
- for _, u := range want {
- encodedName, err := urlEncodeName(u.name)
- if err != nil {
- t.Fatalf("Error")
- }
- if u.encodedName != encodedName {
- t.Errorf("Error")
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/api_public_test.go b/Godeps/_workspace/src/github.com/minio/minio-go/api_public_test.go
deleted file mode 100644
index cc12eff5..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/api_public_test.go
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package minio_test
-
-import (
- "bytes"
- "io"
- "net/http/httptest"
- "testing"
- "time"
-
- "github.com/minio/minio-go"
-)
-
-func TestBucketOperations(t *testing.T) {
- bucket := bucketHandler(bucketHandler{
- resource: "/bucket",
- })
- server := httptest.NewServer(bucket)
- defer server.Close()
-
- a, err := minio.New(minio.Config{Endpoint: server.URL})
- if err != nil {
- t.Errorf("Error")
- }
- err = a.MakeBucket("bucket", "private")
- if err != nil {
- t.Errorf("Error")
- }
-
- err = a.BucketExists("bucket")
- if err != nil {
- t.Errorf("Error")
- }
-
- err = a.BucketExists("bucket1")
- if err == nil {
- t.Errorf("Error")
- }
- if err.Error() != "Access Denied" {
- t.Errorf("Error")
- }
-
- err = a.SetBucketACL("bucket", "public-read-write")
- if err != nil {
- t.Errorf("Error")
- }
-
- acl, err := a.GetBucketACL("bucket")
- if err != nil {
- t.Errorf("Error")
- }
- if acl != minio.BucketACL("private") {
- t.Fatalf("Error")
- }
-
- for b := range a.ListBuckets() {
- if b.Err != nil {
- t.Fatalf(b.Err.Error())
- }
- if b.Stat.Name != "bucket" {
- t.Errorf("Error")
- }
- }
-
- for o := range a.ListObjects("bucket", "", true) {
- if o.Err != nil {
- t.Fatalf(o.Err.Error())
- }
- if o.Stat.Key != "object" {
- t.Errorf("Error")
- }
- }
-
- err = a.RemoveBucket("bucket")
- if err != nil {
- t.Errorf("Error")
- }
-
- err = a.RemoveBucket("bucket1")
- if err == nil {
- t.Fatalf("Error")
- }
- if err.Error() != "The specified bucket does not exist." {
- t.Errorf("Error")
- }
-}
-
-func TestBucketOperationsFail(t *testing.T) {
- bucket := bucketHandler(bucketHandler{
- resource: "/bucket",
- })
- server := httptest.NewServer(bucket)
- defer server.Close()
-
- a, err := minio.New(minio.Config{Endpoint: server.URL})
- if err != nil {
- t.Errorf("Error")
- }
- err = a.MakeBucket("bucket$$$", "private")
- if err == nil {
- t.Errorf("Error")
- }
-
- err = a.BucketExists("bucket.")
- if err == nil {
- t.Errorf("Error")
- }
-
- err = a.SetBucketACL("bucket-.", "public-read-write")
- if err == nil {
- t.Errorf("Error")
- }
-
- _, err = a.GetBucketACL("bucket??")
- if err == nil {
- t.Errorf("Error")
- }
-
- for o := range a.ListObjects("bucket??", "", true) {
- if o.Err == nil {
- t.Fatalf(o.Err.Error())
- }
- }
-
- err = a.RemoveBucket("bucket??")
- if err == nil {
- t.Errorf("Error")
- }
-
- if err.Error() != "The specified bucket is not valid." {
- t.Errorf("Error")
- }
-}
-
-func TestObjectOperations(t *testing.T) {
- object := objectHandler(objectHandler{
- resource: "/bucket/object",
- data: []byte("Hello, World"),
- })
- server := httptest.NewServer(object)
- defer server.Close()
-
- a, err := minio.New(minio.Config{Endpoint: server.URL})
- if err != nil {
- t.Fatalf("Error")
- }
- data := []byte("Hello, World")
- err = a.PutObject("bucket", "object", "", int64(len(data)), bytes.NewReader(data))
- if err != nil {
- t.Fatalf("Error")
- }
- metadata, err := a.StatObject("bucket", "object")
- if err != nil {
- t.Fatalf("Error")
- }
- if metadata.Key != "object" {
- t.Fatalf("Error")
- }
- if metadata.ETag != "9af2f8218b150c351ad802c6f3d66abe" {
- t.Fatalf("Error")
- }
-
- reader, metadata, err := a.GetObject("bucket", "object")
- if err != nil {
- t.Fatalf("Error")
- }
- if metadata.Key != "object" {
- t.Fatalf("Error")
- }
- if metadata.ETag != "9af2f8218b150c351ad802c6f3d66abe" {
- t.Fatalf("Error")
- }
-
- var buffer bytes.Buffer
- _, err = io.Copy(&buffer, reader)
- if !bytes.Equal(buffer.Bytes(), data) {
- t.Fatalf("Error")
- }
-
- err = a.RemoveObject("bucket", "object")
- if err != nil {
- t.Fatalf("Error")
- }
- err = a.RemoveObject("bucket", "object1")
- if err == nil {
- t.Fatalf("Error")
- }
- if err.Error() != "The specified key does not exist." {
- t.Errorf("Error")
- }
-}
-
-func TestPresignedURL(t *testing.T) {
- object := objectHandler(objectHandler{
- resource: "/bucket/object",
- data: []byte("Hello, World"),
- })
- server := httptest.NewServer(object)
- defer server.Close()
-
- a, err := minio.New(minio.Config{Endpoint: server.URL})
- if err != nil {
- t.Fatalf("Error")
- }
- // should error out for invalid access keys
- _, err = a.PresignedGetObject("bucket", "object", time.Duration(1000)*time.Second)
- if err == nil {
- t.Fatalf("Error")
- }
-
- a, err = minio.New(minio.Config{
- Endpoint: server.URL,
- AccessKeyID: "accessKey",
- SecretAccessKey: "secretKey",
- })
- if err != nil {
- t.Fatalf("Error")
- }
- url, err := a.PresignedGetObject("bucket", "object", time.Duration(1000)*time.Second)
- if err != nil {
- t.Fatalf("Error")
- }
- if url == "" {
- t.Fatalf("Error")
- }
- url, err = a.PresignedGetPartialObject("bucket", "object", time.Duration(1000)*time.Second, 5, 11)
- if err != nil {
- t.Fatalf("Error")
- }
- if url == "" {
- t.Fatalf("Error")
- }
- _, err = a.PresignedGetObject("bucket", "object", time.Duration(0)*time.Second)
- if err == nil {
- t.Fatalf("Error")
- }
- _, err = a.PresignedGetObject("bucket", "object", time.Duration(604801)*time.Second)
- if err == nil {
- t.Fatalf("Error")
- }
-}
-
-func TestErrorResponse(t *testing.T) {
- errorResponse := []byte("AccessDeniedAccess Denied/mybucket/myphoto.jpgF19772218238A85AGuWkjyviSiGHizehqpmsD1ndz5NClSP19DOT+s2mv7gXGQ8/X1lhbDGiIJEXpGFD")
- errorReader := bytes.NewReader(errorResponse)
- err := minio.BodyToErrorResponse(errorReader, "application/xml")
- if err == nil {
- t.Fatal("Error")
- }
- if err.Error() != "Access Denied" {
- t.Fatal("Error")
- }
- resp := minio.ToErrorResponse(err)
- // valid all fields
- if resp == nil {
- t.Fatal("Error")
- }
- if resp.Code != "AccessDenied" {
- t.Fatal("Error")
- }
- if resp.RequestID != "F19772218238A85A" {
- t.Fatal("Error")
- }
- if resp.Message != "Access Denied" {
- t.Fatal("Error")
- }
- if resp.Resource != "/mybucket/myphoto.jpg" {
- t.Fatal("Error")
- }
- if resp.HostID != "GuWkjyviSiGHizehqpmsD1ndz5NClSP19DOT+s2mv7gXGQ8/X1lhbDGiIJEXpGFD" {
- t.Fatal("Error")
- }
- if resp.ToXML() == "" {
- t.Fatal("Error")
- }
- if resp.ToJSON() == "" {
- t.Fatal("Error")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/bucketexists.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/bucketexists.go
deleted file mode 100644
index 24c739c9..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/bucketexists.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.BucketExists("mybucket")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropallincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropallincompleteuploads.go
deleted file mode 100644
index cde2787e..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropallincompleteuploads.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for err := range s3Client.DropAllIncompleteUploads("mybucket") {
- if err != nil {
- log.Fatalln(err)
- }
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropincompleteuploads.go
deleted file mode 100644
index da56dd16..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropincompleteuploads.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for err := range s3Client.DropIncompleteUpload("mybucket", "myobject") {
- if err != nil {
- log.Fatalln(err)
- }
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getbucketacl.go
deleted file mode 100644
index fb61e6f5..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getbucketacl.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- acl, err := s3Client.GetBucketACL("mybucket")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println(acl)
-
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getobject.go
deleted file mode 100644
index 795edb13..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getobject.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "io"
- "log"
- "os"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- reader, stat, err := s3Client.GetObject("mybucket", "myobject")
- if err != nil {
- log.Fatalln(err)
- }
-
- localfile, err := os.Create("testfile")
- if err != nil {
- log.Fatalln(err)
- }
- defer localfile.Close()
-
- if _, err = io.CopyN(localfile, reader, stat.Size); err != nil {
- log.Fatalln(err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getpartialobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getpartialobject.go
deleted file mode 100644
index bd603b29..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getpartialobject.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "io"
- "log"
- "os"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- reader, stat, err := s3Client.GetPartialObject("mybucket", "myobject", 0, 10)
- if err != nil {
- log.Fatalln(err)
- }
-
- localfile, err := os.Create("testfile")
- if err != nil {
- log.Fatalln(err)
- }
- defer localfile.Close()
-
- if _, err = io.CopyN(localfile, reader, stat.Size); err != nil {
- log.Fatalln(err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listbuckets.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listbuckets.go
deleted file mode 100644
index 7af207c7..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listbuckets.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for bucket := range s3Client.ListBuckets() {
- if bucket.Err != nil {
- log.Fatalln(bucket.Err)
- }
- log.Println(bucket.Stat)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listobjects.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listobjects.go
deleted file mode 100644
index cb03fb08..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listobjects.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for object := range s3Client.ListObjects("mybucket", "", true) {
- if object.Err != nil {
- log.Fatalln(object.Err)
- }
- log.Println(object.Stat)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/makebucket.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/makebucket.go
deleted file mode 100644
index 70ab579d..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/makebucket.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.MakeBucket("mybucket", "")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/putobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/putobject.go
deleted file mode 100644
index 656cd429..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/putobject.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
- "os"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- object, err := os.Open("testfile")
- if err != nil {
- log.Fatalln(err)
- }
- defer object.Close()
- objectInfo, err := object.Stat()
- if err != nil {
- object.Close()
- log.Fatalln(err)
- }
-
- err = s3Client.PutObject("mybucket", "myobject", "application/octet-stream", objectInfo.Size(), object)
- if err != nil {
- log.Fatalln(err)
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/setbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/setbucketacl.go
deleted file mode 100644
index a3d6efaa..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/setbucketacl.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.SetBucketACL("mybucket", minio.BucketACL("public-read-write"))
- if err != nil {
- log.Fatalln(err)
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/statobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/statobject.go
deleted file mode 100644
index 1dac39da..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/statobject.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- Endpoint: "https://play.minio.io:9000",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- stat, err := s3Client.StatObject("mybucket", "myobject")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println(stat)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/bucketexists.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/bucketexists.go
deleted file mode 100644
index 2a6a962e..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/bucketexists.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.BucketExists("mybucket")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropallincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropallincompleteuploads.go
deleted file mode 100644
index c5e856e0..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropallincompleteuploads.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for err := range s3Client.DropAllIncompleteUploads("mybucket") {
- if err != nil {
- log.Fatalln(err)
- }
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropincompleteuploads.go
deleted file mode 100644
index 5353d05f..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropincompleteuploads.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for err := range s3Client.DropIncompleteUpload("mybucket", "myobject") {
- if err != nil {
- log.Fatalln(err)
- }
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getbucketacl.go
deleted file mode 100644
index 573fa09f..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getbucketacl.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- acl, err := s3Client.GetBucketACL("mybucket")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println(acl)
-
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getobject.go
deleted file mode 100644
index e5cb684a..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getobject.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "io"
- "log"
- "os"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- reader, stat, err := s3Client.GetObject("mybucket", "myobject")
- if err != nil {
- log.Fatalln(err)
- }
-
- localfile, err := os.Create("testfile")
- if err != nil {
- log.Fatalln(err)
- }
- defer localfile.Close()
-
- if _, err = io.CopyN(localfile, reader, stat.Size); err != nil {
- log.Fatalln(err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getpartialobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getpartialobject.go
deleted file mode 100644
index 83d686eb..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getpartialobject.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "io"
- "log"
- "os"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- reader, stat, err := s3Client.GetPartialObject("mybucket", "myobject", 0, 10)
- if err != nil {
- log.Fatalln(err)
- }
-
- localfile, err := os.Create("testfile")
- if err != nil {
- log.Fatalln(err)
- }
- defer localfile.Close()
-
- if _, err = io.CopyN(localfile, reader, stat.Size); err != nil {
- log.Fatalln(err)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/listbuckets.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/listbuckets.go
deleted file mode 100644
index 2750a894..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/listbuckets.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for bucket := range s3Client.ListBuckets() {
- if bucket.Err != nil {
- log.Fatalln(bucket.Err)
- }
- log.Println(bucket.Stat)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/listobjects.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/listobjects.go
deleted file mode 100644
index e56de7b1..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/listobjects.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- for object := range s3Client.ListObjects("mybucket", "", true) {
- if object.Err != nil {
- log.Fatalln(object.Err)
- }
- log.Println(object.Stat)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/makebucket.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/makebucket.go
deleted file mode 100644
index 487538be..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/makebucket.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.MakeBucket("mybucket", "")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/presignedgetobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/presignedgetobject.go
deleted file mode 100644
index 4c2fff75..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/presignedgetobject.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
- "time"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- string, err := s3Client.PresignedGetObject("mybucket", "myobject", time.Duration(1000)*time.Second)
- if err != nil {
- log.Fatalln(err)
- }
- log.Println(string)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/putobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/putobject.go
deleted file mode 100644
index 199c4b4d..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/putobject.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
- "os"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- object, err := os.Open("testfile")
- if err != nil {
- log.Fatalln(err)
- }
- defer object.Close()
- objectInfo, err := object.Stat()
- if err != nil {
- object.Close()
- log.Fatalln(err)
- }
-
- err = s3Client.PutObject("mybucket", "myobject", "application/octet-stream", objectInfo.Size(), object)
- if err != nil {
- log.Fatalln(err)
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removebucket.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removebucket.go
deleted file mode 100644
index 002fbe05..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removebucket.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.RemoveBucket("mybucket")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println("Success")
-
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removeobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removeobject.go
deleted file mode 100644
index 31566e60..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removeobject.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.RemoveObject("mybucket", "myobject")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println("Success")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/setbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/setbucketacl.go
deleted file mode 100644
index 661b7c8d..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/setbucketacl.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- err = s3Client.SetBucketACL("mybucket", minio.BucketACL("public-read-write"))
- if err != nil {
- log.Fatalln(err)
- }
-
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/statobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/statobject.go
deleted file mode 100644
index dd0d44f6..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/statobject.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build ignore
-
-/*
- * Minio Go Library for Amazon S3 compatible cloud storage (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package main
-
-import (
- "log"
-
- "github.com/minio/minio-go"
-)
-
-func main() {
- config := minio.Config{
- AccessKeyID: "YOUR-ACCESS-KEY-HERE",
- SecretAccessKey: "YOUR-PASSWORD-HERE",
- Endpoint: "https://s3.amazonaws.com",
- }
- s3Client, err := minio.New(config)
- if err != nil {
- log.Fatalln(err)
- }
- stat, err := s3Client.StatObject("mybucket", "myobject")
- if err != nil {
- log.Fatalln(err)
- }
- log.Println(stat)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio/pkg/iodine/iodine.go b/Godeps/_workspace/src/github.com/minio/minio/pkg/iodine/iodine.go
deleted file mode 100644
index 4f78f2ea..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio/pkg/iodine/iodine.go
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Minio Cloud Storage, (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package iodine
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "os"
- "path/filepath"
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "sync"
-
- "github.com/dustin/go-humanize"
-)
-
-// Error is the iodine error which contains a pointer to the original error
-// and stack traces.
-type Error struct {
- EmbeddedError error `json:"-"`
- ErrorMessage string
- ErrorType string
-
- Stack []StackEntry
-}
-
-// StackEntry contains the entry in the stack trace
-type StackEntry struct {
- Host string
- File string
- Func string
- Line int
- Data map[string]string
-}
-
-var gopathSource string
-
-var globalState = struct {
- sync.RWMutex
- m map[string]string
-}{m: make(map[string]string)}
-
-// SetGlobalState - set global state
-func SetGlobalState(key, value string) {
- globalState.Lock()
- globalState.m[key] = value
- globalState.Unlock()
-}
-
-// ClearGlobalState - clear info in globalState struct
-func ClearGlobalState() {
- globalState.Lock()
- for k := range globalState.m {
- delete(globalState.m, k)
- }
- globalState.Unlock()
-}
-
-// GetGlobalState - get map from globalState struct
-func GetGlobalState() map[string]string {
- result := make(map[string]string)
- globalState.RLock()
- for k, v := range globalState.m {
- result[k] = v
- }
- globalState.RUnlock()
- return result
-}
-
-// GetGlobalStateKey - get value for key from globalState struct
-func GetGlobalStateKey(k string) string {
- globalState.RLock()
- result, _ := globalState.m[k]
- globalState.RUnlock()
- return result
-}
-
-// ToError returns the input if it is not an iodine error. It returns the embedded error if it is an iodine error. If nil, returns nil.
-func ToError(err error) error {
- switch err := err.(type) {
- case nil:
- {
- return nil
- }
- case Error:
- {
- if err.EmbeddedError != nil {
- return err.EmbeddedError
- }
- return errors.New(err.ErrorMessage)
- }
- default:
- {
- return err
- }
- }
-}
-
-// New - instantiate an error, turning it into an iodine error.
-// Adds an initial stack trace.
-func New(err error, data map[string]string) error {
- if err != nil {
- entry := createStackEntry()
- var newErr Error
-
- // check if error is wrapped
- switch typedError := err.(type) {
- case Error:
- {
- newErr = typedError
- }
- default:
- {
- newErr = Error{
- EmbeddedError: err,
- ErrorMessage: err.Error(),
- ErrorType: reflect.TypeOf(err).String(),
- Stack: []StackEntry{},
- }
- }
- }
- for k, v := range data {
- entry.Data[k] = v
- }
- newErr.Stack = append(newErr.Stack, entry)
- return newErr
- }
- return nil
-}
-
-// createStackEntry - create stack entries
-func createStackEntry() StackEntry {
- host, _ := os.Hostname()
- pc, file, line, _ := runtime.Caller(2)
- function := runtime.FuncForPC(pc).Name()
- _, function = filepath.Split(function)
- file = strings.TrimPrefix(file, gopathSource) // trim gopathSource from file
-
- data := GetGlobalState()
- for k, v := range getSystemData() {
- data[k] = v
- }
-
- entry := StackEntry{
- Host: host,
- File: file,
- Func: function,
- Line: line,
- Data: data,
- }
- return entry
-}
-
-func getSystemData() map[string]string {
- host, err := os.Hostname()
- if err != nil {
- host = ""
- }
- memstats := &runtime.MemStats{}
- runtime.ReadMemStats(memstats)
- return map[string]string{
- "sys.host": host,
- "sys.os": runtime.GOOS,
- "sys.arch": runtime.GOARCH,
- "sys.go": runtime.Version(),
- "sys.cpus": strconv.Itoa(runtime.NumCPU()),
- "sys.mem.used": humanize.Bytes(memstats.Alloc),
- "sys.mem.allocated": humanize.Bytes(memstats.TotalAlloc),
- "sys.mem.heap.used": humanize.Bytes(memstats.HeapAlloc),
- "sys.mem.heap.allocated": humanize.Bytes(memstats.HeapSys),
- }
-}
-
-// Annotate an error with a stack entry and returns itself
-//
-// func (err *WrappedError) Annotate(info map[string]string) *WrappedError {
-// entry := createStackEntry()
-// for k, v := range info {
-// entry.Data[k] = v
-// }
-// err.Stack = append(err.Stack, entry)
-// return err
-// }
-
-// EmitJSON writes JSON output for the error
-func (err Error) EmitJSON() ([]byte, error) {
- return json.MarshalIndent(err, "", "\t")
-}
-
-// EmitHumanReadable returns a human readable error message
-func (err Error) EmitHumanReadable() string {
- var errorBuffer bytes.Buffer
- fmt.Fprintln(&errorBuffer, err.ErrorMessage)
- for i, entry := range err.Stack {
- prettyData, _ := json.Marshal(entry.Data)
- fmt.Fprintln(&errorBuffer, "-", i, entry.Host+":"+entry.File+":"+strconv.Itoa(entry.Line)+" "+entry.Func+"():", string(prettyData))
- }
- return string(errorBuffer.Bytes())
-}
-
-// Emits the original error message
-func (err Error) Error() string {
- return err.EmitHumanReadable()
-}
-
-func init() {
- _, iodineFile, _, _ := runtime.Caller(0)
- iodineFile = filepath.Dir(iodineFile) // trim iodine.go
- iodineFile = filepath.Dir(iodineFile) // trim iodine
- iodineFile = filepath.Dir(iodineFile) // trim pkg
- iodineFile = filepath.Dir(iodineFile) // trim minio
- iodineFile = filepath.Dir(iodineFile) // trim minio
- gopathSource = filepath.Dir(iodineFile) + "/" // trim github.com
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio/pkg/iodine/iodine_test.go b/Godeps/_workspace/src/github.com/minio/minio/pkg/iodine/iodine_test.go
deleted file mode 100644
index c7fa0a13..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio/pkg/iodine/iodine_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Iodine, (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package iodine
-
-import (
- "errors"
- "fmt"
- "testing"
-
- "encoding/json"
- "os"
-)
-
-func TestIodine(t *testing.T) {
- iodineError := New(errors.New("Hello"), nil)
- iodineError = New(iodineError, nil)
- iodineError = New(iodineError, nil)
- iodineError = New(iodineError, nil)
-
- switch typedError := iodineError.(type) {
- case Error:
- {
- // Visually watch out for formating errors
- fmt.Println(typedError.EmitHumanReadable())
-
- if len(typedError.Stack) != 4 {
- t.Fail()
- }
- _, err := json.MarshalIndent(typedError, "", " ")
- if err != nil {
- t.Fail()
- }
- }
- default:
- {
- t.Fail()
- }
- }
-}
-
-func TestState(t *testing.T) {
- SetGlobalState("hello", "world")
- result := GetGlobalStateKey("hello")
- if result != "world" {
- t.Error("global state not set: hello->world")
- t.Fail()
- }
- ClearGlobalState()
- if len(GetGlobalState()) != 0 {
- t.Fail()
- }
- SetGlobalState("foo", "bar")
- err := New(errors.New("a simple error"), nil)
- switch typedError := err.(type) {
- case Error:
- {
- if res, ok := typedError.Stack[0].Data["foo"]; ok {
- if res != "bar" {
- t.Error("global state not set: foo->bar")
- }
- } else {
- t.Fail()
- }
- typedError = New(typedError, map[string]string{"foo2": "bar2"}).(Error)
- if res, ok := typedError.Stack[0].Data["foo"]; ok {
- if res != "bar" {
- t.Error("annotate should not modify previous data entries")
- }
- } else {
- t.Error("annotate should not remove previous data entries")
- }
- if res, ok := typedError.Stack[1].Data["foo"]; ok {
- if res != "bar" {
- t.Error("global state should set value properly in annotate")
- }
- } else {
- t.Error("global state should set key properly in annotate")
- }
- if res, ok := typedError.Stack[1].Data["foo2"]; ok {
- if res != "bar2" {
- // typedError = Error(typedError, nil).(WrappedError)
- t.Error("foo2 -> bar should be set")
- }
- } else {
- // typedError = Error(typedError, nil).(WrappedError)
- t.Error("foo2 should be set")
- }
- }
- }
-}
-
-func TestToError(t *testing.T) {
- _, err := os.Stat("hello")
- ierr := New(err, nil)
- if ToError(ierr) != err {
- t.Error("Error is not the same")
- }
- ierr = New(ierr, nil)
- if ToError(ierr) != err {
- t.Error("Stacked Error is not the same")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/minio/pkg/probe/probe_test.go b/Godeps/_workspace/src/github.com/minio/minio/pkg/probe/probe_test.go
deleted file mode 100644
index 25f99dce..00000000
--- a/Godeps/_workspace/src/github.com/minio/minio/pkg/probe/probe_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Minio Cloud Storage, (C) 2015 Minio, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package probe_test
-
-import (
- "os"
- "testing"
-
- "github.com/minio/minio/pkg/probe"
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) { TestingT(t) }
-
-type MySuite struct{}
-
-var _ = Suite(&MySuite{})
-
-func testDummy() *probe.Error {
- _, e := os.Stat("this-file-cannot-exit")
- es := probe.NewError(e)
- es.Trace("Important info 1", "Import into 2")
- return es
-}
-
-func (s *MySuite) TestProbe(c *C) {
- es := testDummy()
- c.Assert(es, Not(Equals), nil)
-
- newES := es.Trace()
- c.Assert(newES, Not(Equals), nil)
-}
-
-func (s *MySuite) TestWrappedError(c *C) {
- _, e := os.Stat("this-file-cannot-exit")
- es := probe.NewError(e) // *probe.Error
- e = probe.NewWrappedError(es) // *probe.WrappedError
- _, ok := probe.ToWrappedError(e)
- c.Assert(ok, Equals, true)
-}
diff --git a/Godeps/_workspace/src/github.com/minio/pb/.travis.yml b/Godeps/_workspace/src/github.com/minio/pb/.travis.yml
deleted file mode 100644
index 6e3b6fc0..00000000
--- a/Godeps/_workspace/src/github.com/minio/pb/.travis.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-language: go
-go:
-- 1.4.2
-sudo: false
diff --git a/Godeps/_workspace/src/github.com/minio/pb/example/copy/copy.go b/Godeps/_workspace/src/github.com/minio/pb/example/copy/copy.go
deleted file mode 100644
index 82b5329a..00000000
--- a/Godeps/_workspace/src/github.com/minio/pb/example/copy/copy.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package main
-
-import (
- "fmt"
- "github.com/cheggaaa/pb"
- "io"
- "net/http"
- "os"
- "strconv"
- "strings"
- "time"
-)
-
-func main() {
- // check args
- if len(os.Args) < 3 {
- printUsage()
- return
- }
- sourceName, destName := os.Args[1], os.Args[2]
-
- // check source
- var source io.Reader
- var sourceSize int64
- if strings.HasPrefix(sourceName, "http://") {
- // open as url
- resp, err := http.Get(sourceName)
- if err != nil {
- fmt.Printf("Can't get %s: %v\n", sourceName, err)
- return
- }
- defer resp.Body.Close()
- if resp.StatusCode != http.StatusOK {
- fmt.Printf("Server return non-200 status: %v\n", resp.Status)
- return
- }
- i, _ := strconv.Atoi(resp.Header.Get("Content-Length"))
- sourceSize = int64(i)
- source = resp.Body
- } else {
- // open as file
- s, err := os.Open(sourceName)
- if err != nil {
- fmt.Printf("Can't open %s: %v\n", sourceName, err)
- return
- }
- defer s.Close()
- // get source size
- sourceStat, err := s.Stat()
- if err != nil {
- fmt.Printf("Can't stat %s: %v\n", sourceName, err)
- return
- }
- sourceSize = sourceStat.Size()
- source = s
- }
-
- // create dest
- dest, err := os.Create(destName)
- if err != nil {
- fmt.Printf("Can't create %s: %v\n", destName, err)
- return
- }
- defer dest.Close()
-
- // create bar
- bar := pb.New(int(sourceSize)).SetUnits(pb.U_BYTES).SetRefreshRate(time.Millisecond * 10)
- bar.ShowSpeed = true
- bar.Start()
-
- // create multi writer
- writer := io.MultiWriter(dest, bar)
-
- // and copy
- io.Copy(writer, source)
- bar.Finish()
-}
-
-func printUsage() {
- fmt.Println("copy [source file or url] [dest file]")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/pb/example/pb.go b/Godeps/_workspace/src/github.com/minio/pb/example/pb.go
deleted file mode 100644
index 57a3fe4b..00000000
--- a/Godeps/_workspace/src/github.com/minio/pb/example/pb.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package main
-
-import (
- "github.com/cheggaaa/pb"
- "time"
-)
-
-func main() {
- count := 5000
- bar := pb.New(count)
-
- // show percents (by default already true)
- bar.ShowPercent = true
-
- // show bar (by default already true)
- bar.ShowBar = true
-
- // no need counters
- bar.ShowCounters = true
-
- bar.ShowTimeLeft = true
-
- // and start
- bar.Start()
- for i := 0; i < count; i++ {
- bar.Increment()
- time.Sleep(time.Millisecond)
- }
- bar.FinishPrint("The End!")
-}
diff --git a/Godeps/_workspace/src/github.com/minio/pb/format_test.go b/Godeps/_workspace/src/github.com/minio/pb/format_test.go
deleted file mode 100644
index b76275e2..00000000
--- a/Godeps/_workspace/src/github.com/minio/pb/format_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package pb
-
-import (
- "fmt"
- "strconv"
- "testing"
-)
-
-func Test_DefaultsToInteger(t *testing.T) {
- value := int64(1000)
- expected := strconv.Itoa(int(value))
- actual := Format(value, -1)
-
- if actual != expected {
- t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
- }
-}
-
-func Test_CanFormatAsInteger(t *testing.T) {
- value := int64(1000)
- expected := strconv.Itoa(int(value))
- actual := Format(value, U_NO)
-
- if actual != expected {
- t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
- }
-}
-
-func Test_CanFormatAsBytes(t *testing.T) {
- value := int64(1000)
- expected := "1000 B"
- actual := Format(value, U_BYTES)
-
- if actual != expected {
- t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
- }
-}
diff --git a/Godeps/_workspace/src/github.com/minio/pb/pb_test.go b/Godeps/_workspace/src/github.com/minio/pb/pb_test.go
deleted file mode 100644
index dfe394fd..00000000
--- a/Godeps/_workspace/src/github.com/minio/pb/pb_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package pb
-
-import (
- "testing"
-)
-
-func Test_IncrementAddsOne(t *testing.T) {
- count := 5000
- bar := New(count)
- expected := 1
- actual := bar.Increment()
-
- if actual != expected {
- t.Errorf("Expected {%d} was {%d}", expected, actual)
- }
-}
-
-func Test_Width(t *testing.T) {
- count := 5000
- bar := New(count)
- width := 100
- bar.SetWidth(100).Callback = func(out string) {
- if len(out) != width {
- t.Errorf("Bar width expected {%d} was {%d}", len(out), width)
- }
- }
- bar.Start()
- bar.Increment()
- bar.Finish()
-}
-
-func Test_MultipleFinish(t *testing.T) {
- bar := New(5000)
- bar.Add(2000)
- bar.Finish()
- bar.Finish()
-}
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/.travis.yml b/Godeps/_workspace/src/github.com/olekukonko/ts/.travis.yml
deleted file mode 100644
index e53b2de3..00000000
--- a/Godeps/_workspace/src/github.com/olekukonko/ts/.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-language: go
-
-go:
- - 1.1
- - 1.2
- - tip
\ No newline at end of file
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_test.go b/Godeps/_workspace/src/github.com/olekukonko/ts/ts_test.go
deleted file mode 100644
index 4998e7c0..00000000
--- a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_test.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 Oleku Konko All rights reserved.
-// Use of this source code is governed by a MIT
-// license that can be found in the LICENSE file.
-
-// This module is a Terminal API for the Go Programming Language.
-// The protocols were written in pure Go and works on windows and unix systems
-
-package ts
-
-import (
- "fmt"
- "testing"
-)
-
-func ExampleGetSize() {
- size, _ := GetSize()
- fmt.Println(size.Col()) // Get Width
- fmt.Println(size.Row()) // Get Height
- fmt.Println(size.PosX()) // Get X position
- fmt.Println(size.PosY()) // Get Y position
-}
-
-func TestSize(t *testing.T) {
- size, err := GetSize()
-
- if err != nil {
- t.Fatal(err)
- }
- if size.Col() == 0 || size.Row() == 0 {
- t.Fatalf("Screen Size Failed")
- }
-}
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore b/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore
deleted file mode 100644
index 69cec52c..00000000
--- a/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore
+++ /dev/null
@@ -1,27 +0,0 @@
-# Created by http://www.gitignore.io
-
-### Go ###
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go
deleted file mode 100644
index d86cfc0f..00000000
--- a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 shiena Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-/*
-
-The ansicolor command colors a console text by ANSI escape sequence like wac.
-
- $ go get github.com/shiena/ansicolor/ansicolor
-
-See also:
- https://github.com/aslakhellesoy/wac
-
-*/
-package main
-
-import (
- "io"
- "os"
-
- "github.com/shiena/ansicolor"
-)
-
-func main() {
- w := ansicolor.NewAnsiColorWriter(os.Stdout)
- io.Copy(w, os.Stdin)
-}
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go
deleted file mode 100644
index 4feeb1de..00000000
--- a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package ansicolor_test
-
-import (
- "bytes"
- "testing"
-
- "github.com/shiena/ansicolor"
-)
-
-func TestNewAnsiColor1(t *testing.T) {
- inner := bytes.NewBufferString("")
- w := ansicolor.NewAnsiColorWriter(inner)
- if w == inner {
- t.Errorf("Get %#v, want %#v", w, inner)
- }
-}
-
-func TestNewAnsiColor2(t *testing.T) {
- inner := bytes.NewBufferString("")
- w1 := ansicolor.NewAnsiColorWriter(inner)
- w2 := ansicolor.NewAnsiColorWriter(w1)
- if w1 != w2 {
- t.Errorf("Get %#v, want %#v", w1, w2)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go
deleted file mode 100644
index 6c126d51..00000000
--- a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright 2014 shiena Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package ansicolor_test
-
-import (
- "bytes"
- "fmt"
- "syscall"
- "testing"
-
- "github.com/shiena/ansicolor"
- . "github.com/shiena/ansicolor"
-)
-
-func TestWritePlanText(t *testing.T) {
- inner := bytes.NewBufferString("")
- w := ansicolor.NewAnsiColorWriter(inner)
- expected := "plain text"
- fmt.Fprintf(w, expected)
- actual := inner.String()
- if actual != expected {
- t.Errorf("Get %s, want %s", actual, expected)
- }
-}
-
-func TestWriteParseText(t *testing.T) {
- inner := bytes.NewBufferString("")
- w := ansicolor.NewAnsiColorWriter(inner)
-
- inputTail := "\x1b[0mtail text"
- expectedTail := "tail text"
- fmt.Fprintf(w, inputTail)
- actualTail := inner.String()
- inner.Reset()
- if actualTail != expectedTail {
- t.Errorf("Get %s, want %s", actualTail, expectedTail)
- }
-
- inputHead := "head text\x1b[0m"
- expectedHead := "head text"
- fmt.Fprintf(w, inputHead)
- actualHead := inner.String()
- inner.Reset()
- if actualHead != expectedHead {
- t.Errorf("Get %s, want %s", actualHead, expectedHead)
- }
-
- inputBothEnds := "both ends \x1b[0m text"
- expectedBothEnds := "both ends text"
- fmt.Fprintf(w, inputBothEnds)
- actualBothEnds := inner.String()
- inner.Reset()
- if actualBothEnds != expectedBothEnds {
- t.Errorf("Get %s, want %s", actualBothEnds, expectedBothEnds)
- }
-
- inputManyEsc := "\x1b\x1b\x1b\x1b[0m many esc"
- expectedManyEsc := "\x1b\x1b\x1b many esc"
- fmt.Fprintf(w, inputManyEsc)
- actualManyEsc := inner.String()
- inner.Reset()
- if actualManyEsc != expectedManyEsc {
- t.Errorf("Get %s, want %s", actualManyEsc, expectedManyEsc)
- }
-
- expectedSplit := "split text"
- for _, ch := range "split \x1b[0m text" {
- fmt.Fprintf(w, string(ch))
- }
- actualSplit := inner.String()
- inner.Reset()
- if actualSplit != expectedSplit {
- t.Errorf("Get %s, want %s", actualSplit, expectedSplit)
- }
-}
-
-type screenNotFoundError struct {
- error
-}
-
-func writeAnsiColor(expectedText, colorCode string) (actualText string, actualAttributes uint16, err error) {
- inner := bytes.NewBufferString("")
- w := ansicolor.NewAnsiColorWriter(inner)
- fmt.Fprintf(w, "\x1b[%sm%s", colorCode, expectedText)
-
- actualText = inner.String()
- screenInfo := GetConsoleScreenBufferInfo(uintptr(syscall.Stdout))
- if screenInfo != nil {
- actualAttributes = screenInfo.WAttributes
- } else {
- err = &screenNotFoundError{}
- }
- return
-}
-
-type testParam struct {
- text string
- attributes uint16
- ansiColor string
-}
-
-func TestWriteAnsiColorText(t *testing.T) {
- screenInfo := GetConsoleScreenBufferInfo(uintptr(syscall.Stdout))
- if screenInfo == nil {
- t.Fatal("Could not get ConsoleScreenBufferInfo")
- }
- defer ChangeColor(screenInfo.WAttributes)
- defaultFgColor := screenInfo.WAttributes & uint16(0x0007)
- defaultBgColor := screenInfo.WAttributes & uint16(0x0070)
- defaultFgIntensity := screenInfo.WAttributes & uint16(0x0008)
- defaultBgIntensity := screenInfo.WAttributes & uint16(0x0080)
-
- fgParam := []testParam{
- {"foreground black ", uint16(0x0000 | 0x0000), "30"},
- {"foreground red ", uint16(0x0004 | 0x0000), "31"},
- {"foreground green ", uint16(0x0002 | 0x0000), "32"},
- {"foreground yellow ", uint16(0x0006 | 0x0000), "33"},
- {"foreground blue ", uint16(0x0001 | 0x0000), "34"},
- {"foreground magenta", uint16(0x0005 | 0x0000), "35"},
- {"foreground cyan ", uint16(0x0003 | 0x0000), "36"},
- {"foreground white ", uint16(0x0007 | 0x0000), "37"},
- {"foreground default", defaultFgColor | 0x0000, "39"},
- {"foreground light gray ", uint16(0x0000 | 0x0008 | 0x0000), "90"},
- {"foreground light red ", uint16(0x0004 | 0x0008 | 0x0000), "91"},
- {"foreground light green ", uint16(0x0002 | 0x0008 | 0x0000), "92"},
- {"foreground light yellow ", uint16(0x0006 | 0x0008 | 0x0000), "93"},
- {"foreground light blue ", uint16(0x0001 | 0x0008 | 0x0000), "94"},
- {"foreground light magenta", uint16(0x0005 | 0x0008 | 0x0000), "95"},
- {"foreground light cyan ", uint16(0x0003 | 0x0008 | 0x0000), "96"},
- {"foreground light white ", uint16(0x0007 | 0x0008 | 0x0000), "97"},
- }
-
- bgParam := []testParam{
- {"background black ", uint16(0x0007 | 0x0000), "40"},
- {"background red ", uint16(0x0007 | 0x0040), "41"},
- {"background green ", uint16(0x0007 | 0x0020), "42"},
- {"background yellow ", uint16(0x0007 | 0x0060), "43"},
- {"background blue ", uint16(0x0007 | 0x0010), "44"},
- {"background magenta", uint16(0x0007 | 0x0050), "45"},
- {"background cyan ", uint16(0x0007 | 0x0030), "46"},
- {"background white ", uint16(0x0007 | 0x0070), "47"},
- {"background default", uint16(0x0007) | defaultBgColor, "49"},
- {"background light gray ", uint16(0x0007 | 0x0000 | 0x0080), "100"},
- {"background light red ", uint16(0x0007 | 0x0040 | 0x0080), "101"},
- {"background light green ", uint16(0x0007 | 0x0020 | 0x0080), "102"},
- {"background light yellow ", uint16(0x0007 | 0x0060 | 0x0080), "103"},
- {"background light blue ", uint16(0x0007 | 0x0010 | 0x0080), "104"},
- {"background light magenta", uint16(0x0007 | 0x0050 | 0x0080), "105"},
- {"background light cyan ", uint16(0x0007 | 0x0030 | 0x0080), "106"},
- {"background light white ", uint16(0x0007 | 0x0070 | 0x0080), "107"},
- }
-
- resetParam := []testParam{
- {"all reset", defaultFgColor | defaultBgColor | defaultFgIntensity | defaultBgIntensity, "0"},
- {"all reset", defaultFgColor | defaultBgColor | defaultFgIntensity | defaultBgIntensity, ""},
- }
-
- boldParam := []testParam{
- {"bold on", uint16(0x0007 | 0x0008), "1"},
- {"bold off", uint16(0x0007), "21"},
- }
-
- underscoreParam := []testParam{
- {"underscore on", uint16(0x0007 | 0x8000), "4"},
- {"underscore off", uint16(0x0007), "24"},
- }
-
- blinkParam := []testParam{
- {"blink on", uint16(0x0007 | 0x0080), "5"},
- {"blink off", uint16(0x0007), "25"},
- }
-
- mixedParam := []testParam{
- {"both black, bold, underline, blink", uint16(0x0000 | 0x0000 | 0x0008 | 0x8000 | 0x0080), "30;40;1;4;5"},
- {"both red, bold, underline, blink", uint16(0x0004 | 0x0040 | 0x0008 | 0x8000 | 0x0080), "31;41;1;4;5"},
- {"both green, bold, underline, blink", uint16(0x0002 | 0x0020 | 0x0008 | 0x8000 | 0x0080), "32;42;1;4;5"},
- {"both yellow, bold, underline, blink", uint16(0x0006 | 0x0060 | 0x0008 | 0x8000 | 0x0080), "33;43;1;4;5"},
- {"both blue, bold, underline, blink", uint16(0x0001 | 0x0010 | 0x0008 | 0x8000 | 0x0080), "34;44;1;4;5"},
- {"both magenta, bold, underline, blink", uint16(0x0005 | 0x0050 | 0x0008 | 0x8000 | 0x0080), "35;45;1;4;5"},
- {"both cyan, bold, underline, blink", uint16(0x0003 | 0x0030 | 0x0008 | 0x8000 | 0x0080), "36;46;1;4;5"},
- {"both white, bold, underline, blink", uint16(0x0007 | 0x0070 | 0x0008 | 0x8000 | 0x0080), "37;47;1;4;5"},
- {"both default, bold, underline, blink", uint16(defaultFgColor | defaultBgColor | 0x0008 | 0x8000 | 0x0080), "39;49;1;4;5"},
- }
-
- assertTextAttribute := func(expectedText string, expectedAttributes uint16, ansiColor string) {
- actualText, actualAttributes, err := writeAnsiColor(expectedText, ansiColor)
- if actualText != expectedText {
- t.Errorf("Get %s, want %s", actualText, expectedText)
- }
- if err != nil {
- t.Fatal("Could not get ConsoleScreenBufferInfo")
- }
- if actualAttributes != expectedAttributes {
- t.Errorf("Text: %s, Get 0x%04x, want 0x%04x", expectedText, actualAttributes, expectedAttributes)
- }
- }
-
- for _, v := range fgParam {
- ResetColor()
- assertTextAttribute(v.text, v.attributes, v.ansiColor)
- }
-
- for _, v := range bgParam {
- ChangeColor(uint16(0x0070 | 0x0007))
- assertTextAttribute(v.text, v.attributes, v.ansiColor)
- }
-
- for _, v := range resetParam {
- ChangeColor(uint16(0x0000 | 0x0070 | 0x0008))
- assertTextAttribute(v.text, v.attributes, v.ansiColor)
- }
-
- ResetColor()
- for _, v := range boldParam {
- assertTextAttribute(v.text, v.attributes, v.ansiColor)
- }
-
- ResetColor()
- for _, v := range underscoreParam {
- assertTextAttribute(v.text, v.attributes, v.ansiColor)
- }
-
- ResetColor()
- for _, v := range blinkParam {
- assertTextAttribute(v.text, v.attributes, v.ansiColor)
- }
-
- for _, v := range mixedParam {
- ResetColor()
- assertTextAttribute(v.text, v.attributes, v.ansiColor)
- }
-}
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go
deleted file mode 100644
index f2ac67c1..00000000
--- a/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2014 shiena Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package ansicolor_test
-
-import (
- "fmt"
- "os"
-
- "github.com/shiena/ansicolor"
-)
-
-func ExampleNewAnsiColorWriter() {
- w := ansicolor.NewAnsiColorWriter(os.Stdout)
- text := "%sforeground %sbold%s %sbackground%s\n"
- fmt.Fprintf(w, text, "\x1b[31m", "\x1b[1m", "\x1b[21m", "\x1b[41;32m", "\x1b[0m")
- fmt.Fprintf(w, text, "\x1b[32m", "\x1b[1m", "\x1b[21m", "\x1b[42;31m", "\x1b[0m")
- fmt.Fprintf(w, text, "\x1b[33m", "\x1b[1m", "\x1b[21m", "\x1b[43;34m", "\x1b[0m")
- fmt.Fprintf(w, text, "\x1b[34m", "\x1b[1m", "\x1b[21m", "\x1b[44;33m", "\x1b[0m")
- fmt.Fprintf(w, text, "\x1b[35m", "\x1b[1m", "\x1b[21m", "\x1b[45;36m", "\x1b[0m")
- fmt.Fprintf(w, text, "\x1b[36m", "\x1b[1m", "\x1b[21m", "\x1b[46;35m", "\x1b[0m")
- fmt.Fprintf(w, text, "\x1b[37m", "\x1b[1m", "\x1b[21m", "\x1b[47;30m", "\x1b[0m")
-}
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go
deleted file mode 100644
index 6d2f7c07..00000000
--- a/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2014 shiena Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package ansicolor
-
-import "syscall"
-
-var GetConsoleScreenBufferInfo = getConsoleScreenBufferInfo
-
-func ChangeColor(color uint16) {
- setConsoleTextAttribute(uintptr(syscall.Stdout), color)
-}
-
-func ResetColor() {
- ChangeColor(uint16(0x0007))
-}
diff --git a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_dense_test.go b/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_dense_test.go
deleted file mode 100644
index 96089fce..00000000
--- a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_dense_test.go
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) 2014 The go-patricia AUTHORS
-//
-// Use of this source code is governed by The MIT License
-// that can be found in the LICENSE file.
-
-package patricia
-
-import (
- "testing"
-)
-
-// Tests -----------------------------------------------------------------------
-
-func TestTrie_InsertDense(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"aba", 0, success},
- {"abb", 1, success},
- {"abc", 2, success},
- {"abd", 3, success},
- {"abe", 4, success},
- {"abf", 5, success},
- {"abg", 6, success},
- {"abh", 7, success},
- {"abi", 8, success},
- {"abj", 9, success},
- {"abk", 0, success},
- {"abl", 1, success},
- {"abm", 2, success},
- {"abn", 3, success},
- {"abo", 4, success},
- {"abp", 5, success},
- {"abq", 6, success},
- {"abr", 7, success},
- {"abs", 8, success},
- {"abt", 9, success},
- {"abu", 0, success},
- {"abv", 1, success},
- {"abw", 2, success},
- {"abx", 3, success},
- {"aby", 4, success},
- {"abz", 5, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-func TestTrie_InsertDensePreceeding(t *testing.T) {
- trie := NewTrie()
- start := byte(70)
- // create a dense node
- for i := byte(0); i <= DefaultMaxChildrenPerSparseNode; i++ {
- if !trie.Insert(Prefix([]byte{start + i}), true) {
- t.Errorf("insert failed, prefix=%v", start+i)
- }
- }
- // insert some preceeding keys
- for i := byte(1); i < start; i *= i + 1 {
- if !trie.Insert(Prefix([]byte{start - i}), true) {
- t.Errorf("insert failed, prefix=%v", start-i)
- }
- }
-}
-
-func TestTrie_InsertDenseDuplicatePrefixes(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"aba", 0, success},
- {"abb", 1, success},
- {"abc", 2, success},
- {"abd", 3, success},
- {"abe", 4, success},
- {"abf", 5, success},
- {"abg", 6, success},
- {"abh", 7, success},
- {"abi", 8, success},
- {"abj", 9, success},
- {"abk", 0, success},
- {"abl", 1, success},
- {"abm", 2, success},
- {"abn", 3, success},
- {"abo", 4, success},
- {"abp", 5, success},
- {"abq", 6, success},
- {"abr", 7, success},
- {"abs", 8, success},
- {"abt", 9, success},
- {"abu", 0, success},
- {"abv", 1, success},
- {"abw", 2, success},
- {"abx", 3, success},
- {"aby", 4, success},
- {"abz", 5, success},
- {"aba", 0, failure},
- {"abb", 1, failure},
- {"abc", 2, failure},
- {"abd", 3, failure},
- {"abe", 4, failure},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-func TestTrie_DeleteDense(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"aba", 0, success},
- {"abb", 1, success},
- {"abc", 2, success},
- {"abd", 3, success},
- {"abe", 4, success},
- {"abf", 5, success},
- {"abg", 6, success},
- {"abh", 7, success},
- {"abi", 8, success},
- {"abj", 9, success},
- {"abk", 0, success},
- {"abl", 1, success},
- {"abm", 2, success},
- {"abn", 3, success},
- {"abo", 4, success},
- {"abp", 5, success},
- {"abq", 6, success},
- {"abr", 7, success},
- {"abs", 8, success},
- {"abt", 9, success},
- {"abu", 0, success},
- {"abv", 1, success},
- {"abw", 2, success},
- {"abx", 3, success},
- {"aby", 4, success},
- {"abz", 5, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- for _, v := range data {
- t.Logf("DELETE word=%v, success=%v", v.key, v.retVal)
- if ok := trie.Delete([]byte(v.key)); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
diff --git a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_sparse_test.go b/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_sparse_test.go
deleted file mode 100644
index ab97d1e5..00000000
--- a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_sparse_test.go
+++ /dev/null
@@ -1,659 +0,0 @@
-// Copyright (c) 2014 The go-patricia AUTHORS
-//
-// Use of this source code is governed by The MIT License
-// that can be found in the LICENSE file.
-
-package patricia
-
-import (
- "bytes"
- "errors"
- "fmt"
- "strings"
- "testing"
-)
-
-const (
- success = true
- failure = false
-)
-
-type testData struct {
- key string
- value interface{}
- retVal bool
-}
-
-// Tests -----------------------------------------------------------------------
-
-func TestTrie_InsertDifferentPrefixes(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepaneeeeeeeeeeeeee", "Pepan Zdepan", success},
- {"Honzooooooooooooooo", "Honza Novak", success},
- {"Jenikuuuuuuuuuuuuuu", "Jenik Poustevnicek", success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-func TestTrie_InsertDuplicatePrefixes(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Pepan", "Pepan Zdepan", failure},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-func TestTrie_InsertVariousPrefixes(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Pepin", "Pepin Omacka", success},
- {"Honza", "Honza Novak", success},
- {"Jenik", "Jenik Poustevnicek", success},
- {"Pepan", "Pepan Dupan", failure},
- {"Karel", "Karel Pekar", success},
- {"Jenik", "Jenik Poustevnicek", failure},
- {"Pepanek", "Pepanek Zemlicka", success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-func TestTrie_InsertAndMatchPrefix(t *testing.T) {
- trie := NewTrie()
- t.Log("INSERT prefix=by week")
- trie.Insert(Prefix("by week"), 2)
- t.Log("INSERT prefix=by")
- trie.Insert(Prefix("by"), 1)
-
- if !trie.Match(Prefix("by")) {
- t.Error("MATCH prefix=by, expected=true, got=false")
- }
-}
-
-func TestTrie_SetGet(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Pepin", "Pepin Omacka", success},
- {"Honza", "Honza Novak", success},
- {"Jenik", "Jenik Poustevnicek", success},
- {"Pepan", "Pepan Dupan", failure},
- {"Karel", "Karel Pekar", success},
- {"Jenik", "Jenik Poustevnicek", failure},
- {"Pepanek", "Pepanek Zemlicka", success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- for _, v := range data {
- t.Logf("SET %q to 10", v.key)
- trie.Set(Prefix(v.key), 10)
- }
-
- for _, v := range data {
- value := trie.Get(Prefix(v.key))
- t.Logf("GET %q => %v", v.key, value)
- if value.(int) != 10 {
- t.Errorf("Unexpected return value, %v != 10", value)
- }
- }
-
- if value := trie.Get(Prefix("random crap")); value != nil {
- t.Errorf("Unexpected return value, %v != ", value)
- }
-}
-
-func TestTrie_Match(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Pepin", "Pepin Omacka", success},
- {"Honza", "Honza Novak", success},
- {"Jenik", "Jenik Poustevnicek", success},
- {"Pepan", "Pepan Dupan", failure},
- {"Karel", "Karel Pekar", success},
- {"Jenik", "Jenik Poustevnicek", failure},
- {"Pepanek", "Pepanek Zemlicka", success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- for _, v := range data {
- matched := trie.Match(Prefix(v.key))
- t.Logf("MATCH %q => %v", v.key, matched)
- if !matched {
- t.Errorf("Inserted key %q was not matched", v.key)
- }
- }
-
- if trie.Match(Prefix("random crap")) {
- t.Errorf("Key that was not inserted matched: %q", "random crap")
- }
-}
-
-func TestTrie_MatchFalsePositive(t *testing.T) {
- trie := NewTrie()
-
- if ok := trie.Insert(Prefix("A"), 1); !ok {
- t.Fatal("INSERT prefix=A, item=1 not ok")
- }
-
- resultMatchSubtree := trie.MatchSubtree(Prefix("A extra"))
- resultMatch := trie.Match(Prefix("A extra"))
-
- if resultMatchSubtree != false {
- t.Error("MatchSubtree returned false positive")
- }
-
- if resultMatch != false {
- t.Error("Match returned false positive")
- }
-}
-
-func TestTrie_MatchSubtree(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Pepin", "Pepin Omacka", success},
- {"Honza", "Honza Novak", success},
- {"Jenik", "Jenik Poustevnicek", success},
- {"Pepan", "Pepan Dupan", failure},
- {"Karel", "Karel Pekar", success},
- {"Jenik", "Jenik Poustevnicek", failure},
- {"Pepanek", "Pepanek Zemlicka", success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- for _, v := range data {
- key := Prefix(v.key[:3])
- matched := trie.MatchSubtree(key)
- t.Logf("MATCH_SUBTREE %q => %v", key, matched)
- if !matched {
- t.Errorf("Subtree %q was not matched", v.key)
- }
- }
-}
-
-func TestTrie_Visit(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepa", 0, success},
- {"Pepa Zdepa", 1, success},
- {"Pepa Kuchar", 2, success},
- {"Honza", 3, success},
- {"Jenik", 4, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- if err := trie.Visit(func(prefix Prefix, item Item) error {
- name := data[item.(int)].key
- t.Logf("VISITING prefix=%q, item=%v", prefix, item)
- if !strings.HasPrefix(string(prefix), name) {
- t.Errorf("Unexpected prefix encountered, %q not a prefix of %q", prefix, name)
- }
- return nil
- }); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestTrie_VisitSkipSubtree(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepa", 0, success},
- {"Pepa Zdepa", 1, success},
- {"Pepa Kuchar", 2, success},
- {"Honza", 3, success},
- {"Jenik", 4, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- if err := trie.Visit(func(prefix Prefix, item Item) error {
- t.Logf("VISITING prefix=%q, item=%v", prefix, item)
- if item.(int) == 0 {
- t.Logf("SKIP %q", prefix)
- return SkipSubtree
- }
- if strings.HasPrefix(string(prefix), "Pepa") {
- t.Errorf("Unexpected prefix encountered, %q", prefix)
- }
- return nil
- }); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestTrie_VisitReturnError(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepa", 0, success},
- {"Pepa Zdepa", 1, success},
- {"Pepa Kuchar", 2, success},
- {"Honza", 3, success},
- {"Jenik", 4, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- someErr := errors.New("Something exploded")
- if err := trie.Visit(func(prefix Prefix, item Item) error {
- t.Logf("VISITING prefix=%q, item=%v", prefix, item)
- if item.(int) == 3 {
- return someErr
- }
- if item.(int) != 3 {
- t.Errorf("Unexpected prefix encountered, %q", prefix)
- }
- return nil
- }); err != nil && err != someErr {
- t.Fatal(err)
- }
-}
-
-func TestTrie_VisitSubtree(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepa", 0, success},
- {"Pepa Zdepa", 1, success},
- {"Pepa Kuchar", 2, success},
- {"Honza", 3, success},
- {"Jenik", 4, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- var counter int
- subtreePrefix := []byte("Pep")
- t.Log("VISIT Pep")
- if err := trie.VisitSubtree(subtreePrefix, func(prefix Prefix, item Item) error {
- t.Logf("VISITING prefix=%q, item=%v", prefix, item)
- if !bytes.HasPrefix(prefix, subtreePrefix) {
- t.Errorf("Unexpected prefix encountered, %q does not extend %q",
- prefix, subtreePrefix)
- }
- if len(prefix) > len(data[item.(int)].key) {
- t.Fatalf("Something is rather fishy here, prefix=%q", prefix)
- }
- counter++
- return nil
- }); err != nil {
- t.Fatal(err)
- }
-
- if counter != 3 {
- t.Error("Unexpected number of nodes visited")
- }
-}
-
-func TestTrie_VisitPrefixes(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"P", 0, success},
- {"Pe", 1, success},
- {"Pep", 2, success},
- {"Pepa", 3, success},
- {"Pepa Zdepa", 4, success},
- {"Pepa Kuchar", 5, success},
- {"Honza", 6, success},
- {"Jenik", 7, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- var counter int
- word := []byte("Pepa")
- if err := trie.VisitPrefixes(word, func(prefix Prefix, item Item) error {
- t.Logf("VISITING prefix=%q, item=%v", prefix, item)
- if !bytes.HasPrefix(word, prefix) {
- t.Errorf("Unexpected prefix encountered, %q is not a prefix of %q",
- prefix, word)
- }
- counter++
- return nil
- }); err != nil {
- t.Fatal(err)
- }
-
- if counter != 4 {
- t.Error("Unexpected number of nodes visited")
- }
-}
-
-func TestParticiaTrie_Delete(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Honza", "Honza Novak", success},
- {"Jenik", "Jenik Poustevnicek", success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- for _, v := range data {
- t.Logf("DELETE word=%v, success=%v", v.key, v.retVal)
- if ok := trie.Delete([]byte(v.key)); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-func TestParticiaTrie_DeleteNonExistent(t *testing.T) {
- trie := NewTrie()
-
- insertData := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Honza", "Honza Novak", success},
- {"Jenik", "Jenik Poustevnicek", success},
- }
- deleteData := []testData{
- {"Pepan", "Pepan Zdepan", success},
- {"Honza", "Honza Novak", success},
- {"Pepan", "Pepan Zdepan", failure},
- {"Jenik", "Jenik Poustevnicek", success},
- {"Honza", "Honza Novak", failure},
- }
-
- for _, v := range insertData {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- for _, v := range deleteData {
- t.Logf("DELETE word=%v, success=%v", v.key, v.retVal)
- if ok := trie.Delete([]byte(v.key)); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-func TestParticiaTrie_DeleteSubtree(t *testing.T) {
- trie := NewTrie()
-
- insertData := []testData{
- {"P", 0, success},
- {"Pe", 1, success},
- {"Pep", 2, success},
- {"Pepa", 3, success},
- {"Pepa Zdepa", 4, success},
- {"Pepa Kuchar", 5, success},
- {"Honza", 6, success},
- {"Jenik", 7, success},
- }
- deleteData := []testData{
- {"Pe", -1, success},
- {"Pe", -1, failure},
- {"Honzik", -1, failure},
- {"Honza", -1, success},
- {"Honza", -1, failure},
- {"Pep", -1, failure},
- {"P", -1, success},
- {"Nobody", -1, failure},
- {"", -1, success},
- }
-
- for _, v := range insertData {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Fatalf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- for _, v := range deleteData {
- t.Logf("DELETE_SUBTREE prefix=%v, success=%v", v.key, v.retVal)
- if ok := trie.DeleteSubtree([]byte(v.key)); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-}
-
-/*
-func TestTrie_Dump(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"Honda", nil, success},
- {"Honza", nil, success},
- {"Jenik", nil, success},
- {"Pepan", nil, success},
- {"Pepin", nil, success},
- }
-
- for i, v := range data {
- if _, ok := trie.Insert([]byte(v.key), v.value); ok != v.retVal {
- t.Logf("INSERT %v %v", v.key, v.value)
- t.Fatalf("Unexpected return value, expected=%v, got=%v", i, ok)
- }
- }
-
- dump := `
-+--+--+ Hon +--+--+ da
- | |
- | +--+ za
- |
- +--+ Jenik
- |
- +--+ Pep +--+--+ an
- |
- +--+ in
-`
-
- var buf bytes.Buffer
- trie.Dump(buf)
-
- if !bytes.Equal(buf.Bytes(), dump) {
- t.Logf("DUMP")
- t.Fatalf("Unexpected dump generated, expected\n\n%v\ngot\n\n%v", dump, buf.String())
- }
-}
-*/
-
-func TestTrie_compact(t *testing.T) {
- trie := NewTrie()
-
- trie.Insert(Prefix("a"), 0)
- trie.Insert(Prefix("ab"), 0)
- trie.Insert(Prefix("abc"), 0)
- trie.Insert(Prefix("abcd"), 0)
- trie.Insert(Prefix("abcde"), 0)
- trie.Insert(Prefix("abcdef"), 0)
- trie.Insert(Prefix("abcdefg"), 0)
- trie.Insert(Prefix("abcdefgi"), 0)
- trie.Insert(Prefix("abcdefgij"), 0)
- trie.Insert(Prefix("abcdefgijk"), 0)
-
- trie.Delete(Prefix("abcdef"))
- trie.Delete(Prefix("abcde"))
- trie.Delete(Prefix("abcdefg"))
-
- trie.Delete(Prefix("a"))
- trie.Delete(Prefix("abc"))
- trie.Delete(Prefix("ab"))
-
- trie.Visit(func(prefix Prefix, item Item) error {
- // 97 ~~ 'a',
- for ch := byte(97); ch <= 107; ch++ {
- if c := bytes.Count(prefix, []byte{ch}); c > 1 {
- t.Errorf("%q appeared in %q %v times", ch, prefix, c)
- }
- }
- return nil
- })
-}
-
-func TestTrie_longestCommonPrefixLenght(t *testing.T) {
- trie := NewTrie()
- trie.prefix = []byte("1234567890")
-
- switch {
- case trie.longestCommonPrefixLength([]byte("")) != 0:
- t.Fail()
- case trie.longestCommonPrefixLength([]byte("12345")) != 5:
- t.Fail()
- case trie.longestCommonPrefixLength([]byte("123789")) != 3:
- t.Fail()
- case trie.longestCommonPrefixLength([]byte("12345678901")) != 10:
- t.Fail()
- }
-}
-
-// Examples --------------------------------------------------------------------
-
-func ExampleTrie() {
- // Create a new tree.
- trie := NewTrie()
-
- // Insert some items.
- trie.Insert(Prefix("Pepa Novak"), 1)
- trie.Insert(Prefix("Pepa Sindelar"), 2)
- trie.Insert(Prefix("Karel Macha"), 3)
- trie.Insert(Prefix("Karel Hynek Macha"), 4)
-
- // Just check if some things are present in the tree.
- key := Prefix("Pepa Novak")
- fmt.Printf("%q present? %v\n", key, trie.Match(key))
- key = Prefix("Karel")
- fmt.Printf("Anybody called %q here? %v\n", key, trie.MatchSubtree(key))
-
- // Walk the tree.
- trie.Visit(printItem)
- // "Karel Hynek Macha": 4
- // "Karel Macha": 3
- // "Pepa Novak": 1
- // "Pepa Sindelar": 2
-
- // Walk a subtree.
- trie.VisitSubtree(Prefix("Pepa"), printItem)
- // "Pepa Novak": 1
- // "Pepa Sindelar": 2
-
- // Modify an item, then fetch it from the tree.
- trie.Set(Prefix("Karel Hynek Macha"), 10)
- key = Prefix("Karel Hynek Macha")
- fmt.Printf("%q: %v\n", key, trie.Get(key))
- // "Karel Hynek Macha": 10
-
- // Walk prefixes.
- prefix := Prefix("Karel Hynek Macha je kouzelnik")
- trie.VisitPrefixes(prefix, printItem)
- // "Karel Hynek Macha": 10
-
- // Delete some items.
- trie.Delete(Prefix("Pepa Novak"))
- trie.Delete(Prefix("Karel Macha"))
-
- // Walk again.
- trie.Visit(printItem)
- // "Karel Hynek Macha": 10
- // "Pepa Sindelar": 2
-
- // Delete a subtree.
- trie.DeleteSubtree(Prefix("Pepa"))
-
- // Print what is left.
- trie.Visit(printItem)
- // "Karel Hynek Macha": 10
-
- // Output:
- // "Pepa Novak" present? true
- // Anybody called "Karel" here? true
- // "Karel Hynek Macha": 4
- // "Karel Macha": 3
- // "Pepa Novak": 1
- // "Pepa Sindelar": 2
- // "Pepa Novak": 1
- // "Pepa Sindelar": 2
- // "Karel Hynek Macha": 10
- // "Karel Hynek Macha": 10
- // "Karel Hynek Macha": 10
- // "Pepa Sindelar": 2
- // "Karel Hynek Macha": 10
-}
-
-// Helpers ---------------------------------------------------------------------
-
-func printItem(prefix Prefix, item Item) error {
- fmt.Printf("%q: %v\n", prefix, item)
- return nil
-}
diff --git a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_test.go b/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_test.go
deleted file mode 100644
index 12c441b6..00000000
--- a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2014 The go-patricia AUTHORS
-//
-// Use of this source code is governed by The MIT License
-// that can be found in the LICENSE file.
-
-package patricia
-
-import (
- "crypto/rand"
- "reflect"
- "testing"
-)
-
-// Tests -----------------------------------------------------------------------
-
-func TestTrie_ConstructorOptions(t *testing.T) {
- trie := NewTrie(MaxPrefixPerNode(16), MaxChildrenPerSparseNode(10))
-
- if trie.maxPrefixPerNode != 16 {
- t.Errorf("Unexpected trie.maxPrefixPerNode value, expected=%v, got=%v",
- 16, trie.maxPrefixPerNode)
- }
-
- if trie.maxChildrenPerSparseNode != 10 {
- t.Errorf("Unexpected trie.maxChildrenPerSparseNode value, expected=%v, got=%v",
- 10, trie.maxChildrenPerSparseNode)
- }
-}
-
-func TestTrie_GetNonexistentPrefix(t *testing.T) {
- trie := NewTrie()
-
- data := []testData{
- {"aba", 0, success},
- }
-
- for _, v := range data {
- t.Logf("INSERT prefix=%v, item=%v, success=%v", v.key, v.value, v.retVal)
- if ok := trie.Insert(Prefix(v.key), v.value); ok != v.retVal {
- t.Errorf("Unexpected return value, expected=%v, got=%v", v.retVal, ok)
- }
- }
-
- t.Logf("GET prefix=baa, expect item=nil")
- if item := trie.Get(Prefix("baa")); item != nil {
- t.Errorf("Unexpected return value, expected=, got=%v", item)
- }
-}
-
-func TestTrie_RandomKitchenSink(t *testing.T) {
- if testing.Short() {
- t.Skip()
- }
- const count, size = 750000, 16
- b := make([]byte, count+size+1)
- if _, err := rand.Read(b); err != nil {
- t.Fatal("error generating random bytes", err)
- }
- m := make(map[string]string)
- for i := 0; i < count; i++ {
- m[string(b[i:i+size])] = string(b[i+1 : i+size+1])
- }
- trie := NewTrie()
- getAndDelete := func(k, v string) {
- i := trie.Get(Prefix(k))
- if i == nil {
- t.Fatalf("item not found, prefix=%v", []byte(k))
- } else if s, ok := i.(string); !ok {
- t.Fatalf("unexpected item type, expecting=%v, got=%v", reflect.TypeOf(k), reflect.TypeOf(i))
- } else if s != v {
- t.Fatalf("unexpected item, expecting=%v, got=%v", []byte(k), []byte(s))
- } else if !trie.Delete(Prefix(k)) {
- t.Fatalf("delete failed, prefix=%v", []byte(k))
- } else if i = trie.Get(Prefix(k)); i != nil {
- t.Fatalf("unexpected item, expecting=, got=%v", i)
- } else if trie.Delete(Prefix(k)) {
- t.Fatalf("extra delete succeeded, prefix=%v", []byte(k))
- }
- }
- for k, v := range m {
- if !trie.Insert(Prefix(k), v) {
- t.Fatalf("insert failed, prefix=%v", []byte(k))
- }
- if byte(k[size/2]) < 128 {
- getAndDelete(k, v)
- delete(m, k)
- }
- }
- for k, v := range m {
- getAndDelete(k, v)
- }
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/.gitignore b/Godeps/_workspace/src/gopkg.in/check.v1/.gitignore
deleted file mode 100644
index 191a5360..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-_*
-*.swp
-*.[568]
-[568].out
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/benchmark_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/benchmark_test.go
deleted file mode 100644
index 4dd827c1..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/benchmark_test.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// These tests verify the test running logic.
-
-package check_test
-
-import (
- "time"
- . "gopkg.in/check.v1"
-)
-
-var benchmarkS = Suite(&BenchmarkS{})
-
-type BenchmarkS struct{}
-
-func (s *BenchmarkS) TestCountSuite(c *C) {
- suitesRun += 1
-}
-
-func (s *BenchmarkS) TestBasicTestTiming(c *C) {
- helper := FixtureHelper{sleepOn: "Test1", sleep: 1000000 * time.Nanosecond}
- output := String{}
- runConf := RunConf{Output: &output, Verbose: true}
- Run(&helper, &runConf)
-
- expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Test1\t0\\.001s\n" +
- "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Test2\t0\\.000s\n"
- c.Assert(output.value, Matches, expected)
-}
-
-func (s *BenchmarkS) TestStreamTestTiming(c *C) {
- helper := FixtureHelper{sleepOn: "SetUpSuite", sleep: 1000000 * time.Nanosecond}
- output := String{}
- runConf := RunConf{Output: &output, Stream: true}
- Run(&helper, &runConf)
-
- expected := "(?s).*\nPASS: check_test\\.go:[0-9]+: FixtureHelper\\.SetUpSuite\t *0\\.001s\n.*"
- c.Assert(output.value, Matches, expected)
-}
-
-func (s *BenchmarkS) TestBenchmark(c *C) {
- helper := FixtureHelper{sleep: 100000}
- output := String{}
- runConf := RunConf{
- Output: &output,
- Benchmark: true,
- BenchmarkTime: 10000000,
- Filter: "Benchmark1",
- }
- Run(&helper, &runConf)
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Benchmark1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "SetUpTest")
- c.Check(helper.calls[5], Equals, "Benchmark1")
- c.Check(helper.calls[6], Equals, "TearDownTest")
- // ... and more.
-
- expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark1\t *100\t *[12][0-9]{5} ns/op\n"
- c.Assert(output.value, Matches, expected)
-}
-
-func (s *BenchmarkS) TestBenchmarkBytes(c *C) {
- helper := FixtureHelper{sleep: 100000}
- output := String{}
- runConf := RunConf{
- Output: &output,
- Benchmark: true,
- BenchmarkTime: 10000000,
- Filter: "Benchmark2",
- }
- Run(&helper, &runConf)
-
- expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark2\t *100\t *[12][0-9]{5} ns/op\t *[4-9]\\.[0-9]{2} MB/s\n"
- c.Assert(output.value, Matches, expected)
-}
-
-func (s *BenchmarkS) TestBenchmarkMem(c *C) {
- helper := FixtureHelper{sleep: 100000}
- output := String{}
- runConf := RunConf{
- Output: &output,
- Benchmark: true,
- BenchmarkMem: true,
- BenchmarkTime: 10000000,
- Filter: "Benchmark3",
- }
- Run(&helper, &runConf)
-
- expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark3\t *100\t *[12][0-9]{5} ns/op\t *[0-9]+ B/op\t *[1-9] allocs/op\n"
- c.Assert(output.value, Matches, expected)
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/bootstrap_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/bootstrap_test.go
deleted file mode 100644
index e55f327c..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/bootstrap_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// These initial tests are for bootstrapping. They verify that we can
-// basically use the testing infrastructure itself to check if the test
-// system is working.
-//
-// These tests use will break down the test runner badly in case of
-// errors because if they simply fail, we can't be sure the developer
-// will ever see anything (because failing means the failing system
-// somehow isn't working! :-)
-//
-// Do not assume *any* internal functionality works as expected besides
-// what's actually tested here.
-
-package check_test
-
-import (
- "fmt"
- "gopkg.in/check.v1"
- "strings"
-)
-
-type BootstrapS struct{}
-
-var boostrapS = check.Suite(&BootstrapS{})
-
-func (s *BootstrapS) TestCountSuite(c *check.C) {
- suitesRun += 1
-}
-
-func (s *BootstrapS) TestFailedAndFail(c *check.C) {
- if c.Failed() {
- critical("c.Failed() must be false first!")
- }
- c.Fail()
- if !c.Failed() {
- critical("c.Fail() didn't put the test in a failed state!")
- }
- c.Succeed()
-}
-
-func (s *BootstrapS) TestFailedAndSucceed(c *check.C) {
- c.Fail()
- c.Succeed()
- if c.Failed() {
- critical("c.Succeed() didn't put the test back in a non-failed state")
- }
-}
-
-func (s *BootstrapS) TestLogAndGetTestLog(c *check.C) {
- c.Log("Hello there!")
- log := c.GetTestLog()
- if log != "Hello there!\n" {
- critical(fmt.Sprintf("Log() or GetTestLog() is not working! Got: %#v", log))
- }
-}
-
-func (s *BootstrapS) TestLogfAndGetTestLog(c *check.C) {
- c.Logf("Hello %v", "there!")
- log := c.GetTestLog()
- if log != "Hello there!\n" {
- critical(fmt.Sprintf("Logf() or GetTestLog() is not working! Got: %#v", log))
- }
-}
-
-func (s *BootstrapS) TestRunShowsErrors(c *check.C) {
- output := String{}
- check.Run(&FailHelper{}, &check.RunConf{Output: &output})
- if strings.Index(output.value, "Expected failure!") == -1 {
- critical(fmt.Sprintf("RunWithWriter() output did not contain the "+
- "expected failure! Got: %#v",
- output.value))
- }
-}
-
-func (s *BootstrapS) TestRunDoesntShowSuccesses(c *check.C) {
- output := String{}
- check.Run(&SuccessHelper{}, &check.RunConf{Output: &output})
- if strings.Index(output.value, "Expected success!") != -1 {
- critical(fmt.Sprintf("RunWithWriter() output contained a successful "+
- "test! Got: %#v",
- output.value))
- }
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/check_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/check_test.go
deleted file mode 100644
index 871b3252..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/check_test.go
+++ /dev/null
@@ -1,207 +0,0 @@
-// This file contains just a few generic helpers which are used by the
-// other test files.
-
-package check_test
-
-import (
- "flag"
- "fmt"
- "os"
- "regexp"
- "runtime"
- "testing"
- "time"
-
- "gopkg.in/check.v1"
-)
-
-// We count the number of suites run at least to get a vague hint that the
-// test suite is behaving as it should. Otherwise a bug introduced at the
-// very core of the system could go unperceived.
-const suitesRunExpected = 8
-
-var suitesRun int = 0
-
-func Test(t *testing.T) {
- check.TestingT(t)
- if suitesRun != suitesRunExpected && flag.Lookup("check.f").Value.String() == "" {
- critical(fmt.Sprintf("Expected %d suites to run rather than %d",
- suitesRunExpected, suitesRun))
- }
-}
-
-// -----------------------------------------------------------------------
-// Helper functions.
-
-// Break down badly. This is used in test cases which can't yet assume
-// that the fundamental bits are working.
-func critical(error string) {
- fmt.Fprintln(os.Stderr, "CRITICAL: "+error)
- os.Exit(1)
-}
-
-// Return the file line where it's called.
-func getMyLine() int {
- if _, _, line, ok := runtime.Caller(1); ok {
- return line
- }
- return -1
-}
-
-// -----------------------------------------------------------------------
-// Helper type implementing a basic io.Writer for testing output.
-
-// Type implementing the io.Writer interface for analyzing output.
-type String struct {
- value string
-}
-
-// The only function required by the io.Writer interface. Will append
-// written data to the String.value string.
-func (s *String) Write(p []byte) (n int, err error) {
- s.value += string(p)
- return len(p), nil
-}
-
-// Trivial wrapper to test errors happening on a different file
-// than the test itself.
-func checkEqualWrapper(c *check.C, obtained, expected interface{}) (result bool, line int) {
- return c.Check(obtained, check.Equals, expected), getMyLine()
-}
-
-// -----------------------------------------------------------------------
-// Helper suite for testing basic fail behavior.
-
-type FailHelper struct {
- testLine int
-}
-
-func (s *FailHelper) TestLogAndFail(c *check.C) {
- s.testLine = getMyLine() - 1
- c.Log("Expected failure!")
- c.Fail()
-}
-
-// -----------------------------------------------------------------------
-// Helper suite for testing basic success behavior.
-
-type SuccessHelper struct{}
-
-func (s *SuccessHelper) TestLogAndSucceed(c *check.C) {
- c.Log("Expected success!")
-}
-
-// -----------------------------------------------------------------------
-// Helper suite for testing ordering and behavior of fixture.
-
-type FixtureHelper struct {
- calls []string
- panicOn string
- skip bool
- skipOnN int
- sleepOn string
- sleep time.Duration
- bytes int64
-}
-
-func (s *FixtureHelper) trace(name string, c *check.C) {
- s.calls = append(s.calls, name)
- if name == s.panicOn {
- panic(name)
- }
- if s.sleep > 0 && s.sleepOn == name {
- time.Sleep(s.sleep)
- }
- if s.skip && s.skipOnN == len(s.calls)-1 {
- c.Skip("skipOnN == n")
- }
-}
-
-func (s *FixtureHelper) SetUpSuite(c *check.C) {
- s.trace("SetUpSuite", c)
-}
-
-func (s *FixtureHelper) TearDownSuite(c *check.C) {
- s.trace("TearDownSuite", c)
-}
-
-func (s *FixtureHelper) SetUpTest(c *check.C) {
- s.trace("SetUpTest", c)
-}
-
-func (s *FixtureHelper) TearDownTest(c *check.C) {
- s.trace("TearDownTest", c)
-}
-
-func (s *FixtureHelper) Test1(c *check.C) {
- s.trace("Test1", c)
-}
-
-func (s *FixtureHelper) Test2(c *check.C) {
- s.trace("Test2", c)
-}
-
-func (s *FixtureHelper) Benchmark1(c *check.C) {
- s.trace("Benchmark1", c)
- for i := 0; i < c.N; i++ {
- time.Sleep(s.sleep)
- }
-}
-
-func (s *FixtureHelper) Benchmark2(c *check.C) {
- s.trace("Benchmark2", c)
- c.SetBytes(1024)
- for i := 0; i < c.N; i++ {
- time.Sleep(s.sleep)
- }
-}
-
-func (s *FixtureHelper) Benchmark3(c *check.C) {
- var x []int64
- s.trace("Benchmark3", c)
- for i := 0; i < c.N; i++ {
- time.Sleep(s.sleep)
- x = make([]int64, 5)
- _ = x
- }
-}
-
-// -----------------------------------------------------------------------
-// Helper which checks the state of the test and ensures that it matches
-// the given expectations. Depends on c.Errorf() working, so shouldn't
-// be used to test this one function.
-
-type expectedState struct {
- name string
- result interface{}
- failed bool
- log string
-}
-
-// Verify the state of the test. Note that since this also verifies if
-// the test is supposed to be in a failed state, no other checks should
-// be done in addition to what is being tested.
-func checkState(c *check.C, result interface{}, expected *expectedState) {
- failed := c.Failed()
- c.Succeed()
- log := c.GetTestLog()
- matched, matchError := regexp.MatchString("^"+expected.log+"$", log)
- if matchError != nil {
- c.Errorf("Error in matching expression used in testing %s",
- expected.name)
- } else if !matched {
- c.Errorf("%s logged:\n----------\n%s----------\n\nExpected:\n----------\n%s\n----------",
- expected.name, log, expected.log)
- }
- if result != expected.result {
- c.Errorf("%s returned %#v rather than %#v",
- expected.name, result, expected.result)
- }
- if failed != expected.failed {
- if failed {
- c.Errorf("%s has failed when it shouldn't", expected.name)
- } else {
- c.Errorf("%s has not failed when it should", expected.name)
- }
- }
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/checkers_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/checkers_test.go
deleted file mode 100644
index 5c697474..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/checkers_test.go
+++ /dev/null
@@ -1,272 +0,0 @@
-package check_test
-
-import (
- "errors"
- "gopkg.in/check.v1"
- "reflect"
- "runtime"
-)
-
-type CheckersS struct{}
-
-var _ = check.Suite(&CheckersS{})
-
-func testInfo(c *check.C, checker check.Checker, name string, paramNames []string) {
- info := checker.Info()
- if info.Name != name {
- c.Fatalf("Got name %s, expected %s", info.Name, name)
- }
- if !reflect.DeepEqual(info.Params, paramNames) {
- c.Fatalf("Got param names %#v, expected %#v", info.Params, paramNames)
- }
-}
-
-func testCheck(c *check.C, checker check.Checker, result bool, error string, params ...interface{}) ([]interface{}, []string) {
- info := checker.Info()
- if len(params) != len(info.Params) {
- c.Fatalf("unexpected param count in test; expected %d got %d", len(info.Params), len(params))
- }
- names := append([]string{}, info.Params...)
- result_, error_ := checker.Check(params, names)
- if result_ != result || error_ != error {
- c.Fatalf("%s.Check(%#v) returned (%#v, %#v) rather than (%#v, %#v)",
- info.Name, params, result_, error_, result, error)
- }
- return params, names
-}
-
-func (s *CheckersS) TestComment(c *check.C) {
- bug := check.Commentf("a %d bc", 42)
- comment := bug.CheckCommentString()
- if comment != "a 42 bc" {
- c.Fatalf("Commentf returned %#v", comment)
- }
-}
-
-func (s *CheckersS) TestIsNil(c *check.C) {
- testInfo(c, check.IsNil, "IsNil", []string{"value"})
-
- testCheck(c, check.IsNil, true, "", nil)
- testCheck(c, check.IsNil, false, "", "a")
-
- testCheck(c, check.IsNil, true, "", (chan int)(nil))
- testCheck(c, check.IsNil, false, "", make(chan int))
- testCheck(c, check.IsNil, true, "", (error)(nil))
- testCheck(c, check.IsNil, false, "", errors.New(""))
- testCheck(c, check.IsNil, true, "", ([]int)(nil))
- testCheck(c, check.IsNil, false, "", make([]int, 1))
- testCheck(c, check.IsNil, false, "", int(0))
-}
-
-func (s *CheckersS) TestNotNil(c *check.C) {
- testInfo(c, check.NotNil, "NotNil", []string{"value"})
-
- testCheck(c, check.NotNil, false, "", nil)
- testCheck(c, check.NotNil, true, "", "a")
-
- testCheck(c, check.NotNil, false, "", (chan int)(nil))
- testCheck(c, check.NotNil, true, "", make(chan int))
- testCheck(c, check.NotNil, false, "", (error)(nil))
- testCheck(c, check.NotNil, true, "", errors.New(""))
- testCheck(c, check.NotNil, false, "", ([]int)(nil))
- testCheck(c, check.NotNil, true, "", make([]int, 1))
-}
-
-func (s *CheckersS) TestNot(c *check.C) {
- testInfo(c, check.Not(check.IsNil), "Not(IsNil)", []string{"value"})
-
- testCheck(c, check.Not(check.IsNil), false, "", nil)
- testCheck(c, check.Not(check.IsNil), true, "", "a")
-}
-
-type simpleStruct struct {
- i int
-}
-
-func (s *CheckersS) TestEquals(c *check.C) {
- testInfo(c, check.Equals, "Equals", []string{"obtained", "expected"})
-
- // The simplest.
- testCheck(c, check.Equals, true, "", 42, 42)
- testCheck(c, check.Equals, false, "", 42, 43)
-
- // Different native types.
- testCheck(c, check.Equals, false, "", int32(42), int64(42))
-
- // With nil.
- testCheck(c, check.Equals, false, "", 42, nil)
-
- // Slices
- testCheck(c, check.Equals, false, "runtime error: comparing uncomparable type []uint8", []byte{1, 2}, []byte{1, 2})
-
- // Struct values
- testCheck(c, check.Equals, true, "", simpleStruct{1}, simpleStruct{1})
- testCheck(c, check.Equals, false, "", simpleStruct{1}, simpleStruct{2})
-
- // Struct pointers
- testCheck(c, check.Equals, false, "", &simpleStruct{1}, &simpleStruct{1})
- testCheck(c, check.Equals, false, "", &simpleStruct{1}, &simpleStruct{2})
-}
-
-func (s *CheckersS) TestDeepEquals(c *check.C) {
- testInfo(c, check.DeepEquals, "DeepEquals", []string{"obtained", "expected"})
-
- // The simplest.
- testCheck(c, check.DeepEquals, true, "", 42, 42)
- testCheck(c, check.DeepEquals, false, "", 42, 43)
-
- // Different native types.
- testCheck(c, check.DeepEquals, false, "", int32(42), int64(42))
-
- // With nil.
- testCheck(c, check.DeepEquals, false, "", 42, nil)
-
- // Slices
- testCheck(c, check.DeepEquals, true, "", []byte{1, 2}, []byte{1, 2})
- testCheck(c, check.DeepEquals, false, "", []byte{1, 2}, []byte{1, 3})
-
- // Struct values
- testCheck(c, check.DeepEquals, true, "", simpleStruct{1}, simpleStruct{1})
- testCheck(c, check.DeepEquals, false, "", simpleStruct{1}, simpleStruct{2})
-
- // Struct pointers
- testCheck(c, check.DeepEquals, true, "", &simpleStruct{1}, &simpleStruct{1})
- testCheck(c, check.DeepEquals, false, "", &simpleStruct{1}, &simpleStruct{2})
-}
-
-func (s *CheckersS) TestHasLen(c *check.C) {
- testInfo(c, check.HasLen, "HasLen", []string{"obtained", "n"})
-
- testCheck(c, check.HasLen, true, "", "abcd", 4)
- testCheck(c, check.HasLen, true, "", []int{1, 2}, 2)
- testCheck(c, check.HasLen, false, "", []int{1, 2}, 3)
-
- testCheck(c, check.HasLen, false, "n must be an int", []int{1, 2}, "2")
- testCheck(c, check.HasLen, false, "obtained value type has no length", nil, 2)
-}
-
-func (s *CheckersS) TestErrorMatches(c *check.C) {
- testInfo(c, check.ErrorMatches, "ErrorMatches", []string{"value", "regex"})
-
- testCheck(c, check.ErrorMatches, false, "Error value is nil", nil, "some error")
- testCheck(c, check.ErrorMatches, false, "Value is not an error", 1, "some error")
- testCheck(c, check.ErrorMatches, true, "", errors.New("some error"), "some error")
- testCheck(c, check.ErrorMatches, true, "", errors.New("some error"), "so.*or")
-
- // Verify params mutation
- params, names := testCheck(c, check.ErrorMatches, false, "", errors.New("some error"), "other error")
- c.Assert(params[0], check.Equals, "some error")
- c.Assert(names[0], check.Equals, "error")
-}
-
-func (s *CheckersS) TestMatches(c *check.C) {
- testInfo(c, check.Matches, "Matches", []string{"value", "regex"})
-
- // Simple matching
- testCheck(c, check.Matches, true, "", "abc", "abc")
- testCheck(c, check.Matches, true, "", "abc", "a.c")
-
- // Must match fully
- testCheck(c, check.Matches, false, "", "abc", "ab")
- testCheck(c, check.Matches, false, "", "abc", "bc")
-
- // String()-enabled values accepted
- testCheck(c, check.Matches, true, "", reflect.ValueOf("abc"), "a.c")
- testCheck(c, check.Matches, false, "", reflect.ValueOf("abc"), "a.d")
-
- // Some error conditions.
- testCheck(c, check.Matches, false, "Obtained value is not a string and has no .String()", 1, "a.c")
- testCheck(c, check.Matches, false, "Can't compile regex: error parsing regexp: missing closing ]: `[c$`", "abc", "a[c")
-}
-
-func (s *CheckersS) TestPanics(c *check.C) {
- testInfo(c, check.Panics, "Panics", []string{"function", "expected"})
-
- // Some errors.
- testCheck(c, check.Panics, false, "Function has not panicked", func() bool { return false }, "BOOM")
- testCheck(c, check.Panics, false, "Function must take zero arguments", 1, "BOOM")
-
- // Plain strings.
- testCheck(c, check.Panics, true, "", func() { panic("BOOM") }, "BOOM")
- testCheck(c, check.Panics, false, "", func() { panic("KABOOM") }, "BOOM")
- testCheck(c, check.Panics, true, "", func() bool { panic("BOOM") }, "BOOM")
-
- // Error values.
- testCheck(c, check.Panics, true, "", func() { panic(errors.New("BOOM")) }, errors.New("BOOM"))
- testCheck(c, check.Panics, false, "", func() { panic(errors.New("KABOOM")) }, errors.New("BOOM"))
-
- type deep struct{ i int }
- // Deep value
- testCheck(c, check.Panics, true, "", func() { panic(&deep{99}) }, &deep{99})
-
- // Verify params/names mutation
- params, names := testCheck(c, check.Panics, false, "", func() { panic(errors.New("KABOOM")) }, errors.New("BOOM"))
- c.Assert(params[0], check.ErrorMatches, "KABOOM")
- c.Assert(names[0], check.Equals, "panic")
-
- // Verify a nil panic
- testCheck(c, check.Panics, true, "", func() { panic(nil) }, nil)
- testCheck(c, check.Panics, false, "", func() { panic(nil) }, "NOPE")
-}
-
-func (s *CheckersS) TestPanicMatches(c *check.C) {
- testInfo(c, check.PanicMatches, "PanicMatches", []string{"function", "expected"})
-
- // Error matching.
- testCheck(c, check.PanicMatches, true, "", func() { panic(errors.New("BOOM")) }, "BO.M")
- testCheck(c, check.PanicMatches, false, "", func() { panic(errors.New("KABOOM")) }, "BO.M")
-
- // Some errors.
- testCheck(c, check.PanicMatches, false, "Function has not panicked", func() bool { return false }, "BOOM")
- testCheck(c, check.PanicMatches, false, "Function must take zero arguments", 1, "BOOM")
-
- // Plain strings.
- testCheck(c, check.PanicMatches, true, "", func() { panic("BOOM") }, "BO.M")
- testCheck(c, check.PanicMatches, false, "", func() { panic("KABOOM") }, "BOOM")
- testCheck(c, check.PanicMatches, true, "", func() bool { panic("BOOM") }, "BO.M")
-
- // Verify params/names mutation
- params, names := testCheck(c, check.PanicMatches, false, "", func() { panic(errors.New("KABOOM")) }, "BOOM")
- c.Assert(params[0], check.Equals, "KABOOM")
- c.Assert(names[0], check.Equals, "panic")
-
- // Verify a nil panic
- testCheck(c, check.PanicMatches, false, "Panic value is not a string or an error", func() { panic(nil) }, "")
-}
-
-func (s *CheckersS) TestFitsTypeOf(c *check.C) {
- testInfo(c, check.FitsTypeOf, "FitsTypeOf", []string{"obtained", "sample"})
-
- // Basic types
- testCheck(c, check.FitsTypeOf, true, "", 1, 0)
- testCheck(c, check.FitsTypeOf, false, "", 1, int64(0))
-
- // Aliases
- testCheck(c, check.FitsTypeOf, false, "", 1, errors.New(""))
- testCheck(c, check.FitsTypeOf, false, "", "error", errors.New(""))
- testCheck(c, check.FitsTypeOf, true, "", errors.New("error"), errors.New(""))
-
- // Structures
- testCheck(c, check.FitsTypeOf, false, "", 1, simpleStruct{})
- testCheck(c, check.FitsTypeOf, false, "", simpleStruct{42}, &simpleStruct{})
- testCheck(c, check.FitsTypeOf, true, "", simpleStruct{42}, simpleStruct{})
- testCheck(c, check.FitsTypeOf, true, "", &simpleStruct{42}, &simpleStruct{})
-
- // Some bad values
- testCheck(c, check.FitsTypeOf, false, "Invalid sample value", 1, interface{}(nil))
- testCheck(c, check.FitsTypeOf, false, "", interface{}(nil), 0)
-}
-
-func (s *CheckersS) TestImplements(c *check.C) {
- testInfo(c, check.Implements, "Implements", []string{"obtained", "ifaceptr"})
-
- var e error
- var re runtime.Error
- testCheck(c, check.Implements, true, "", errors.New(""), &e)
- testCheck(c, check.Implements, false, "", errors.New(""), &re)
-
- // Some bad values
- testCheck(c, check.Implements, false, "ifaceptr should be a pointer to an interface variable", 0, errors.New(""))
- testCheck(c, check.Implements, false, "ifaceptr should be a pointer to an interface variable", 0, interface{}(nil))
- testCheck(c, check.Implements, false, "", interface{}(nil), &e)
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/export_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/export_test.go
deleted file mode 100644
index 0e6cfe0f..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/export_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package check
-
-func PrintLine(filename string, line int) (string, error) {
- return printLine(filename, line)
-}
-
-func Indent(s, with string) string {
- return indent(s, with)
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/fixture_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/fixture_test.go
deleted file mode 100644
index 2bff9e16..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/fixture_test.go
+++ /dev/null
@@ -1,484 +0,0 @@
-// Tests for the behavior of the test fixture system.
-
-package check_test
-
-import (
- . "gopkg.in/check.v1"
-)
-
-// -----------------------------------------------------------------------
-// Fixture test suite.
-
-type FixtureS struct{}
-
-var fixtureS = Suite(&FixtureS{})
-
-func (s *FixtureS) TestCountSuite(c *C) {
- suitesRun += 1
-}
-
-// -----------------------------------------------------------------------
-// Basic fixture ordering verification.
-
-func (s *FixtureS) TestOrder(c *C) {
- helper := FixtureHelper{}
- Run(&helper, nil)
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "SetUpTest")
- c.Check(helper.calls[5], Equals, "Test2")
- c.Check(helper.calls[6], Equals, "TearDownTest")
- c.Check(helper.calls[7], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 8)
-}
-
-// -----------------------------------------------------------------------
-// Check the behavior when panics occur within tests and fixtures.
-
-func (s *FixtureS) TestPanicOnTest(c *C) {
- helper := FixtureHelper{panicOn: "Test1"}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "SetUpTest")
- c.Check(helper.calls[5], Equals, "Test2")
- c.Check(helper.calls[6], Equals, "TearDownTest")
- c.Check(helper.calls[7], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 8)
-
- expected := "^\n-+\n" +
- "PANIC: check_test\\.go:[0-9]+: FixtureHelper.Test1\n\n" +
- "\\.\\.\\. Panic: Test1 \\(PC=[xA-F0-9]+\\)\n\n" +
- ".+:[0-9]+\n" +
- " in (go)?panic\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.trace\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.Test1\n" +
- "(.|\n)*$"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnSetUpTest(c *C) {
- helper := FixtureHelper{panicOn: "SetUpTest"}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "TearDownTest")
- c.Check(helper.calls[3], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 4)
-
- expected := "^\n-+\n" +
- "PANIC: check_test\\.go:[0-9]+: " +
- "FixtureHelper\\.SetUpTest\n\n" +
- "\\.\\.\\. Panic: SetUpTest \\(PC=[xA-F0-9]+\\)\n\n" +
- ".+:[0-9]+\n" +
- " in (go)?panic\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.trace\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.SetUpTest\n" +
- "(.|\n)*" +
- "\n-+\n" +
- "PANIC: check_test\\.go:[0-9]+: " +
- "FixtureHelper\\.Test1\n\n" +
- "\\.\\.\\. Panic: Fixture has panicked " +
- "\\(see related PANIC\\)\n$"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnTearDownTest(c *C) {
- helper := FixtureHelper{panicOn: "TearDownTest"}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 5)
-
- expected := "^\n-+\n" +
- "PANIC: check_test\\.go:[0-9]+: " +
- "FixtureHelper.TearDownTest\n\n" +
- "\\.\\.\\. Panic: TearDownTest \\(PC=[xA-F0-9]+\\)\n\n" +
- ".+:[0-9]+\n" +
- " in (go)?panic\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.trace\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.TearDownTest\n" +
- "(.|\n)*" +
- "\n-+\n" +
- "PANIC: check_test\\.go:[0-9]+: " +
- "FixtureHelper\\.Test1\n\n" +
- "\\.\\.\\. Panic: Fixture has panicked " +
- "\\(see related PANIC\\)\n$"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnSetUpSuite(c *C) {
- helper := FixtureHelper{panicOn: "SetUpSuite"}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 2)
-
- expected := "^\n-+\n" +
- "PANIC: check_test\\.go:[0-9]+: " +
- "FixtureHelper.SetUpSuite\n\n" +
- "\\.\\.\\. Panic: SetUpSuite \\(PC=[xA-F0-9]+\\)\n\n" +
- ".+:[0-9]+\n" +
- " in (go)?panic\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.trace\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.SetUpSuite\n" +
- "(.|\n)*$"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnTearDownSuite(c *C) {
- helper := FixtureHelper{panicOn: "TearDownSuite"}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "SetUpTest")
- c.Check(helper.calls[5], Equals, "Test2")
- c.Check(helper.calls[6], Equals, "TearDownTest")
- c.Check(helper.calls[7], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 8)
-
- expected := "^\n-+\n" +
- "PANIC: check_test\\.go:[0-9]+: " +
- "FixtureHelper.TearDownSuite\n\n" +
- "\\.\\.\\. Panic: TearDownSuite \\(PC=[xA-F0-9]+\\)\n\n" +
- ".+:[0-9]+\n" +
- " in (go)?panic\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.trace\n" +
- ".*check_test.go:[0-9]+\n" +
- " in FixtureHelper.TearDownSuite\n" +
- "(.|\n)*$"
-
- c.Check(output.value, Matches, expected)
-}
-
-// -----------------------------------------------------------------------
-// A wrong argument on a test or fixture will produce a nice error.
-
-func (s *FixtureS) TestPanicOnWrongTestArg(c *C) {
- helper := WrongTestArgHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "TearDownTest")
- c.Check(helper.calls[3], Equals, "SetUpTest")
- c.Check(helper.calls[4], Equals, "Test2")
- c.Check(helper.calls[5], Equals, "TearDownTest")
- c.Check(helper.calls[6], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 7)
-
- expected := "^\n-+\n" +
- "PANIC: fixture_test\\.go:[0-9]+: " +
- "WrongTestArgHelper\\.Test1\n\n" +
- "\\.\\.\\. Panic: WrongTestArgHelper\\.Test1 argument " +
- "should be \\*check\\.C\n"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnWrongSetUpTestArg(c *C) {
- helper := WrongSetUpTestArgHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(len(helper.calls), Equals, 0)
-
- expected :=
- "^\n-+\n" +
- "PANIC: fixture_test\\.go:[0-9]+: " +
- "WrongSetUpTestArgHelper\\.SetUpTest\n\n" +
- "\\.\\.\\. Panic: WrongSetUpTestArgHelper\\.SetUpTest argument " +
- "should be \\*check\\.C\n"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnWrongSetUpSuiteArg(c *C) {
- helper := WrongSetUpSuiteArgHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(len(helper.calls), Equals, 0)
-
- expected :=
- "^\n-+\n" +
- "PANIC: fixture_test\\.go:[0-9]+: " +
- "WrongSetUpSuiteArgHelper\\.SetUpSuite\n\n" +
- "\\.\\.\\. Panic: WrongSetUpSuiteArgHelper\\.SetUpSuite argument " +
- "should be \\*check\\.C\n"
-
- c.Check(output.value, Matches, expected)
-}
-
-// -----------------------------------------------------------------------
-// Nice errors also when tests or fixture have wrong arg count.
-
-func (s *FixtureS) TestPanicOnWrongTestArgCount(c *C) {
- helper := WrongTestArgCountHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "TearDownTest")
- c.Check(helper.calls[3], Equals, "SetUpTest")
- c.Check(helper.calls[4], Equals, "Test2")
- c.Check(helper.calls[5], Equals, "TearDownTest")
- c.Check(helper.calls[6], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 7)
-
- expected := "^\n-+\n" +
- "PANIC: fixture_test\\.go:[0-9]+: " +
- "WrongTestArgCountHelper\\.Test1\n\n" +
- "\\.\\.\\. Panic: WrongTestArgCountHelper\\.Test1 argument " +
- "should be \\*check\\.C\n"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnWrongSetUpTestArgCount(c *C) {
- helper := WrongSetUpTestArgCountHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(len(helper.calls), Equals, 0)
-
- expected :=
- "^\n-+\n" +
- "PANIC: fixture_test\\.go:[0-9]+: " +
- "WrongSetUpTestArgCountHelper\\.SetUpTest\n\n" +
- "\\.\\.\\. Panic: WrongSetUpTestArgCountHelper\\.SetUpTest argument " +
- "should be \\*check\\.C\n"
-
- c.Check(output.value, Matches, expected)
-}
-
-func (s *FixtureS) TestPanicOnWrongSetUpSuiteArgCount(c *C) {
- helper := WrongSetUpSuiteArgCountHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(len(helper.calls), Equals, 0)
-
- expected :=
- "^\n-+\n" +
- "PANIC: fixture_test\\.go:[0-9]+: " +
- "WrongSetUpSuiteArgCountHelper\\.SetUpSuite\n\n" +
- "\\.\\.\\. Panic: WrongSetUpSuiteArgCountHelper" +
- "\\.SetUpSuite argument should be \\*check\\.C\n"
-
- c.Check(output.value, Matches, expected)
-}
-
-// -----------------------------------------------------------------------
-// Helper test suites with wrong function arguments.
-
-type WrongTestArgHelper struct {
- FixtureHelper
-}
-
-func (s *WrongTestArgHelper) Test1(t int) {
-}
-
-type WrongSetUpTestArgHelper struct {
- FixtureHelper
-}
-
-func (s *WrongSetUpTestArgHelper) SetUpTest(t int) {
-}
-
-type WrongSetUpSuiteArgHelper struct {
- FixtureHelper
-}
-
-func (s *WrongSetUpSuiteArgHelper) SetUpSuite(t int) {
-}
-
-type WrongTestArgCountHelper struct {
- FixtureHelper
-}
-
-func (s *WrongTestArgCountHelper) Test1(c *C, i int) {
-}
-
-type WrongSetUpTestArgCountHelper struct {
- FixtureHelper
-}
-
-func (s *WrongSetUpTestArgCountHelper) SetUpTest(c *C, i int) {
-}
-
-type WrongSetUpSuiteArgCountHelper struct {
- FixtureHelper
-}
-
-func (s *WrongSetUpSuiteArgCountHelper) SetUpSuite(c *C, i int) {
-}
-
-// -----------------------------------------------------------------------
-// Ensure fixture doesn't run without tests.
-
-type NoTestsHelper struct {
- hasRun bool
-}
-
-func (s *NoTestsHelper) SetUpSuite(c *C) {
- s.hasRun = true
-}
-
-func (s *NoTestsHelper) TearDownSuite(c *C) {
- s.hasRun = true
-}
-
-func (s *FixtureS) TestFixtureDoesntRunWithoutTests(c *C) {
- helper := NoTestsHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Check(helper.hasRun, Equals, false)
-}
-
-// -----------------------------------------------------------------------
-// Verify that checks and assertions work correctly inside the fixture.
-
-type FixtureCheckHelper struct {
- fail string
- completed bool
-}
-
-func (s *FixtureCheckHelper) SetUpSuite(c *C) {
- switch s.fail {
- case "SetUpSuiteAssert":
- c.Assert(false, Equals, true)
- case "SetUpSuiteCheck":
- c.Check(false, Equals, true)
- }
- s.completed = true
-}
-
-func (s *FixtureCheckHelper) SetUpTest(c *C) {
- switch s.fail {
- case "SetUpTestAssert":
- c.Assert(false, Equals, true)
- case "SetUpTestCheck":
- c.Check(false, Equals, true)
- }
- s.completed = true
-}
-
-func (s *FixtureCheckHelper) Test(c *C) {
- // Do nothing.
-}
-
-func (s *FixtureS) TestSetUpSuiteCheck(c *C) {
- helper := FixtureCheckHelper{fail: "SetUpSuiteCheck"}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Assert(output.value, Matches,
- "\n---+\n"+
- "FAIL: fixture_test\\.go:[0-9]+: "+
- "FixtureCheckHelper\\.SetUpSuite\n\n"+
- "fixture_test\\.go:[0-9]+:\n"+
- " c\\.Check\\(false, Equals, true\\)\n"+
- "\\.+ obtained bool = false\n"+
- "\\.+ expected bool = true\n\n")
- c.Assert(helper.completed, Equals, true)
-}
-
-func (s *FixtureS) TestSetUpSuiteAssert(c *C) {
- helper := FixtureCheckHelper{fail: "SetUpSuiteAssert"}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Assert(output.value, Matches,
- "\n---+\n"+
- "FAIL: fixture_test\\.go:[0-9]+: "+
- "FixtureCheckHelper\\.SetUpSuite\n\n"+
- "fixture_test\\.go:[0-9]+:\n"+
- " c\\.Assert\\(false, Equals, true\\)\n"+
- "\\.+ obtained bool = false\n"+
- "\\.+ expected bool = true\n\n")
- c.Assert(helper.completed, Equals, false)
-}
-
-// -----------------------------------------------------------------------
-// Verify that logging within SetUpTest() persists within the test log itself.
-
-type FixtureLogHelper struct {
- c *C
-}
-
-func (s *FixtureLogHelper) SetUpTest(c *C) {
- s.c = c
- c.Log("1")
-}
-
-func (s *FixtureLogHelper) Test(c *C) {
- c.Log("2")
- s.c.Log("3")
- c.Log("4")
- c.Fail()
-}
-
-func (s *FixtureLogHelper) TearDownTest(c *C) {
- s.c.Log("5")
-}
-
-func (s *FixtureS) TestFixtureLogging(c *C) {
- helper := FixtureLogHelper{}
- output := String{}
- Run(&helper, &RunConf{Output: &output})
- c.Assert(output.value, Matches,
- "\n---+\n"+
- "FAIL: fixture_test\\.go:[0-9]+: "+
- "FixtureLogHelper\\.Test\n\n"+
- "1\n2\n3\n4\n5\n")
-}
-
-// -----------------------------------------------------------------------
-// Skip() within fixture methods.
-
-func (s *FixtureS) TestSkipSuite(c *C) {
- helper := FixtureHelper{skip: true, skipOnN: 0}
- output := String{}
- result := Run(&helper, &RunConf{Output: &output})
- c.Assert(output.value, Equals, "")
- c.Assert(helper.calls[0], Equals, "SetUpSuite")
- c.Assert(helper.calls[1], Equals, "TearDownSuite")
- c.Assert(len(helper.calls), Equals, 2)
- c.Assert(result.Skipped, Equals, 2)
-}
-
-func (s *FixtureS) TestSkipTest(c *C) {
- helper := FixtureHelper{skip: true, skipOnN: 1}
- output := String{}
- result := Run(&helper, &RunConf{Output: &output})
- c.Assert(helper.calls[0], Equals, "SetUpSuite")
- c.Assert(helper.calls[1], Equals, "SetUpTest")
- c.Assert(helper.calls[2], Equals, "SetUpTest")
- c.Assert(helper.calls[3], Equals, "Test2")
- c.Assert(helper.calls[4], Equals, "TearDownTest")
- c.Assert(helper.calls[5], Equals, "TearDownSuite")
- c.Assert(len(helper.calls), Equals, 6)
- c.Assert(result.Skipped, Equals, 1)
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/foundation_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/foundation_test.go
deleted file mode 100644
index 8ecf7915..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/foundation_test.go
+++ /dev/null
@@ -1,335 +0,0 @@
-// These tests check that the foundations of gocheck are working properly.
-// They already assume that fundamental failing is working already, though,
-// since this was tested in bootstrap_test.go. Even then, some care may
-// still have to be taken when using external functions, since they should
-// of course not rely on functionality tested here.
-
-package check_test
-
-import (
- "fmt"
- "gopkg.in/check.v1"
- "log"
- "os"
- "regexp"
- "strings"
-)
-
-// -----------------------------------------------------------------------
-// Foundation test suite.
-
-type FoundationS struct{}
-
-var foundationS = check.Suite(&FoundationS{})
-
-func (s *FoundationS) TestCountSuite(c *check.C) {
- suitesRun += 1
-}
-
-func (s *FoundationS) TestErrorf(c *check.C) {
- // Do not use checkState() here. It depends on Errorf() working.
- expectedLog := fmt.Sprintf("foundation_test.go:%d:\n"+
- " c.Errorf(\"Error %%v!\", \"message\")\n"+
- "... Error: Error message!\n\n",
- getMyLine()+1)
- c.Errorf("Error %v!", "message")
- failed := c.Failed()
- c.Succeed()
- if log := c.GetTestLog(); log != expectedLog {
- c.Logf("Errorf() logged %#v rather than %#v", log, expectedLog)
- c.Fail()
- }
- if !failed {
- c.Logf("Errorf() didn't put the test in a failed state")
- c.Fail()
- }
-}
-
-func (s *FoundationS) TestError(c *check.C) {
- expectedLog := fmt.Sprintf("foundation_test.go:%d:\n"+
- " c\\.Error\\(\"Error \", \"message!\"\\)\n"+
- "\\.\\.\\. Error: Error message!\n\n",
- getMyLine()+1)
- c.Error("Error ", "message!")
- checkState(c, nil,
- &expectedState{
- name: "Error(`Error `, `message!`)",
- failed: true,
- log: expectedLog,
- })
-}
-
-func (s *FoundationS) TestFailNow(c *check.C) {
- defer (func() {
- if !c.Failed() {
- c.Error("FailNow() didn't fail the test")
- } else {
- c.Succeed()
- if c.GetTestLog() != "" {
- c.Error("Something got logged:\n" + c.GetTestLog())
- }
- }
- })()
-
- c.FailNow()
- c.Log("FailNow() didn't stop the test")
-}
-
-func (s *FoundationS) TestSucceedNow(c *check.C) {
- defer (func() {
- if c.Failed() {
- c.Error("SucceedNow() didn't succeed the test")
- }
- if c.GetTestLog() != "" {
- c.Error("Something got logged:\n" + c.GetTestLog())
- }
- })()
-
- c.Fail()
- c.SucceedNow()
- c.Log("SucceedNow() didn't stop the test")
-}
-
-func (s *FoundationS) TestFailureHeader(c *check.C) {
- output := String{}
- failHelper := FailHelper{}
- check.Run(&failHelper, &check.RunConf{Output: &output})
- header := fmt.Sprintf(""+
- "\n-----------------------------------"+
- "-----------------------------------\n"+
- "FAIL: check_test.go:%d: FailHelper.TestLogAndFail\n",
- failHelper.testLine)
- if strings.Index(output.value, header) == -1 {
- c.Errorf(""+
- "Failure didn't print a proper header.\n"+
- "... Got:\n%s... Expected something with:\n%s",
- output.value, header)
- }
-}
-
-func (s *FoundationS) TestFatal(c *check.C) {
- var line int
- defer (func() {
- if !c.Failed() {
- c.Error("Fatal() didn't fail the test")
- } else {
- c.Succeed()
- expected := fmt.Sprintf("foundation_test.go:%d:\n"+
- " c.Fatal(\"Die \", \"now!\")\n"+
- "... Error: Die now!\n\n",
- line)
- if c.GetTestLog() != expected {
- c.Error("Incorrect log:", c.GetTestLog())
- }
- }
- })()
-
- line = getMyLine() + 1
- c.Fatal("Die ", "now!")
- c.Log("Fatal() didn't stop the test")
-}
-
-func (s *FoundationS) TestFatalf(c *check.C) {
- var line int
- defer (func() {
- if !c.Failed() {
- c.Error("Fatalf() didn't fail the test")
- } else {
- c.Succeed()
- expected := fmt.Sprintf("foundation_test.go:%d:\n"+
- " c.Fatalf(\"Die %%s!\", \"now\")\n"+
- "... Error: Die now!\n\n",
- line)
- if c.GetTestLog() != expected {
- c.Error("Incorrect log:", c.GetTestLog())
- }
- }
- })()
-
- line = getMyLine() + 1
- c.Fatalf("Die %s!", "now")
- c.Log("Fatalf() didn't stop the test")
-}
-
-func (s *FoundationS) TestCallerLoggingInsideTest(c *check.C) {
- log := fmt.Sprintf(""+
- "foundation_test.go:%d:\n"+
- " result := c.Check\\(10, check.Equals, 20\\)\n"+
- "\\.\\.\\. obtained int = 10\n"+
- "\\.\\.\\. expected int = 20\n\n",
- getMyLine()+1)
- result := c.Check(10, check.Equals, 20)
- checkState(c, result,
- &expectedState{
- name: "Check(10, Equals, 20)",
- result: false,
- failed: true,
- log: log,
- })
-}
-
-func (s *FoundationS) TestCallerLoggingInDifferentFile(c *check.C) {
- result, line := checkEqualWrapper(c, 10, 20)
- testLine := getMyLine() - 1
- log := fmt.Sprintf(""+
- "foundation_test.go:%d:\n"+
- " result, line := checkEqualWrapper\\(c, 10, 20\\)\n"+
- "check_test.go:%d:\n"+
- " return c.Check\\(obtained, check.Equals, expected\\), getMyLine\\(\\)\n"+
- "\\.\\.\\. obtained int = 10\n"+
- "\\.\\.\\. expected int = 20\n\n",
- testLine, line)
- checkState(c, result,
- &expectedState{
- name: "Check(10, Equals, 20)",
- result: false,
- failed: true,
- log: log,
- })
-}
-
-// -----------------------------------------------------------------------
-// ExpectFailure() inverts the logic of failure.
-
-type ExpectFailureSucceedHelper struct{}
-
-func (s *ExpectFailureSucceedHelper) TestSucceed(c *check.C) {
- c.ExpectFailure("It booms!")
- c.Error("Boom!")
-}
-
-type ExpectFailureFailHelper struct{}
-
-func (s *ExpectFailureFailHelper) TestFail(c *check.C) {
- c.ExpectFailure("Bug #XYZ")
-}
-
-func (s *FoundationS) TestExpectFailureFail(c *check.C) {
- helper := ExpectFailureFailHelper{}
- output := String{}
- result := check.Run(&helper, &check.RunConf{Output: &output})
-
- expected := "" +
- "^\n-+\n" +
- "FAIL: foundation_test\\.go:[0-9]+:" +
- " ExpectFailureFailHelper\\.TestFail\n\n" +
- "\\.\\.\\. Error: Test succeeded, but was expected to fail\n" +
- "\\.\\.\\. Reason: Bug #XYZ\n$"
-
- matched, err := regexp.MatchString(expected, output.value)
- if err != nil {
- c.Error("Bad expression: ", expected)
- } else if !matched {
- c.Error("ExpectFailure() didn't log properly:\n", output.value)
- }
-
- c.Assert(result.ExpectedFailures, check.Equals, 0)
-}
-
-func (s *FoundationS) TestExpectFailureSucceed(c *check.C) {
- helper := ExpectFailureSucceedHelper{}
- output := String{}
- result := check.Run(&helper, &check.RunConf{Output: &output})
-
- c.Assert(output.value, check.Equals, "")
- c.Assert(result.ExpectedFailures, check.Equals, 1)
-}
-
-func (s *FoundationS) TestExpectFailureSucceedVerbose(c *check.C) {
- helper := ExpectFailureSucceedHelper{}
- output := String{}
- result := check.Run(&helper, &check.RunConf{Output: &output, Verbose: true})
-
- expected := "" +
- "FAIL EXPECTED: foundation_test\\.go:[0-9]+:" +
- " ExpectFailureSucceedHelper\\.TestSucceed \\(It booms!\\)\t *[.0-9]+s\n"
-
- matched, err := regexp.MatchString(expected, output.value)
- if err != nil {
- c.Error("Bad expression: ", expected)
- } else if !matched {
- c.Error("ExpectFailure() didn't log properly:\n", output.value)
- }
-
- c.Assert(result.ExpectedFailures, check.Equals, 1)
-}
-
-// -----------------------------------------------------------------------
-// Skip() allows stopping a test without positive/negative results.
-
-type SkipTestHelper struct{}
-
-func (s *SkipTestHelper) TestFail(c *check.C) {
- c.Skip("Wrong platform or whatever")
- c.Error("Boom!")
-}
-
-func (s *FoundationS) TestSkip(c *check.C) {
- helper := SkipTestHelper{}
- output := String{}
- check.Run(&helper, &check.RunConf{Output: &output})
-
- if output.value != "" {
- c.Error("Skip() logged something:\n", output.value)
- }
-}
-
-func (s *FoundationS) TestSkipVerbose(c *check.C) {
- helper := SkipTestHelper{}
- output := String{}
- check.Run(&helper, &check.RunConf{Output: &output, Verbose: true})
-
- expected := "SKIP: foundation_test\\.go:[0-9]+: SkipTestHelper\\.TestFail" +
- " \\(Wrong platform or whatever\\)"
- matched, err := regexp.MatchString(expected, output.value)
- if err != nil {
- c.Error("Bad expression: ", expected)
- } else if !matched {
- c.Error("Skip() didn't log properly:\n", output.value)
- }
-}
-
-// -----------------------------------------------------------------------
-// Check minimum *log.Logger interface provided by *check.C.
-
-type minLogger interface {
- Output(calldepth int, s string) error
-}
-
-func (s *BootstrapS) TestMinLogger(c *check.C) {
- var logger minLogger
- logger = log.New(os.Stderr, "", 0)
- logger = c
- logger.Output(0, "Hello there")
- expected := `\[LOG\] [0-9]+:[0-9][0-9]\.[0-9][0-9][0-9] +Hello there\n`
- output := c.GetTestLog()
- c.Assert(output, check.Matches, expected)
-}
-
-// -----------------------------------------------------------------------
-// Ensure that suites with embedded types are working fine, including the
-// the workaround for issue 906.
-
-type EmbeddedInternalS struct {
- called bool
-}
-
-type EmbeddedS struct {
- EmbeddedInternalS
-}
-
-var embeddedS = check.Suite(&EmbeddedS{})
-
-func (s *EmbeddedS) TestCountSuite(c *check.C) {
- suitesRun += 1
-}
-
-func (s *EmbeddedInternalS) TestMethod(c *check.C) {
- c.Error("TestMethod() of the embedded type was called!?")
-}
-
-func (s *EmbeddedS) TestMethod(c *check.C) {
- // http://code.google.com/p/go/issues/detail?id=906
- c.Check(s.called, check.Equals, false) // Go issue 906 is affecting the runner?
- s.called = true
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/helpers_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/helpers_test.go
deleted file mode 100644
index 4baa656b..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/helpers_test.go
+++ /dev/null
@@ -1,519 +0,0 @@
-// These tests verify the inner workings of the helper methods associated
-// with check.T.
-
-package check_test
-
-import (
- "gopkg.in/check.v1"
- "os"
- "reflect"
- "runtime"
- "sync"
-)
-
-var helpersS = check.Suite(&HelpersS{})
-
-type HelpersS struct{}
-
-func (s *HelpersS) TestCountSuite(c *check.C) {
- suitesRun += 1
-}
-
-// -----------------------------------------------------------------------
-// Fake checker and bug info to verify the behavior of Assert() and Check().
-
-type MyChecker struct {
- info *check.CheckerInfo
- params []interface{}
- names []string
- result bool
- error string
-}
-
-func (checker *MyChecker) Info() *check.CheckerInfo {
- if checker.info == nil {
- return &check.CheckerInfo{Name: "MyChecker", Params: []string{"myobtained", "myexpected"}}
- }
- return checker.info
-}
-
-func (checker *MyChecker) Check(params []interface{}, names []string) (bool, string) {
- rparams := checker.params
- rnames := checker.names
- checker.params = append([]interface{}{}, params...)
- checker.names = append([]string{}, names...)
- if rparams != nil {
- copy(params, rparams)
- }
- if rnames != nil {
- copy(names, rnames)
- }
- return checker.result, checker.error
-}
-
-type myCommentType string
-
-func (c myCommentType) CheckCommentString() string {
- return string(c)
-}
-
-func myComment(s string) myCommentType {
- return myCommentType(s)
-}
-
-// -----------------------------------------------------------------------
-// Ensure a real checker actually works fine.
-
-func (s *HelpersS) TestCheckerInterface(c *check.C) {
- testHelperSuccess(c, "Check(1, Equals, 1)", true, func() interface{} {
- return c.Check(1, check.Equals, 1)
- })
-}
-
-// -----------------------------------------------------------------------
-// Tests for Check(), mostly the same as for Assert() following these.
-
-func (s *HelpersS) TestCheckSucceedWithExpected(c *check.C) {
- checker := &MyChecker{result: true}
- testHelperSuccess(c, "Check(1, checker, 2)", true, func() interface{} {
- return c.Check(1, checker, 2)
- })
- if !reflect.DeepEqual(checker.params, []interface{}{1, 2}) {
- c.Fatalf("Bad params for check: %#v", checker.params)
- }
-}
-
-func (s *HelpersS) TestCheckSucceedWithoutExpected(c *check.C) {
- checker := &MyChecker{result: true, info: &check.CheckerInfo{Params: []string{"myvalue"}}}
- testHelperSuccess(c, "Check(1, checker)", true, func() interface{} {
- return c.Check(1, checker)
- })
- if !reflect.DeepEqual(checker.params, []interface{}{1}) {
- c.Fatalf("Bad params for check: %#v", checker.params)
- }
-}
-
-func (s *HelpersS) TestCheckFailWithExpected(c *check.C) {
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker, 2\\)\n" +
- "\\.+ myobtained int = 1\n" +
- "\\.+ myexpected int = 2\n\n"
- testHelperFailure(c, "Check(1, checker, 2)", false, false, log,
- func() interface{} {
- return c.Check(1, checker, 2)
- })
-}
-
-func (s *HelpersS) TestCheckFailWithExpectedAndComment(c *check.C) {
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker, 2, myComment\\(\"Hello world!\"\\)\\)\n" +
- "\\.+ myobtained int = 1\n" +
- "\\.+ myexpected int = 2\n" +
- "\\.+ Hello world!\n\n"
- testHelperFailure(c, "Check(1, checker, 2, msg)", false, false, log,
- func() interface{} {
- return c.Check(1, checker, 2, myComment("Hello world!"))
- })
-}
-
-func (s *HelpersS) TestCheckFailWithExpectedAndStaticComment(c *check.C) {
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " // Nice leading comment\\.\n" +
- " return c\\.Check\\(1, checker, 2\\) // Hello there\n" +
- "\\.+ myobtained int = 1\n" +
- "\\.+ myexpected int = 2\n\n"
- testHelperFailure(c, "Check(1, checker, 2, msg)", false, false, log,
- func() interface{} {
- // Nice leading comment.
- return c.Check(1, checker, 2) // Hello there
- })
-}
-
-func (s *HelpersS) TestCheckFailWithoutExpected(c *check.C) {
- checker := &MyChecker{result: false, info: &check.CheckerInfo{Params: []string{"myvalue"}}}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker\\)\n" +
- "\\.+ myvalue int = 1\n\n"
- testHelperFailure(c, "Check(1, checker)", false, false, log,
- func() interface{} {
- return c.Check(1, checker)
- })
-}
-
-func (s *HelpersS) TestCheckFailWithoutExpectedAndMessage(c *check.C) {
- checker := &MyChecker{result: false, info: &check.CheckerInfo{Params: []string{"myvalue"}}}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker, myComment\\(\"Hello world!\"\\)\\)\n" +
- "\\.+ myvalue int = 1\n" +
- "\\.+ Hello world!\n\n"
- testHelperFailure(c, "Check(1, checker, msg)", false, false, log,
- func() interface{} {
- return c.Check(1, checker, myComment("Hello world!"))
- })
-}
-
-func (s *HelpersS) TestCheckWithMissingExpected(c *check.C) {
- checker := &MyChecker{result: true}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker\\)\n" +
- "\\.+ Check\\(myobtained, MyChecker, myexpected\\):\n" +
- "\\.+ Wrong number of parameters for MyChecker: " +
- "want 3, got 2\n\n"
- testHelperFailure(c, "Check(1, checker, !?)", false, false, log,
- func() interface{} {
- return c.Check(1, checker)
- })
-}
-
-func (s *HelpersS) TestCheckWithTooManyExpected(c *check.C) {
- checker := &MyChecker{result: true}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker, 2, 3\\)\n" +
- "\\.+ Check\\(myobtained, MyChecker, myexpected\\):\n" +
- "\\.+ Wrong number of parameters for MyChecker: " +
- "want 3, got 4\n\n"
- testHelperFailure(c, "Check(1, checker, 2, 3)", false, false, log,
- func() interface{} {
- return c.Check(1, checker, 2, 3)
- })
-}
-
-func (s *HelpersS) TestCheckWithError(c *check.C) {
- checker := &MyChecker{result: false, error: "Some not so cool data provided!"}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker, 2\\)\n" +
- "\\.+ myobtained int = 1\n" +
- "\\.+ myexpected int = 2\n" +
- "\\.+ Some not so cool data provided!\n\n"
- testHelperFailure(c, "Check(1, checker, 2)", false, false, log,
- func() interface{} {
- return c.Check(1, checker, 2)
- })
-}
-
-func (s *HelpersS) TestCheckWithNilChecker(c *check.C) {
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, nil\\)\n" +
- "\\.+ Check\\(obtained, nil!\\?, \\.\\.\\.\\):\n" +
- "\\.+ Oops\\.\\. you've provided a nil checker!\n\n"
- testHelperFailure(c, "Check(obtained, nil)", false, false, log,
- func() interface{} {
- return c.Check(1, nil)
- })
-}
-
-func (s *HelpersS) TestCheckWithParamsAndNamesMutation(c *check.C) {
- checker := &MyChecker{result: false, params: []interface{}{3, 4}, names: []string{"newobtained", "newexpected"}}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " return c\\.Check\\(1, checker, 2\\)\n" +
- "\\.+ newobtained int = 3\n" +
- "\\.+ newexpected int = 4\n\n"
- testHelperFailure(c, "Check(1, checker, 2) with mutation", false, false, log,
- func() interface{} {
- return c.Check(1, checker, 2)
- })
-}
-
-// -----------------------------------------------------------------------
-// Tests for Assert(), mostly the same as for Check() above.
-
-func (s *HelpersS) TestAssertSucceedWithExpected(c *check.C) {
- checker := &MyChecker{result: true}
- testHelperSuccess(c, "Assert(1, checker, 2)", nil, func() interface{} {
- c.Assert(1, checker, 2)
- return nil
- })
- if !reflect.DeepEqual(checker.params, []interface{}{1, 2}) {
- c.Fatalf("Bad params for check: %#v", checker.params)
- }
-}
-
-func (s *HelpersS) TestAssertSucceedWithoutExpected(c *check.C) {
- checker := &MyChecker{result: true, info: &check.CheckerInfo{Params: []string{"myvalue"}}}
- testHelperSuccess(c, "Assert(1, checker)", nil, func() interface{} {
- c.Assert(1, checker)
- return nil
- })
- if !reflect.DeepEqual(checker.params, []interface{}{1}) {
- c.Fatalf("Bad params for check: %#v", checker.params)
- }
-}
-
-func (s *HelpersS) TestAssertFailWithExpected(c *check.C) {
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " c\\.Assert\\(1, checker, 2\\)\n" +
- "\\.+ myobtained int = 1\n" +
- "\\.+ myexpected int = 2\n\n"
- testHelperFailure(c, "Assert(1, checker, 2)", nil, true, log,
- func() interface{} {
- c.Assert(1, checker, 2)
- return nil
- })
-}
-
-func (s *HelpersS) TestAssertFailWithExpectedAndMessage(c *check.C) {
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " c\\.Assert\\(1, checker, 2, myComment\\(\"Hello world!\"\\)\\)\n" +
- "\\.+ myobtained int = 1\n" +
- "\\.+ myexpected int = 2\n" +
- "\\.+ Hello world!\n\n"
- testHelperFailure(c, "Assert(1, checker, 2, msg)", nil, true, log,
- func() interface{} {
- c.Assert(1, checker, 2, myComment("Hello world!"))
- return nil
- })
-}
-
-func (s *HelpersS) TestAssertFailWithoutExpected(c *check.C) {
- checker := &MyChecker{result: false, info: &check.CheckerInfo{Params: []string{"myvalue"}}}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " c\\.Assert\\(1, checker\\)\n" +
- "\\.+ myvalue int = 1\n\n"
- testHelperFailure(c, "Assert(1, checker)", nil, true, log,
- func() interface{} {
- c.Assert(1, checker)
- return nil
- })
-}
-
-func (s *HelpersS) TestAssertFailWithoutExpectedAndMessage(c *check.C) {
- checker := &MyChecker{result: false, info: &check.CheckerInfo{Params: []string{"myvalue"}}}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " c\\.Assert\\(1, checker, myComment\\(\"Hello world!\"\\)\\)\n" +
- "\\.+ myvalue int = 1\n" +
- "\\.+ Hello world!\n\n"
- testHelperFailure(c, "Assert(1, checker, msg)", nil, true, log,
- func() interface{} {
- c.Assert(1, checker, myComment("Hello world!"))
- return nil
- })
-}
-
-func (s *HelpersS) TestAssertWithMissingExpected(c *check.C) {
- checker := &MyChecker{result: true}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " c\\.Assert\\(1, checker\\)\n" +
- "\\.+ Assert\\(myobtained, MyChecker, myexpected\\):\n" +
- "\\.+ Wrong number of parameters for MyChecker: " +
- "want 3, got 2\n\n"
- testHelperFailure(c, "Assert(1, checker, !?)", nil, true, log,
- func() interface{} {
- c.Assert(1, checker)
- return nil
- })
-}
-
-func (s *HelpersS) TestAssertWithError(c *check.C) {
- checker := &MyChecker{result: false, error: "Some not so cool data provided!"}
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " c\\.Assert\\(1, checker, 2\\)\n" +
- "\\.+ myobtained int = 1\n" +
- "\\.+ myexpected int = 2\n" +
- "\\.+ Some not so cool data provided!\n\n"
- testHelperFailure(c, "Assert(1, checker, 2)", nil, true, log,
- func() interface{} {
- c.Assert(1, checker, 2)
- return nil
- })
-}
-
-func (s *HelpersS) TestAssertWithNilChecker(c *check.C) {
- log := "(?s)helpers_test\\.go:[0-9]+:.*\nhelpers_test\\.go:[0-9]+:\n" +
- " c\\.Assert\\(1, nil\\)\n" +
- "\\.+ Assert\\(obtained, nil!\\?, \\.\\.\\.\\):\n" +
- "\\.+ Oops\\.\\. you've provided a nil checker!\n\n"
- testHelperFailure(c, "Assert(obtained, nil)", nil, true, log,
- func() interface{} {
- c.Assert(1, nil)
- return nil
- })
-}
-
-// -----------------------------------------------------------------------
-// Ensure that values logged work properly in some interesting cases.
-
-func (s *HelpersS) TestValueLoggingWithArrays(c *check.C) {
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test.go:[0-9]+:.*\nhelpers_test.go:[0-9]+:\n" +
- " return c\\.Check\\(\\[\\]byte{1, 2}, checker, \\[\\]byte{1, 3}\\)\n" +
- "\\.+ myobtained \\[\\]uint8 = \\[\\]byte{0x1, 0x2}\n" +
- "\\.+ myexpected \\[\\]uint8 = \\[\\]byte{0x1, 0x3}\n\n"
- testHelperFailure(c, "Check([]byte{1}, chk, []byte{3})", false, false, log,
- func() interface{} {
- return c.Check([]byte{1, 2}, checker, []byte{1, 3})
- })
-}
-
-func (s *HelpersS) TestValueLoggingWithMultiLine(c *check.C) {
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test.go:[0-9]+:.*\nhelpers_test.go:[0-9]+:\n" +
- " return c\\.Check\\(\"a\\\\nb\\\\n\", checker, \"a\\\\nb\\\\nc\"\\)\n" +
- "\\.+ myobtained string = \"\" \\+\n" +
- "\\.+ \"a\\\\n\" \\+\n" +
- "\\.+ \"b\\\\n\"\n" +
- "\\.+ myexpected string = \"\" \\+\n" +
- "\\.+ \"a\\\\n\" \\+\n" +
- "\\.+ \"b\\\\n\" \\+\n" +
- "\\.+ \"c\"\n\n"
- testHelperFailure(c, `Check("a\nb\n", chk, "a\nb\nc")`, false, false, log,
- func() interface{} {
- return c.Check("a\nb\n", checker, "a\nb\nc")
- })
-}
-
-func (s *HelpersS) TestValueLoggingWithMultiLineException(c *check.C) {
- // If the newline is at the end of the string, don't log as multi-line.
- checker := &MyChecker{result: false}
- log := "(?s)helpers_test.go:[0-9]+:.*\nhelpers_test.go:[0-9]+:\n" +
- " return c\\.Check\\(\"a b\\\\n\", checker, \"a\\\\nb\"\\)\n" +
- "\\.+ myobtained string = \"a b\\\\n\"\n" +
- "\\.+ myexpected string = \"\" \\+\n" +
- "\\.+ \"a\\\\n\" \\+\n" +
- "\\.+ \"b\"\n\n"
- testHelperFailure(c, `Check("a b\n", chk, "a\nb")`, false, false, log,
- func() interface{} {
- return c.Check("a b\n", checker, "a\nb")
- })
-}
-
-// -----------------------------------------------------------------------
-// MakeDir() tests.
-
-type MkDirHelper struct {
- path1 string
- path2 string
- isDir1 bool
- isDir2 bool
- isDir3 bool
- isDir4 bool
-}
-
-func (s *MkDirHelper) SetUpSuite(c *check.C) {
- s.path1 = c.MkDir()
- s.isDir1 = isDir(s.path1)
-}
-
-func (s *MkDirHelper) Test(c *check.C) {
- s.path2 = c.MkDir()
- s.isDir2 = isDir(s.path2)
-}
-
-func (s *MkDirHelper) TearDownSuite(c *check.C) {
- s.isDir3 = isDir(s.path1)
- s.isDir4 = isDir(s.path2)
-}
-
-func (s *HelpersS) TestMkDir(c *check.C) {
- helper := MkDirHelper{}
- output := String{}
- check.Run(&helper, &check.RunConf{Output: &output})
- c.Assert(output.value, check.Equals, "")
- c.Check(helper.isDir1, check.Equals, true)
- c.Check(helper.isDir2, check.Equals, true)
- c.Check(helper.isDir3, check.Equals, true)
- c.Check(helper.isDir4, check.Equals, true)
- c.Check(helper.path1, check.Not(check.Equals),
- helper.path2)
- c.Check(isDir(helper.path1), check.Equals, false)
- c.Check(isDir(helper.path2), check.Equals, false)
-}
-
-func isDir(path string) bool {
- if stat, err := os.Stat(path); err == nil {
- return stat.IsDir()
- }
- return false
-}
-
-// Concurrent logging should not corrupt the underling buffer.
-// Use go test -race to detect the race in this test.
-func (s *HelpersS) TestConcurrentLogging(c *check.C) {
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(runtime.NumCPU()))
- var start, stop sync.WaitGroup
- start.Add(1)
- for i, n := 0, runtime.NumCPU()*2; i < n; i++ {
- stop.Add(1)
- go func(i int) {
- start.Wait()
- for j := 0; j < 30; j++ {
- c.Logf("Worker %d: line %d", i, j)
- }
- stop.Done()
- }(i)
- }
- start.Done()
- stop.Wait()
-}
-
-// -----------------------------------------------------------------------
-// Test the TestName function
-
-type TestNameHelper struct {
- name1 string
- name2 string
- name3 string
- name4 string
- name5 string
-}
-
-func (s *TestNameHelper) SetUpSuite(c *check.C) { s.name1 = c.TestName() }
-func (s *TestNameHelper) SetUpTest(c *check.C) { s.name2 = c.TestName() }
-func (s *TestNameHelper) Test(c *check.C) { s.name3 = c.TestName() }
-func (s *TestNameHelper) TearDownTest(c *check.C) { s.name4 = c.TestName() }
-func (s *TestNameHelper) TearDownSuite(c *check.C) { s.name5 = c.TestName() }
-
-func (s *HelpersS) TestTestName(c *check.C) {
- helper := TestNameHelper{}
- output := String{}
- check.Run(&helper, &check.RunConf{Output: &output})
- c.Check(helper.name1, check.Equals, "")
- c.Check(helper.name2, check.Equals, "TestNameHelper.Test")
- c.Check(helper.name3, check.Equals, "TestNameHelper.Test")
- c.Check(helper.name4, check.Equals, "TestNameHelper.Test")
- c.Check(helper.name5, check.Equals, "")
-}
-
-// -----------------------------------------------------------------------
-// A couple of helper functions to test helper functions. :-)
-
-func testHelperSuccess(c *check.C, name string, expectedResult interface{}, closure func() interface{}) {
- var result interface{}
- defer (func() {
- if err := recover(); err != nil {
- panic(err)
- }
- checkState(c, result,
- &expectedState{
- name: name,
- result: expectedResult,
- failed: false,
- log: "",
- })
- })()
- result = closure()
-}
-
-func testHelperFailure(c *check.C, name string, expectedResult interface{}, shouldStop bool, log string, closure func() interface{}) {
- var result interface{}
- defer (func() {
- if err := recover(); err != nil {
- panic(err)
- }
- checkState(c, result,
- &expectedState{
- name: name,
- result: expectedResult,
- failed: true,
- log: log,
- })
- })()
- result = closure()
- if shouldStop {
- c.Logf("%s didn't stop when it should", name)
- }
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/printer_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/printer_test.go
deleted file mode 100644
index 538b2d52..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/printer_test.go
+++ /dev/null
@@ -1,104 +0,0 @@
-package check_test
-
-import (
- . "gopkg.in/check.v1"
-)
-
-var _ = Suite(&PrinterS{})
-
-type PrinterS struct{}
-
-func (s *PrinterS) TestCountSuite(c *C) {
- suitesRun += 1
-}
-
-var printTestFuncLine int
-
-func init() {
- printTestFuncLine = getMyLine() + 3
-}
-
-func printTestFunc() {
- println(1) // Comment1
- if 2 == 2 { // Comment2
- println(3) // Comment3
- }
- switch 5 {
- case 6: println(6) // Comment6
- println(7)
- }
- switch interface{}(9).(type) {// Comment9
- case int: println(10)
- println(11)
- }
- select {
- case <-(chan bool)(nil): println(14)
- println(15)
- default: println(16)
- println(17)
- }
- println(19,
- 20)
- _ = func() { println(21)
- println(22)
- }
- println(24, func() {
- println(25)
- })
- // Leading comment
- // with multiple lines.
- println(29) // Comment29
-}
-
-var printLineTests = []struct {
- line int
- output string
-}{
- {1, "println(1) // Comment1"},
- {2, "if 2 == 2 { // Comment2\n ...\n}"},
- {3, "println(3) // Comment3"},
- {5, "switch 5 {\n...\n}"},
- {6, "case 6:\n println(6) // Comment6\n ..."},
- {7, "println(7)"},
- {9, "switch interface{}(9).(type) { // Comment9\n...\n}"},
- {10, "case int:\n println(10)\n ..."},
- {14, "case <-(chan bool)(nil):\n println(14)\n ..."},
- {15, "println(15)"},
- {16, "default:\n println(16)\n ..."},
- {17, "println(17)"},
- {19, "println(19,\n 20)"},
- {20, "println(19,\n 20)"},
- {21, "_ = func() {\n println(21)\n println(22)\n}"},
- {22, "println(22)"},
- {24, "println(24, func() {\n println(25)\n})"},
- {25, "println(25)"},
- {26, "println(24, func() {\n println(25)\n})"},
- {29, "// Leading comment\n// with multiple lines.\nprintln(29) // Comment29"},
-}
-
-func (s *PrinterS) TestPrintLine(c *C) {
- for _, test := range printLineTests {
- output, err := PrintLine("printer_test.go", printTestFuncLine+test.line)
- c.Assert(err, IsNil)
- c.Assert(output, Equals, test.output)
- }
-}
-
-var indentTests = []struct {
- in, out string
-}{
- {"", ""},
- {"\n", "\n"},
- {"a", ">>>a"},
- {"a\n", ">>>a\n"},
- {"a\nb", ">>>a\n>>>b"},
- {" ", ">>> "},
-}
-
-func (s *PrinterS) TestIndent(c *C) {
- for _, test := range indentTests {
- out := Indent(test.in, ">>>")
- c.Assert(out, Equals, test.out)
- }
-
-}
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/run_test.go b/Godeps/_workspace/src/gopkg.in/check.v1/run_test.go
deleted file mode 100644
index f41fffc3..00000000
--- a/Godeps/_workspace/src/gopkg.in/check.v1/run_test.go
+++ /dev/null
@@ -1,419 +0,0 @@
-// These tests verify the test running logic.
-
-package check_test
-
-import (
- "errors"
- . "gopkg.in/check.v1"
- "os"
- "sync"
-)
-
-var runnerS = Suite(&RunS{})
-
-type RunS struct{}
-
-func (s *RunS) TestCountSuite(c *C) {
- suitesRun += 1
-}
-
-// -----------------------------------------------------------------------
-// Tests ensuring result counting works properly.
-
-func (s *RunS) TestSuccess(c *C) {
- output := String{}
- result := Run(&SuccessHelper{}, &RunConf{Output: &output})
- c.Check(result.Succeeded, Equals, 1)
- c.Check(result.Failed, Equals, 0)
- c.Check(result.Skipped, Equals, 0)
- c.Check(result.Panicked, Equals, 0)
- c.Check(result.FixturePanicked, Equals, 0)
- c.Check(result.Missed, Equals, 0)
- c.Check(result.RunError, IsNil)
-}
-
-func (s *RunS) TestFailure(c *C) {
- output := String{}
- result := Run(&FailHelper{}, &RunConf{Output: &output})
- c.Check(result.Succeeded, Equals, 0)
- c.Check(result.Failed, Equals, 1)
- c.Check(result.Skipped, Equals, 0)
- c.Check(result.Panicked, Equals, 0)
- c.Check(result.FixturePanicked, Equals, 0)
- c.Check(result.Missed, Equals, 0)
- c.Check(result.RunError, IsNil)
-}
-
-func (s *RunS) TestFixture(c *C) {
- output := String{}
- result := Run(&FixtureHelper{}, &RunConf{Output: &output})
- c.Check(result.Succeeded, Equals, 2)
- c.Check(result.Failed, Equals, 0)
- c.Check(result.Skipped, Equals, 0)
- c.Check(result.Panicked, Equals, 0)
- c.Check(result.FixturePanicked, Equals, 0)
- c.Check(result.Missed, Equals, 0)
- c.Check(result.RunError, IsNil)
-}
-
-func (s *RunS) TestPanicOnTest(c *C) {
- output := String{}
- helper := &FixtureHelper{panicOn: "Test1"}
- result := Run(helper, &RunConf{Output: &output})
- c.Check(result.Succeeded, Equals, 1)
- c.Check(result.Failed, Equals, 0)
- c.Check(result.Skipped, Equals, 0)
- c.Check(result.Panicked, Equals, 1)
- c.Check(result.FixturePanicked, Equals, 0)
- c.Check(result.Missed, Equals, 0)
- c.Check(result.RunError, IsNil)
-}
-
-func (s *RunS) TestPanicOnSetUpTest(c *C) {
- output := String{}
- helper := &FixtureHelper{panicOn: "SetUpTest"}
- result := Run(helper, &RunConf{Output: &output})
- c.Check(result.Succeeded, Equals, 0)
- c.Check(result.Failed, Equals, 0)
- c.Check(result.Skipped, Equals, 0)
- c.Check(result.Panicked, Equals, 0)
- c.Check(result.FixturePanicked, Equals, 1)
- c.Check(result.Missed, Equals, 2)
- c.Check(result.RunError, IsNil)
-}
-
-func (s *RunS) TestPanicOnSetUpSuite(c *C) {
- output := String{}
- helper := &FixtureHelper{panicOn: "SetUpSuite"}
- result := Run(helper, &RunConf{Output: &output})
- c.Check(result.Succeeded, Equals, 0)
- c.Check(result.Failed, Equals, 0)
- c.Check(result.Skipped, Equals, 0)
- c.Check(result.Panicked, Equals, 0)
- c.Check(result.FixturePanicked, Equals, 1)
- c.Check(result.Missed, Equals, 2)
- c.Check(result.RunError, IsNil)
-}
-
-// -----------------------------------------------------------------------
-// Check result aggregation.
-
-func (s *RunS) TestAdd(c *C) {
- result := &Result{
- Succeeded: 1,
- Skipped: 2,
- Failed: 3,
- Panicked: 4,
- FixturePanicked: 5,
- Missed: 6,
- ExpectedFailures: 7,
- }
- result.Add(&Result{
- Succeeded: 10,
- Skipped: 20,
- Failed: 30,
- Panicked: 40,
- FixturePanicked: 50,
- Missed: 60,
- ExpectedFailures: 70,
- })
- c.Check(result.Succeeded, Equals, 11)
- c.Check(result.Skipped, Equals, 22)
- c.Check(result.Failed, Equals, 33)
- c.Check(result.Panicked, Equals, 44)
- c.Check(result.FixturePanicked, Equals, 55)
- c.Check(result.Missed, Equals, 66)
- c.Check(result.ExpectedFailures, Equals, 77)
- c.Check(result.RunError, IsNil)
-}
-
-// -----------------------------------------------------------------------
-// Check the Passed() method.
-
-func (s *RunS) TestPassed(c *C) {
- c.Assert((&Result{}).Passed(), Equals, true)
- c.Assert((&Result{Succeeded: 1}).Passed(), Equals, true)
- c.Assert((&Result{Skipped: 1}).Passed(), Equals, true)
- c.Assert((&Result{Failed: 1}).Passed(), Equals, false)
- c.Assert((&Result{Panicked: 1}).Passed(), Equals, false)
- c.Assert((&Result{FixturePanicked: 1}).Passed(), Equals, false)
- c.Assert((&Result{Missed: 1}).Passed(), Equals, false)
- c.Assert((&Result{RunError: errors.New("!")}).Passed(), Equals, false)
-}
-
-// -----------------------------------------------------------------------
-// Check that result printing is working correctly.
-
-func (s *RunS) TestPrintSuccess(c *C) {
- result := &Result{Succeeded: 5}
- c.Check(result.String(), Equals, "OK: 5 passed")
-}
-
-func (s *RunS) TestPrintFailure(c *C) {
- result := &Result{Failed: 5}
- c.Check(result.String(), Equals, "OOPS: 0 passed, 5 FAILED")
-}
-
-func (s *RunS) TestPrintSkipped(c *C) {
- result := &Result{Skipped: 5}
- c.Check(result.String(), Equals, "OK: 0 passed, 5 skipped")
-}
-
-func (s *RunS) TestPrintExpectedFailures(c *C) {
- result := &Result{ExpectedFailures: 5}
- c.Check(result.String(), Equals, "OK: 0 passed, 5 expected failures")
-}
-
-func (s *RunS) TestPrintPanicked(c *C) {
- result := &Result{Panicked: 5}
- c.Check(result.String(), Equals, "OOPS: 0 passed, 5 PANICKED")
-}
-
-func (s *RunS) TestPrintFixturePanicked(c *C) {
- result := &Result{FixturePanicked: 5}
- c.Check(result.String(), Equals, "OOPS: 0 passed, 5 FIXTURE-PANICKED")
-}
-
-func (s *RunS) TestPrintMissed(c *C) {
- result := &Result{Missed: 5}
- c.Check(result.String(), Equals, "OOPS: 0 passed, 5 MISSED")
-}
-
-func (s *RunS) TestPrintAll(c *C) {
- result := &Result{Succeeded: 1, Skipped: 2, ExpectedFailures: 3,
- Panicked: 4, FixturePanicked: 5, Missed: 6}
- c.Check(result.String(), Equals,
- "OOPS: 1 passed, 2 skipped, 3 expected failures, 4 PANICKED, "+
- "5 FIXTURE-PANICKED, 6 MISSED")
-}
-
-func (s *RunS) TestPrintRunError(c *C) {
- result := &Result{Succeeded: 1, Failed: 1,
- RunError: errors.New("Kaboom!")}
- c.Check(result.String(), Equals, "ERROR: Kaboom!")
-}
-
-// -----------------------------------------------------------------------
-// Verify that the method pattern flag works correctly.
-
-func (s *RunS) TestFilterTestName(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Filter: "Test[91]"}
- Run(&helper, &runConf)
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 5)
-}
-
-func (s *RunS) TestFilterTestNameWithAll(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Filter: ".*"}
- Run(&helper, &runConf)
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "SetUpTest")
- c.Check(helper.calls[5], Equals, "Test2")
- c.Check(helper.calls[6], Equals, "TearDownTest")
- c.Check(helper.calls[7], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 8)
-}
-
-func (s *RunS) TestFilterSuiteName(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Filter: "FixtureHelper"}
- Run(&helper, &runConf)
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test1")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "SetUpTest")
- c.Check(helper.calls[5], Equals, "Test2")
- c.Check(helper.calls[6], Equals, "TearDownTest")
- c.Check(helper.calls[7], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 8)
-}
-
-func (s *RunS) TestFilterSuiteNameAndTestName(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Filter: "FixtureHelper\\.Test2"}
- Run(&helper, &runConf)
- c.Check(helper.calls[0], Equals, "SetUpSuite")
- c.Check(helper.calls[1], Equals, "SetUpTest")
- c.Check(helper.calls[2], Equals, "Test2")
- c.Check(helper.calls[3], Equals, "TearDownTest")
- c.Check(helper.calls[4], Equals, "TearDownSuite")
- c.Check(len(helper.calls), Equals, 5)
-}
-
-func (s *RunS) TestFilterAllOut(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Filter: "NotFound"}
- Run(&helper, &runConf)
- c.Check(len(helper.calls), Equals, 0)
-}
-
-func (s *RunS) TestRequirePartialMatch(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Filter: "est"}
- Run(&helper, &runConf)
- c.Check(len(helper.calls), Equals, 8)
-}
-
-func (s *RunS) TestFilterError(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Filter: "]["}
- result := Run(&helper, &runConf)
- c.Check(result.String(), Equals,
- "ERROR: Bad filter expression: error parsing regexp: missing closing ]: `[`")
- c.Check(len(helper.calls), Equals, 0)
-}
-
-// -----------------------------------------------------------------------
-// Verify that List works correctly.
-
-func (s *RunS) TestListFiltered(c *C) {
- names := List(&FixtureHelper{}, &RunConf{Filter: "1"})
- c.Assert(names, DeepEquals, []string{
- "FixtureHelper.Test1",
- })
-}
-
-func (s *RunS) TestList(c *C) {
- names := List(&FixtureHelper{}, &RunConf{})
- c.Assert(names, DeepEquals, []string{
- "FixtureHelper.Test1",
- "FixtureHelper.Test2",
- })
-}
-
-// -----------------------------------------------------------------------
-// Verify that verbose mode prints tests which pass as well.
-
-func (s *RunS) TestVerboseMode(c *C) {
- helper := FixtureHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Verbose: true}
- Run(&helper, &runConf)
-
- expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Test1\t *[.0-9]+s\n" +
- "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Test2\t *[.0-9]+s\n"
-
- c.Assert(output.value, Matches, expected)
-}
-
-func (s *RunS) TestVerboseModeWithFailBeforePass(c *C) {
- helper := FixtureHelper{panicOn: "Test1"}
- output := String{}
- runConf := RunConf{Output: &output, Verbose: true}
- Run(&helper, &runConf)
-
- expected := "(?s).*PANIC.*\n-+\n" + // Should have an extra line.
- "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Test2\t *[.0-9]+s\n"
-
- c.Assert(output.value, Matches, expected)
-}
-
-// -----------------------------------------------------------------------
-// Verify the stream output mode. In this mode there's no output caching.
-
-type StreamHelper struct {
- l2 sync.Mutex
- l3 sync.Mutex
-}
-
-func (s *StreamHelper) SetUpSuite(c *C) {
- c.Log("0")
-}
-
-func (s *StreamHelper) Test1(c *C) {
- c.Log("1")
- s.l2.Lock()
- s.l3.Lock()
- go func() {
- s.l2.Lock() // Wait for "2".
- c.Log("3")
- s.l3.Unlock()
- }()
-}
-
-func (s *StreamHelper) Test2(c *C) {
- c.Log("2")
- s.l2.Unlock()
- s.l3.Lock() // Wait for "3".
- c.Fail()
- c.Log("4")
-}
-
-func (s *RunS) TestStreamMode(c *C) {
- helper := &StreamHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Stream: true}
- Run(helper, &runConf)
-
- expected := "START: run_test\\.go:[0-9]+: StreamHelper\\.SetUpSuite\n0\n" +
- "PASS: run_test\\.go:[0-9]+: StreamHelper\\.SetUpSuite\t *[.0-9]+s\n\n" +
- "START: run_test\\.go:[0-9]+: StreamHelper\\.Test1\n1\n" +
- "PASS: run_test\\.go:[0-9]+: StreamHelper\\.Test1\t *[.0-9]+s\n\n" +
- "START: run_test\\.go:[0-9]+: StreamHelper\\.Test2\n2\n3\n4\n" +
- "FAIL: run_test\\.go:[0-9]+: StreamHelper\\.Test2\n\n"
-
- c.Assert(output.value, Matches, expected)
-}
-
-type StreamMissHelper struct{}
-
-func (s *StreamMissHelper) SetUpSuite(c *C) {
- c.Log("0")
- c.Fail()
-}
-
-func (s *StreamMissHelper) Test1(c *C) {
- c.Log("1")
-}
-
-func (s *RunS) TestStreamModeWithMiss(c *C) {
- helper := &StreamMissHelper{}
- output := String{}
- runConf := RunConf{Output: &output, Stream: true}
- Run(helper, &runConf)
-
- expected := "START: run_test\\.go:[0-9]+: StreamMissHelper\\.SetUpSuite\n0\n" +
- "FAIL: run_test\\.go:[0-9]+: StreamMissHelper\\.SetUpSuite\n\n" +
- "START: run_test\\.go:[0-9]+: StreamMissHelper\\.Test1\n" +
- "MISS: run_test\\.go:[0-9]+: StreamMissHelper\\.Test1\n\n"
-
- c.Assert(output.value, Matches, expected)
-}
-
-// -----------------------------------------------------------------------
-// Verify that that the keep work dir request indeed does so.
-
-type WorkDirSuite struct {}
-
-func (s *WorkDirSuite) Test(c *C) {
- c.MkDir()
-}
-
-func (s *RunS) TestKeepWorkDir(c *C) {
- output := String{}
- runConf := RunConf{Output: &output, Verbose: true, KeepWorkDir: true}
- result := Run(&WorkDirSuite{}, &runConf)
-
- c.Assert(result.String(), Matches, ".*\nWORK=" + result.WorkDir)
-
- stat, err := os.Stat(result.WorkDir)
- c.Assert(err, IsNil)
- c.Assert(stat.IsDir(), Equals, true)
-}
diff --git a/Makefile b/Makefile
index c01794fe..3d9a02c1 100644
--- a/Makefile
+++ b/Makefile
@@ -7,69 +7,62 @@ checkdeps:
checkgopath:
@echo "Checking if project is at ${GOPATH}"
- @for mcpath in $(echo ${GOPATH} | sed 's/:/\n/g' | grep -v Godeps); do if [ ! -d ${mcpath}/src/github.com/minio/mc ]; then echo "Project not found in ${mcpath}, please follow instructions provided at https://github.com/minio/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi done
+ @for mcpath in $(echo ${GOPATH} | sed 's/:/\n/g'); do if [ ! -d ${mcpath}/src/github.com/minio/mc ]; then echo "Project not found in ${mcpath}, please follow instructions provided at https://github.com/minio/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi done
getdeps: checkdeps checkgopath
- @go get github.com/tools/godep && echo "Installed godep:"
@go get github.com/golang/lint/golint && echo "Installed golint:"
@go get golang.org/x/tools/cmd/vet && echo "Installed vet:"
@go get github.com/fzipp/gocyclo && echo "Installed gocyclo:"
@go get github.com/remyoudompheng/go-misc/deadcode && echo "Installed deadcode:"
# verifiers: getdeps vet fmt lint cyclo deadcode
-verifiers: getdeps vet fmt lint cyclo
+verifiers: getdeps vet fmt lint cyclo deadcode
vet:
@echo "Running $@:"
- @go vet ./...
+ @go vet .
+ @go vet github.com/minio/mc/pkg...
fmt:
@echo "Running $@:"
- @test -z "$$(gofmt -s -l . 2>&1 | grep -v 'Godeps/_workspace/src/')" || \
- echo "+ please format Go code with 'gofmt -s'"
+ @gofmt -s -l *.go
+ @gofmt -s -l pkg
lint:
@echo "Running $@:"
- @test -z "$$(golint ./... 2>&1 | grep -v 'Godeps/_workspace/src/')"
+ @golint .
+ @golint pkg
cyclo:
@echo "Running $@:"
- @test -z "$$(gocyclo -over 30 . 2>&1 | grep -v 'Godeps/_workspace/src/')"
+ @gocyclo -over 30 .
deadcode:
@echo "Running $@:"
- @test -z "$$(deadcode 2>&1 | grep -v 'Godeps/_workspace/src/')"
+ @deadcode
build: getdeps verifiers
@echo "Installing mc:"
- @godep go test -race ./...
+ @go test -race ./
+ @go test -race github.com/minio/mc/pkg...
gomake-all: build
- @godep go install github.com/minio/mc
+ @go install github.com/minio/mc
@mkdir -p $(HOME)/.mc
release: genversion
@echo "Installing minio with new version.go:"
- @godep go install github.com/minio/mc
+ @go install github.com/minio/mc
@mkdir -p $(HOME)/.mc
genversion:
@echo "Generating a new version.go:"
- @godep go run genversion.go
+ @go run genversion.go
coverage:
@go test -race -coverprofile=cover.out
@go tool cover -html=cover.out && echo "Visit your browser"
-godepupdate:
- @(env bash $(PWD)/buildscripts/updatedeps.sh)
-save:
- @godep save ./...
-
-env:
- @godep go env
-
install: gomake-all
clean:
@rm -fv cover.out
@rm -fv mc
- @find Godeps -name "*.a" -type f -exec rm -vf {} \+
diff --git a/access-main.go b/access-main.go
index f8faa6f8..b61c53eb 100644
--- a/access-main.go
+++ b/access-main.go
@@ -17,9 +17,9 @@
package main
import (
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
- "github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/aliases.go b/aliases.go
index b8c5f031..7d45949b 100644
--- a/aliases.go
+++ b/aliases.go
@@ -20,8 +20,8 @@ import (
"regexp"
"strings"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
- "github.com/minio/minio/pkg/probe"
)
// validAliasURL: use net/url.Parse to validate
diff --git a/buildscripts/updatedeps.sh b/buildscripts/updatedeps.sh
deleted file mode 100755
index 6c8281f2..00000000
--- a/buildscripts/updatedeps.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env bash
-#
-# Minio Client (C) 2015 Minio, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-_init() {
- godeps="Godeps/Godeps.json"
- filter="minio/mc"
-}
-
-update() {
- for dep in $@; do
- godep update $dep;
- done
-}
-
-main() {
- deps=$(env grep ImportPath ${godeps} | grep -v ${filter} | cut -f2 -d: | sed -e 's/,//' -e 's/^[ \t]*//' -e 's/[ \t]*$//' -e 's/\"//g' | tr '\n' ' ')
- update ${deps}
-}
-
-_init && main "$@"
diff --git a/cat-main.go b/cat-main.go
index ad063219..34bdd76a 100644
--- a/cat-main.go
+++ b/cat-main.go
@@ -21,8 +21,8 @@ import (
"os"
"syscall"
- "github.com/minio/cli"
- "github.com/minio/minio/pkg/probe"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/cat_test.go b/cat_test.go
index aec401c0..0911c2eb 100644
--- a/cat_test.go
+++ b/cat_test.go
@@ -22,9 +22,9 @@ import (
"os"
"path/filepath"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
- . "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestCatCmd(c *C) {
diff --git a/cmd_test.go b/cmd_test.go
index 37d2b41c..ddb23763 100644
--- a/cmd_test.go
+++ b/cmd_test.go
@@ -26,10 +26,10 @@ import (
"net/http/httptest"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/quick"
- . "gopkg.in/check.v1"
)
var customConfigDir string
diff --git a/common-methods.go b/common-methods.go
index ca1633b3..d6b804f4 100644
--- a/common-methods.go
+++ b/common-methods.go
@@ -23,10 +23,10 @@ import (
"strings"
"sync"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/client/fs"
"github.com/minio/mc/pkg/client/s3"
- "github.com/minio/minio/pkg/probe"
)
// Check if the target URL represents folder. It may or may not exist yet.
diff --git a/common_methods_test.go b/common_methods_test.go
index a5be5e3a..96d0f9cb 100644
--- a/common_methods_test.go
+++ b/common_methods_test.go
@@ -23,7 +23,7 @@ import (
"os"
"path/filepath"
- . "gopkg.in/check.v1"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestCommonMethods(c *C) {
diff --git a/config-main.go b/config-main.go
index fae17e8e..8e142f61 100644
--- a/config-main.go
+++ b/config-main.go
@@ -19,10 +19,10 @@ package main
import (
"strings"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/quick"
- "github.com/minio/minio/pkg/probe"
)
// Configure minio client
diff --git a/config.go b/config.go
index 21f60255..02016611 100644
--- a/config.go
+++ b/config.go
@@ -23,9 +23,9 @@ import (
"runtime"
"sync"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/quick"
- "github.com/minio/minio/pkg/probe"
)
type configV1 struct {
@@ -280,10 +280,3 @@ func newConfig() (config quick.Config, err *probe.Error) {
}
return config, nil
}
-
-// mustNewConfig instantiates a new config handler, exists upon error
-func mustNewConfig() quick.Config {
- config, err := newConfig()
- fatalIf(err)
- return config
-}
diff --git a/cp-main.go b/cp-main.go
index 31251a4e..d4e53673 100644
--- a/cp-main.go
+++ b/cp-main.go
@@ -26,9 +26,9 @@ import (
"runtime"
"sync"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/cp-url.go b/cp-url.go
index 6612df27..c0333ec8 100644
--- a/cp-url.go
+++ b/cp-url.go
@@ -20,10 +20,10 @@ import (
"path/filepath"
"strings"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
type copyURLs struct {
diff --git a/cp_mirror_test.go b/cp_mirror_test.go
index 02d11ced..1586deac 100644
--- a/cp_mirror_test.go
+++ b/cp_mirror_test.go
@@ -19,8 +19,8 @@ package main
import (
"os"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/console"
- . "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestCopyURLType(c *C) {
diff --git a/diff-main.go b/diff-main.go
index a9a824fd..9715ead0 100644
--- a/diff-main.go
+++ b/diff-main.go
@@ -17,9 +17,9 @@
package main
import (
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/diff.go b/diff.go
index 3c61eccc..1690246b 100644
--- a/diff.go
+++ b/diff.go
@@ -22,10 +22,10 @@ import (
"sync"
"time"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
+ "github.com/minio/mc/internal/github.com/tchap/go-patricia/patricia"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
- "github.com/tchap/go-patricia/patricia"
)
//
@@ -54,11 +54,6 @@ type diff struct {
err *probe.Error
}
-func mustURLJoinPath(url1, url2 string) string {
- newURL, _ := urlJoinPath(url1, url2)
- return newURL
-}
-
// urlJoinPath Join a path to existing URL
func urlJoinPath(url1, url2 string) (string, *probe.Error) {
u1, err := client.Parse(url1)
diff --git a/diff_test.go b/diff_test.go
index 18972c55..200f4f99 100644
--- a/diff_test.go
+++ b/diff_test.go
@@ -23,9 +23,9 @@ import (
"path/filepath"
"strconv"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
- . "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestDiffObjects(c *C) {
diff --git a/error.go b/error.go
index e242501a..934e4462 100644
--- a/error.go
+++ b/error.go
@@ -17,8 +17,8 @@
package main
import (
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// fatalIf wrapper function which takes error and selectively prints stack frames if available on debug
diff --git a/flags.go b/flags.go
index 4f142f6a..589798a0 100644
--- a/flags.go
+++ b/flags.go
@@ -20,7 +20,7 @@ import (
"fmt"
"strings"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
"github.com/minio/mc/pkg/console"
)
diff --git a/hostconfig.go b/hostconfig.go
index 6c3ca0ae..42179fa4 100644
--- a/hostconfig.go
+++ b/hostconfig.go
@@ -19,8 +19,8 @@ package main
import (
"path/filepath"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
- "github.com/minio/minio/pkg/probe"
)
type hostConfig struct {
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/LICENSE b/internal/github.com/dustin/go-humanize/LICENSE
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/LICENSE
rename to internal/github.com/dustin/go-humanize/LICENSE
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/README.markdown b/internal/github.com/dustin/go-humanize/README.markdown
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/README.markdown
rename to internal/github.com/dustin/go-humanize/README.markdown
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/big.go b/internal/github.com/dustin/go-humanize/big.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/big.go
rename to internal/github.com/dustin/go-humanize/big.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/bigbytes.go b/internal/github.com/dustin/go-humanize/bigbytes.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/bigbytes.go
rename to internal/github.com/dustin/go-humanize/bigbytes.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/bytes.go b/internal/github.com/dustin/go-humanize/bytes.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/bytes.go
rename to internal/github.com/dustin/go-humanize/bytes.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/comma.go b/internal/github.com/dustin/go-humanize/comma.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/comma.go
rename to internal/github.com/dustin/go-humanize/comma.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/ftoa.go b/internal/github.com/dustin/go-humanize/ftoa.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/ftoa.go
rename to internal/github.com/dustin/go-humanize/ftoa.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/humanize.go b/internal/github.com/dustin/go-humanize/humanize.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/humanize.go
rename to internal/github.com/dustin/go-humanize/humanize.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/number.go b/internal/github.com/dustin/go-humanize/number.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/number.go
rename to internal/github.com/dustin/go-humanize/number.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/ordinals.go b/internal/github.com/dustin/go-humanize/ordinals.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/ordinals.go
rename to internal/github.com/dustin/go-humanize/ordinals.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/si.go b/internal/github.com/dustin/go-humanize/si.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/si.go
rename to internal/github.com/dustin/go-humanize/si.go
diff --git a/Godeps/_workspace/src/github.com/dustin/go-humanize/times.go b/internal/github.com/dustin/go-humanize/times.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/dustin/go-humanize/times.go
rename to internal/github.com/dustin/go-humanize/times.go
diff --git a/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md b/internal/github.com/fatih/color/LICENSE.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/color/LICENSE.md
rename to internal/github.com/fatih/color/LICENSE.md
diff --git a/Godeps/_workspace/src/github.com/fatih/color/README.md b/internal/github.com/fatih/color/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/color/README.md
rename to internal/github.com/fatih/color/README.md
diff --git a/Godeps/_workspace/src/github.com/fatih/color/color.go b/internal/github.com/fatih/color/color.go
similarity index 98%
rename from Godeps/_workspace/src/github.com/fatih/color/color.go
rename to internal/github.com/fatih/color/color.go
index 7872d3e2..7da09172 100644
--- a/Godeps/_workspace/src/github.com/fatih/color/color.go
+++ b/internal/github.com/fatih/color/color.go
@@ -6,8 +6,8 @@ import (
"strconv"
"strings"
- "github.com/mattn/go-isatty"
- "github.com/shiena/ansicolor"
+ "github.com/minio/mc/internal/github.com/mattn/go-isatty"
+ "github.com/minio/mc/internal/github.com/shiena/ansicolor"
)
// NoColor defines if the output is colorized or not. It's dynamically set to
@@ -182,7 +182,7 @@ func (c *Color) PrintlnFunc() func(a ...interface{}) {
// string. Windows users should use this in conjuction with color.Output, example:
//
// put := New(FgYellow).SprintFunc()
-// fmt.Ffprintf(color.Output, "This is a %s", put("warning"))
+// fmt.Fprintf(color.Output, "This is a %s", put("warning"))
func (c *Color) SprintFunc() func(a ...interface{}) string {
return func(a ...interface{}) string {
return c.wrap(fmt.Sprint(a...))
diff --git a/Godeps/_workspace/src/github.com/fatih/color/doc.go b/internal/github.com/fatih/color/doc.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/color/doc.go
rename to internal/github.com/fatih/color/doc.go
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/LICENSE b/internal/github.com/fatih/structs/LICENSE
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/structs/LICENSE
rename to internal/github.com/fatih/structs/LICENSE
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/README.md b/internal/github.com/fatih/structs/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/structs/README.md
rename to internal/github.com/fatih/structs/README.md
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/field.go b/internal/github.com/fatih/structs/field.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/structs/field.go
rename to internal/github.com/fatih/structs/field.go
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/structs.go b/internal/github.com/fatih/structs/structs.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/structs/structs.go
rename to internal/github.com/fatih/structs/structs.go
diff --git a/Godeps/_workspace/src/github.com/fatih/structs/tags.go b/internal/github.com/fatih/structs/tags.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/fatih/structs/tags.go
rename to internal/github.com/fatih/structs/tags.go
diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/README.md b/internal/github.com/mattn/go-isatty/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/mattn/go-isatty/README.md
rename to internal/github.com/mattn/go-isatty/README.md
diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/doc.go b/internal/github.com/mattn/go-isatty/doc.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/mattn/go-isatty/doc.go
rename to internal/github.com/mattn/go-isatty/doc.go
diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go b/internal/github.com/mattn/go-isatty/isatty_bsd.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go
rename to internal/github.com/mattn/go-isatty/isatty_bsd.go
diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_linux.go b/internal/github.com/mattn/go-isatty/isatty_linux.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_linux.go
rename to internal/github.com/mattn/go-isatty/isatty_linux.go
diff --git a/Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_windows.go b/internal/github.com/mattn/go-isatty/isatty_windows.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_windows.go
rename to internal/github.com/mattn/go-isatty/isatty_windows.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/LICENSE b/internal/github.com/minio/cli/LICENSE
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/LICENSE
rename to internal/github.com/minio/cli/LICENSE
diff --git a/Godeps/_workspace/src/github.com/minio/cli/README.md b/internal/github.com/minio/cli/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/README.md
rename to internal/github.com/minio/cli/README.md
diff --git a/Godeps/_workspace/src/github.com/minio/cli/app.go b/internal/github.com/minio/cli/app.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/app.go
rename to internal/github.com/minio/cli/app.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/bool.go b/internal/github.com/minio/cli/bool.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/bool.go
rename to internal/github.com/minio/cli/bool.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/cli.go b/internal/github.com/minio/cli/cli.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/cli.go
rename to internal/github.com/minio/cli/cli.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/command.go b/internal/github.com/minio/cli/command.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/command.go
rename to internal/github.com/minio/cli/command.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/context.go b/internal/github.com/minio/cli/context.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/context.go
rename to internal/github.com/minio/cli/context.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/duration.go b/internal/github.com/minio/cli/duration.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/duration.go
rename to internal/github.com/minio/cli/duration.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/flag.go b/internal/github.com/minio/cli/flag.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/flag.go
rename to internal/github.com/minio/cli/flag.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/float64.go b/internal/github.com/minio/cli/float64.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/float64.go
rename to internal/github.com/minio/cli/float64.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/help.go b/internal/github.com/minio/cli/help.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/help.go
rename to internal/github.com/minio/cli/help.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/int.go b/internal/github.com/minio/cli/int.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/int.go
rename to internal/github.com/minio/cli/int.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/intslice.go b/internal/github.com/minio/cli/intslice.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/intslice.go
rename to internal/github.com/minio/cli/intslice.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/string.go b/internal/github.com/minio/cli/string.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/string.go
rename to internal/github.com/minio/cli/string.go
diff --git a/Godeps/_workspace/src/github.com/minio/cli/stringslice.go b/internal/github.com/minio/cli/stringslice.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/cli/stringslice.go
rename to internal/github.com/minio/cli/stringslice.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/CONTRIBUTING.md b/internal/github.com/minio/minio-go/CONTRIBUTING.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/CONTRIBUTING.md
rename to internal/github.com/minio/minio-go/CONTRIBUTING.md
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/LICENSE b/internal/github.com/minio/minio-go/LICENSE
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/LICENSE
rename to internal/github.com/minio/minio-go/LICENSE
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/README.md b/internal/github.com/minio/minio-go/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/README.md
rename to internal/github.com/minio/minio-go/README.md
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/api-multipart-v1.go b/internal/github.com/minio/minio-go/api-multipart-v1.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/api-multipart-v1.go
rename to internal/github.com/minio/minio-go/api-multipart-v1.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/api-v1.go b/internal/github.com/minio/minio-go/api-v1.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/api-v1.go
rename to internal/github.com/minio/minio-go/api-v1.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/api-v2.go b/internal/github.com/minio/minio-go/api-v2.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/api-v2.go
rename to internal/github.com/minio/minio-go/api-v2.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/bucket-acl.go b/internal/github.com/minio/minio-go/bucket-acl.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/bucket-acl.go
rename to internal/github.com/minio/minio-go/bucket-acl.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/chopper.go b/internal/github.com/minio/minio-go/chopper.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/chopper.go
rename to internal/github.com/minio/minio-go/chopper.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/common.go b/internal/github.com/minio/minio-go/common.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/common.go
rename to internal/github.com/minio/minio-go/common.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/definitions.go b/internal/github.com/minio/minio-go/definitions.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/definitions.go
rename to internal/github.com/minio/minio-go/definitions.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/errors.go b/internal/github.com/minio/minio-go/errors.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/errors.go
rename to internal/github.com/minio/minio-go/errors.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/request.go b/internal/github.com/minio/minio-go/request.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/minio-go/request.go
rename to internal/github.com/minio/minio-go/request.go
diff --git a/Godeps/_workspace/src/github.com/minio/minio/pkg/probe/probe.go b/internal/github.com/minio/minio/pkg/probe/probe.go
similarity index 98%
rename from Godeps/_workspace/src/github.com/minio/minio/pkg/probe/probe.go
rename to internal/github.com/minio/minio/pkg/probe/probe.go
index ef283da2..f1e57ee2 100644
--- a/Godeps/_workspace/src/github.com/minio/minio/pkg/probe/probe.go
+++ b/internal/github.com/minio/minio/pkg/probe/probe.go
@@ -27,7 +27,7 @@ import (
"strings"
"sync"
- "github.com/dustin/go-humanize"
+ "github.com/minio/mc/internal/github.com/dustin/go-humanize"
)
// GetSysInfo returns useful system statistics.
diff --git a/Godeps/_workspace/src/github.com/minio/pb/LICENSE b/internal/github.com/minio/pb/LICENSE
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/pb/LICENSE
rename to internal/github.com/minio/pb/LICENSE
diff --git a/Godeps/_workspace/src/github.com/minio/pb/README.md b/internal/github.com/minio/pb/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/pb/README.md
rename to internal/github.com/minio/pb/README.md
diff --git a/Godeps/_workspace/src/github.com/minio/pb/format.go b/internal/github.com/minio/pb/format.go
similarity index 74%
rename from Godeps/_workspace/src/github.com/minio/pb/format.go
rename to internal/github.com/minio/pb/format.go
index 1dd210be..e986875c 100644
--- a/Godeps/_workspace/src/github.com/minio/pb/format.go
+++ b/internal/github.com/minio/pb/format.go
@@ -30,13 +30,13 @@ func Format(i int64, units Units) string {
func FormatBytes(i int64) (result string) {
switch {
case i > (1024 * 1024 * 1024 * 1024):
- result = fmt.Sprintf("%#.02f TB", float64(i)/1024/1024/1024/1024)
+ result = fmt.Sprintf("%.02f TB", float64(i)/1024/1024/1024/1024)
case i > (1024 * 1024 * 1024):
- result = fmt.Sprintf("%#.02f GB", float64(i)/1024/1024/1024)
+ result = fmt.Sprintf("%.02f GB", float64(i)/1024/1024/1024)
case i > (1024 * 1024):
- result = fmt.Sprintf("%#.02f MB", float64(i)/1024/1024)
+ result = fmt.Sprintf("%.02f MB", float64(i)/1024/1024)
case i > 1024:
- result = fmt.Sprintf("%#.02f KB", float64(i)/1024)
+ result = fmt.Sprintf("%.02f KB", float64(i)/1024)
default:
result = fmt.Sprintf("%d B", i)
}
diff --git a/Godeps/_workspace/src/github.com/minio/pb/pb.go b/internal/github.com/minio/pb/pb.go
similarity index 99%
rename from Godeps/_workspace/src/github.com/minio/pb/pb.go
rename to internal/github.com/minio/pb/pb.go
index 4e73b372..c668ef9d 100644
--- a/Godeps/_workspace/src/github.com/minio/pb/pb.go
+++ b/internal/github.com/minio/pb/pb.go
@@ -231,7 +231,7 @@ func (pb *ProgressBar) write(current int64) {
// percents
if pb.ShowPercent {
percent := float64(current) / (float64(pb.Total) / float64(100))
- percentBox = fmt.Sprintf(" %#.02f %% ", percent)
+ percentBox = fmt.Sprintf(" %.02f %% ", percent)
}
// counters
diff --git a/Godeps/_workspace/src/github.com/minio/pb/pb_nix.go b/internal/github.com/minio/pb/pb_nix.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/pb/pb_nix.go
rename to internal/github.com/minio/pb/pb_nix.go
diff --git a/Godeps/_workspace/src/github.com/minio/pb/pb_solaris.go b/internal/github.com/minio/pb/pb_solaris.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/pb/pb_solaris.go
rename to internal/github.com/minio/pb/pb_solaris.go
diff --git a/Godeps/_workspace/src/github.com/minio/pb/pb_win.go b/internal/github.com/minio/pb/pb_win.go
similarity index 75%
rename from Godeps/_workspace/src/github.com/minio/pb/pb_win.go
rename to internal/github.com/minio/pb/pb_win.go
index eb36190c..537534ce 100644
--- a/Godeps/_workspace/src/github.com/minio/pb/pb_win.go
+++ b/internal/github.com/minio/pb/pb_win.go
@@ -3,7 +3,7 @@
package pb
import (
- "github.com/olekukonko/ts"
+ "github.com/minio/mc/internal/github.com/olekukonko/ts"
)
func bold(str string) string {
diff --git a/Godeps/_workspace/src/github.com/minio/pb/pb_x.go b/internal/github.com/minio/pb/pb_x.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/pb/pb_x.go
rename to internal/github.com/minio/pb/pb_x.go
diff --git a/Godeps/_workspace/src/github.com/minio/pb/reader.go b/internal/github.com/minio/pb/reader.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/minio/pb/reader.go
rename to internal/github.com/minio/pb/reader.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/LICENCE b/internal/github.com/olekukonko/ts/LICENCE
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/LICENCE
rename to internal/github.com/olekukonko/ts/LICENCE
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/README.md b/internal/github.com/olekukonko/ts/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/README.md
rename to internal/github.com/olekukonko/ts/README.md
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/doc.go b/internal/github.com/olekukonko/ts/doc.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/doc.go
rename to internal/github.com/olekukonko/ts/doc.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts.go b/internal/github.com/olekukonko/ts/ts.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/ts.go
rename to internal/github.com/olekukonko/ts/ts.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_darwin.go b/internal/github.com/olekukonko/ts/ts_darwin.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/ts_darwin.go
rename to internal/github.com/olekukonko/ts/ts_darwin.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_linux.go b/internal/github.com/olekukonko/ts/ts_linux.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/ts_linux.go
rename to internal/github.com/olekukonko/ts/ts_linux.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_other.go b/internal/github.com/olekukonko/ts/ts_other.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/ts_other.go
rename to internal/github.com/olekukonko/ts/ts_other.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_unix.go b/internal/github.com/olekukonko/ts/ts_unix.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/ts_unix.go
rename to internal/github.com/olekukonko/ts/ts_unix.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_windows.go b/internal/github.com/olekukonko/ts/ts_windows.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/ts_windows.go
rename to internal/github.com/olekukonko/ts/ts_windows.go
diff --git a/Godeps/_workspace/src/github.com/olekukonko/ts/ts_x.go b/internal/github.com/olekukonko/ts/ts_x.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/olekukonko/ts/ts_x.go
rename to internal/github.com/olekukonko/ts/ts_x.go
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE b/internal/github.com/shiena/ansicolor/LICENSE
similarity index 100%
rename from Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE
rename to internal/github.com/shiena/ansicolor/LICENSE
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/README.md b/internal/github.com/shiena/ansicolor/README.md
similarity index 100%
rename from Godeps/_workspace/src/github.com/shiena/ansicolor/README.md
rename to internal/github.com/shiena/ansicolor/README.md
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go b/internal/github.com/shiena/ansicolor/ansicolor.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go
rename to internal/github.com/shiena/ansicolor/ansicolor.go
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go b/internal/github.com/shiena/ansicolor/ansicolor_ansi.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go
rename to internal/github.com/shiena/ansicolor/ansicolor_ansi.go
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go b/internal/github.com/shiena/ansicolor/ansicolor_windows.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go
rename to internal/github.com/shiena/ansicolor/ansicolor_windows.go
diff --git a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/children.go b/internal/github.com/tchap/go-patricia/patricia/children.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/children.go
rename to internal/github.com/tchap/go-patricia/patricia/children.go
diff --git a/Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia.go b/internal/github.com/tchap/go-patricia/patricia/patricia.go
similarity index 100%
rename from Godeps/_workspace/src/github.com/tchap/go-patricia/patricia/patricia.go
rename to internal/github.com/tchap/go-patricia/patricia/patricia.go
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/LICENSE b/internal/gopkg.in/check.v1/LICENSE
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/LICENSE
rename to internal/gopkg.in/check.v1/LICENSE
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/README.md b/internal/gopkg.in/check.v1/README.md
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/README.md
rename to internal/gopkg.in/check.v1/README.md
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/TODO b/internal/gopkg.in/check.v1/TODO
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/TODO
rename to internal/gopkg.in/check.v1/TODO
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/benchmark.go b/internal/gopkg.in/check.v1/benchmark.go
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/benchmark.go
rename to internal/gopkg.in/check.v1/benchmark.go
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/check.go b/internal/gopkg.in/check.v1/check.go
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/check.go
rename to internal/gopkg.in/check.v1/check.go
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/checkers.go b/internal/gopkg.in/check.v1/checkers.go
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/checkers.go
rename to internal/gopkg.in/check.v1/checkers.go
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/helpers.go b/internal/gopkg.in/check.v1/helpers.go
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/helpers.go
rename to internal/gopkg.in/check.v1/helpers.go
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/printer.go b/internal/gopkg.in/check.v1/printer.go
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/printer.go
rename to internal/gopkg.in/check.v1/printer.go
diff --git a/Godeps/_workspace/src/gopkg.in/check.v1/run.go b/internal/gopkg.in/check.v1/run.go
similarity index 100%
rename from Godeps/_workspace/src/gopkg.in/check.v1/run.go
rename to internal/gopkg.in/check.v1/run.go
diff --git a/internal/vendor.json b/internal/vendor.json
new file mode 100755
index 00000000..e9c620e8
--- /dev/null
+++ b/internal/vendor.json
@@ -0,0 +1,90 @@
+{
+ "comment": "",
+ "ignore": "test",
+ "package": [
+ {
+ "canonical": "github.com/dustin/go-humanize",
+ "comment": "",
+ "local": "github.com/dustin/go-humanize",
+ "revision": "1c212aae1d02984808182b98b0da7a3e07e4c770",
+ "revisionTime": "2015-08-09T13:14:05-07:00"
+ },
+ {
+ "canonical": "github.com/fatih/color",
+ "comment": "",
+ "local": "github.com/fatih/color",
+ "revision": "f773d4c806cc8e4a5749d6a35e2a4bbcd71443d6",
+ "revisionTime": "2015-08-04T08:17:43+03:00"
+ },
+ {
+ "canonical": "github.com/fatih/structs",
+ "comment": "",
+ "local": "github.com/fatih/structs",
+ "revision": "a9f7daa9c2729e97450c2da2feda19130a367d8f",
+ "revisionTime": "2015-05-26T09:43:52+03:00"
+ },
+ {
+ "canonical": "github.com/mattn/go-isatty",
+ "comment": "",
+ "local": "github.com/mattn/go-isatty",
+ "revision": "ae0b1f8f8004be68d791a576e3d8e7648ab41449",
+ "revisionTime": "2015-04-09T09:42:43+09:00"
+ },
+ {
+ "canonical": "github.com/minio/cli",
+ "comment": "",
+ "local": "github.com/minio/cli",
+ "revision": "9280cbaadcdd26d50b5ae85123682e37944701de",
+ "revisionTime": "2015-07-24T23:32:06-07:00"
+ },
+ {
+ "canonical": "github.com/minio/minio-go",
+ "comment": "",
+ "local": "github.com/minio/minio-go",
+ "revision": "69b05646606fd39171e16d6bf4edc84bb77787e0",
+ "revisionTime": "2015-08-11T13:40:24-07:00"
+ },
+ {
+ "canonical": "github.com/minio/minio/pkg/probe",
+ "comment": "",
+ "local": "github.com/minio/minio/pkg/probe",
+ "revision": "b4c8b4877ea5e79b9c81c02be50ad4c4e112d53d",
+ "revisionTime": "2015-08-08T00:23:36-07:00"
+ },
+ {
+ "canonical": "github.com/minio/pb",
+ "comment": "",
+ "local": "github.com/minio/pb",
+ "revision": "6a97c3b0da073f974e0b8d1ac1bc42c0a7adca46",
+ "revisionTime": "2015-08-12T18:13:54-07:00"
+ },
+ {
+ "canonical": "github.com/olekukonko/ts",
+ "comment": "",
+ "local": "github.com/olekukonko/ts",
+ "revision": "ecf753e7c962639ab5a1fb46f7da627d4c0a04b8",
+ "revisionTime": "2014-04-12T15:01:45-07:00"
+ },
+ {
+ "canonical": "github.com/shiena/ansicolor",
+ "comment": "",
+ "local": "github.com/shiena/ansicolor",
+ "revision": "a5e2b567a4dd6cc74545b8a4f27c9d63b9e7735b",
+ "revisionTime": "2015-07-19T16:15:31+09:00"
+ },
+ {
+ "canonical": "github.com/tchap/go-patricia/patricia",
+ "comment": "",
+ "local": "github.com/tchap/go-patricia/patricia",
+ "revision": "a560f85131e8aafc2cc4bcb1e265ae3fc6ee5f50",
+ "revisionTime": "2015-06-11T09:53:39+02:00"
+ },
+ {
+ "canonical": "gopkg.in/check.v1",
+ "comment": "",
+ "local": "gopkg.in/check.v1",
+ "revision": "11d3bc7aa68e238947792f30573146a3231fc0f1",
+ "revisionTime": "2015-07-29T10:04:31+02:00"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ls-main.go b/ls-main.go
index a542f3a6..a6163562 100644
--- a/ls-main.go
+++ b/ls-main.go
@@ -17,8 +17,8 @@
package main
import (
- "github.com/minio/cli"
- "github.com/minio/minio/pkg/probe"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/ls.go b/ls.go
index 9ab2f819..bca04734 100644
--- a/ls.go
+++ b/ls.go
@@ -22,10 +22,10 @@ import (
"runtime"
"strings"
- "github.com/dustin/go-humanize"
+ "github.com/minio/mc/internal/github.com/dustin/go-humanize"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
/// ls - related internal functions
diff --git a/ls_test.go b/ls_test.go
index 94893228..c5e2c066 100644
--- a/ls_test.go
+++ b/ls_test.go
@@ -23,9 +23,9 @@ import (
"path/filepath"
"strconv"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
- . "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestLSCmd(c *C) {
diff --git a/main.go b/main.go
index 7d435899..cf464871 100644
--- a/main.go
+++ b/main.go
@@ -23,9 +23,9 @@ import (
"runtime"
"strconv"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/pb"
"github.com/minio/mc/pkg/console"
- "github.com/minio/pb"
)
// Check for the environment early on and gracefully report.
diff --git a/mb-main.go b/mb-main.go
index d71c5a7f..bde3e8cd 100644
--- a/mb-main.go
+++ b/mb-main.go
@@ -17,9 +17,9 @@
package main
import (
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/mb_access_test.go b/mb_access_test.go
index d651c64b..732b8eeb 100644
--- a/mb_access_test.go
+++ b/mb_access_test.go
@@ -21,8 +21,8 @@ import (
"os"
"path/filepath"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/console"
- . "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestMbAndAccessCmd(c *C) {
diff --git a/mirror-main.go b/mirror-main.go
index 960a8ed0..654ebd4c 100644
--- a/mirror-main.go
+++ b/mirror-main.go
@@ -26,9 +26,9 @@ import (
"runtime"
"sync"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/mirror-url.go b/mirror-url.go
index ad884304..d5628e34 100644
--- a/mirror-url.go
+++ b/mirror-url.go
@@ -21,11 +21,11 @@ import (
"strings"
"sync"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
+ "github.com/minio/mc/internal/github.com/tchap/go-patricia/patricia"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
- "github.com/tchap/go-patricia/patricia"
)
type mirrorURLs struct {
diff --git a/notifier.go b/notifier.go
index bfcd2896..220ad19e 100644
--- a/notifier.go
+++ b/notifier.go
@@ -22,8 +22,8 @@ import (
"runtime"
"strings"
- "github.com/fatih/color"
- "github.com/olekukonko/ts"
+ "github.com/minio/mc/internal/github.com/fatih/color"
+ "github.com/minio/mc/internal/github.com/olekukonko/ts"
)
// printUpdateNotify - inspired from Yeoman project npm package https://github.com/yeoman/update-notifier
diff --git a/pb.go b/pb.go
index 0c153a0b..a08dcf40 100644
--- a/pb.go
+++ b/pb.go
@@ -24,10 +24,10 @@ import (
"sync/atomic"
"time"
- "github.com/dustin/go-humanize"
+ "github.com/minio/mc/internal/github.com/dustin/go-humanize"
+ "github.com/minio/mc/internal/github.com/minio/pb"
+ "github.com/minio/mc/internal/github.com/olekukonko/ts"
"github.com/minio/mc/pkg/console"
- "github.com/minio/pb"
- "github.com/olekukonko/ts"
)
type pbBarCmd int
diff --git a/pkg/client/client.go b/pkg/client/client.go
index adc56938..b89c275b 100644
--- a/pkg/client/client.go
+++ b/pkg/client/client.go
@@ -21,7 +21,7 @@ import (
"os"
"time"
- "github.com/minio/minio/pkg/probe"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
)
// Client - client interface
diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go
index e468a0c5..907b6712 100644
--- a/pkg/client/client_test.go
+++ b/pkg/client/client_test.go
@@ -19,7 +19,7 @@ package client
import (
"testing"
- . "gopkg.in/check.v1"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
diff --git a/pkg/client/fs/fs.go b/pkg/client/fs/fs.go
index 82b38fe1..cc3c46cf 100644
--- a/pkg/client/fs/fs.go
+++ b/pkg/client/fs/fs.go
@@ -25,8 +25,8 @@ import (
"io/ioutil"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
- "github.com/minio/minio/pkg/probe"
)
type fsClient struct {
diff --git a/pkg/client/fs/fs_test.go b/pkg/client/fs/fs_test.go
index dcac0544..1951cb14 100644
--- a/pkg/client/fs/fs_test.go
+++ b/pkg/client/fs/fs_test.go
@@ -24,9 +24,9 @@ import (
"path/filepath"
"testing"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/client/fs"
- . "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
diff --git a/pkg/client/s3/s3.go b/pkg/client/s3/s3.go
index 2e66ce80..61b065a6 100644
--- a/pkg/client/s3/s3.go
+++ b/pkg/client/s3/s3.go
@@ -24,9 +24,9 @@ import (
"strings"
"time"
+ "github.com/minio/mc/internal/github.com/minio/minio-go"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
- "github.com/minio/minio-go"
- "github.com/minio/minio/pkg/probe"
)
// Config - see http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html
diff --git a/pkg/client/s3/s3_test.go b/pkg/client/s3/s3_test.go
index 957e445e..83ea4d48 100644
--- a/pkg/client/s3/s3_test.go
+++ b/pkg/client/s3/s3_test.go
@@ -26,7 +26,7 @@ import (
"testing"
"time"
- . "gopkg.in/check.v1"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
)
type bucketHandler struct {
diff --git a/pkg/console/console.go b/pkg/console/console.go
index bf5c4c79..40c2be96 100644
--- a/pkg/console/console.go
+++ b/pkg/console/console.go
@@ -23,10 +23,10 @@ import (
"path/filepath"
- "github.com/fatih/color"
- "github.com/mattn/go-isatty"
- "github.com/minio/minio/pkg/probe"
- "github.com/shiena/ansicolor"
+ "github.com/minio/mc/internal/github.com/fatih/color"
+ "github.com/minio/mc/internal/github.com/mattn/go-isatty"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
+ "github.com/minio/mc/internal/github.com/shiena/ansicolor"
)
// NoDebugPrint defines if the input should be printed in debug or not. By default it's set to true.
diff --git a/pkg/console/console_test.go b/pkg/console/console_test.go
index 50d71ede..3779a3c0 100644
--- a/pkg/console/console_test.go
+++ b/pkg/console/console_test.go
@@ -19,7 +19,7 @@ package console
import (
"testing"
- . "gopkg.in/check.v1"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
diff --git a/pkg/console/themes.go b/pkg/console/themes.go
index f2ff515f..4754f5cb 100644
--- a/pkg/console/themes.go
+++ b/pkg/console/themes.go
@@ -16,7 +16,7 @@
package console
-import "github.com/fatih/color"
+import "github.com/minio/mc/internal/github.com/fatih/color"
// MiniTheme - Minio's default color theme
var MiniTheme = Theme{
diff --git a/pkg/quick/quick.go b/pkg/quick/quick.go
index f0aaf2c3..6accf6d2 100644
--- a/pkg/quick/quick.go
+++ b/pkg/quick/quick.go
@@ -28,8 +28,8 @@ import (
"strings"
"sync"
- "github.com/fatih/structs"
- "github.com/minio/minio/pkg/probe"
+ "github.com/minio/mc/internal/github.com/fatih/structs"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
)
// Config - generic config interface functions
diff --git a/pkg/quick/quick_test.go b/pkg/quick/quick_test.go
index 3db3ee8f..99a560ab 100644
--- a/pkg/quick/quick_test.go
+++ b/pkg/quick/quick_test.go
@@ -22,8 +22,8 @@ import (
"os"
"testing"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/quick"
- . "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
diff --git a/session-main.go b/session-main.go
index 265c3307..47362bf0 100644
--- a/session-main.go
+++ b/session-main.go
@@ -21,9 +21,9 @@ import (
"sort"
"strings"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/session-v1.go b/session-v1.go
index 89b02a41..40bbd248 100644
--- a/session-v1.go
+++ b/session-v1.go
@@ -24,9 +24,9 @@ import (
"sync"
"time"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/quick"
- "github.com/minio/minio/pkg/probe"
)
type sessionV1 struct {
diff --git a/session-v2.go b/session-v2.go
index ec29ba21..21a3555c 100644
--- a/session-v2.go
+++ b/session-v2.go
@@ -24,9 +24,9 @@ import (
"sync"
"time"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/quick"
- "github.com/minio/minio/pkg/probe"
)
// migrateSessionV1ToV2 migrates all session files from v1 to v2.
diff --git a/session.go b/session.go
index a819db0b..c7330eba 100644
--- a/session.go
+++ b/session.go
@@ -23,8 +23,8 @@ import (
"strings"
"time"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
func migrateSession() {
diff --git a/session_test.go b/session_test.go
index 396a0cfc..cc82aa33 100644
--- a/session_test.go
+++ b/session_test.go
@@ -20,8 +20,8 @@ import (
"os"
"regexp"
+ . "github.com/minio/mc/internal/gopkg.in/check.v1"
"github.com/minio/mc/pkg/console"
- . "gopkg.in/check.v1"
)
func (s *CmdTestSuite) TestValidSessionID(c *C) {
diff --git a/share-main.go b/share-main.go
index 3e53c1c0..245a4bf3 100644
--- a/share-main.go
+++ b/share-main.go
@@ -22,10 +22,10 @@ import (
"strings"
"time"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// Help message.
diff --git a/typed-errors.go b/typed-errors.go
index 69c85033..6e2a3365 100644
--- a/typed-errors.go
+++ b/typed-errors.go
@@ -38,12 +38,6 @@ func (e errInvalidACL) Error() string {
return "Invalid ACL Type ‘" + e.acl + "’. Valid types are [private, public, readonly]."
}
-type errNotConfigured struct{}
-
-func (e errNotConfigured) Error() string {
- return "‘mc’ not configured."
-}
-
type errNotAnObject struct {
url string
}
@@ -58,15 +52,6 @@ func (e errInvalidArgument) Error() string {
return "Incorrect usage, please use \"mc config help\""
}
-type errUnsupportedScheme struct {
- scheme string
- url string
-}
-
-func (e errUnsupportedScheme) Error() string {
- return "Unsuppported URL scheme: " + e.scheme + " URL: ‘" + e.url + "’"
-}
-
type errInvalidGlobURL struct {
glob string
request string
@@ -151,12 +136,6 @@ func (e errTargetIsNotDir) Error() string {
return "Target ‘" + e.URL + "’ is not a folder."
}
-type errTargetNotFound errInvalidURL
-
-func (e errTargetNotFound) Error() string {
- return "Target folder ‘" + e.URL + "’ does not exist."
-}
-
type errSourceNotRecursive errInvalidURL
func (e errSourceNotRecursive) Error() string {
diff --git a/update-main.go b/update-main.go
index 2dfc8e48..c7ce9a33 100644
--- a/update-main.go
+++ b/update-main.go
@@ -22,9 +22,9 @@ import (
"runtime"
"time"
- "github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/cli"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/console"
- "github.com/minio/minio/pkg/probe"
)
// Updates container to hold updates json
diff --git a/url.go b/url.go
index b5ab416e..8f05f6e4 100644
--- a/url.go
+++ b/url.go
@@ -19,8 +19,8 @@ package main
import (
"strings"
+ "github.com/minio/mc/internal/github.com/minio/minio/pkg/probe"
"github.com/minio/mc/pkg/client"
- "github.com/minio/minio/pkg/probe"
)
// ``...`` recursiveSeparator