cp/diff/mirror: Cleanup code and deprecate unnecessary flags. (#1914)

This fix also fixes an apparent crash found in diff.

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4bdc07]

goroutine 84 [running]:
panic(0x810ea0, 0xc4200120e0)
        /home/builder/.gimme/versions/go1.7.3.linux.amd64/src/runtime/panic.go:500 +0x1a1
github.com/minio/mc/cmd.objectDifference.func1(0xc4200880a8, 0xc42042ee56, 0xc420315ec0, 0xc4200880b0, 0xc42042ee57, 0xc420315f20, 0xc42042ee54, 0xc42042ee55, 0xc420315501, 0xc4200880a0, ...)
        /home/builder/mygo/src/github.com/minio/mc/cmd/difference.go:109 +0x197
created by github.com/minio/mc/cmd.objectDifference
        /home/builder/mygo/src/github.com/minio/mc/cmd/difference.go:180 +0x2f5
```
This commit is contained in:
Harshavardhana
2016-12-06 01:41:22 -08:00
committed by GitHub
parent b8e732e526
commit 64166319ee
7 changed files with 48 additions and 113 deletions
+1 -3
View File
@@ -170,10 +170,8 @@ func doDiffMain(firstURL, secondURL string) error {
fmt.Sprintf("Failed to diff '%s' and '%s'", firstURL, secondURL))
}
watchMode := false
// Diff first and second urls.
for diffMsg := range objectDifference(firstClient, secondClient, firstURL, secondURL, watchMode) {
for diffMsg := range objectDifference(firstClient, secondClient, firstURL, secondURL) {
printMsg(diffMsg)
}