I'm assuming that I'm not understanding something so please correct me.
I thought the example for the gosync application in the readme is a basic example of how you would sync 2 files..is that correct ?
gosync build filenameToPatchTo
gosync patch filenameToPatchFrom filenameToPatchTo.gosync
Steps to reproduce:
$ mkdir -p /tmp/foo
$ mkdir -p /tmp/foo1
$ dd if=/dev/urandom of=/tmp/foo/blah.txt count=10240 bs=10240
$ cd /tmp/foo1
$ gosync build blah.txt
$ gosync patch /tmp/foo/blah.txt /tmp/foo1/blah.gosync
Results:
am@seattle2:/tmp/foo1$ gosync patch /tmp/foo/blah.txt /tmp/foo1/blah.gosync
panic: runtime error: index out of range
goroutine 1 [running]:
main.Patch(0xc2080b20c0)
/home/am/go/src/github.com/Redundancy/go-sync/gosync/patch.go:63 +0x1734
github.com/codegangsta/cli.Command.Run(0x796f70, 0x5, 0x796cf0, 0x1, 0x8204b0, 0x48, 0x847390, 0x1a8, 0x0, 0x0, ...)
/home/am/go/src/github.com/codegangsta/cli/command.go:113 +0x1038
github.com/codegangsta/cli.(*App).Run(0xc2080368f0, 0xc20800a000, 0x4, 0x4, 0x0, 0x0)
/home/am/go/src/github.com/codegangsta/cli/app.go:156 +0xcf7
main.main()
/home/am/go/src/github.com/Redundancy/go-sync/gosync/main.go:53 +0x278
Expected Results:
I wasn't sure exactly what it did but I was presuming the files would be identical or they would have a different checksum or gosync diff would produce different outputs.
I was hoping to use this as a library to compare the differences between two files and possibly create a patch which I could then apply to the older file to make them identical. Would this be the sort of use case for your library ?
Would the functionality in go diff be adequate for this ?
am@seattle2:/tmp/foo1$ gosync diff /tmp/foo/blah.txt blah.gosync
Blocksize: 8192
Weak hash count: 0
Using 4 cores
Matched:
Comparisons: 104865796
Weak hash hits: 0
Weak hit rate: 0
Strong hash hits: 0
Weak hash error rate: NaN
Total matched bytes: 0
Total matched blocks: 0
Index blocks: 0
Total missing bytes: 0
Time taken: 4.862401859s
- Can you explain what the weak hash count is ?
- Why is the missing bytes 0 if foo1/blah.txt is 0 bytes ?
System:
(Ubuntu 14.04 ) (go version go1.4.1 linux/amd64)