Run go fmt -w -s

This commit is contained in:
Audrius Butkevicius 2014-09-28 12:05:43 +01:00
parent 26e4669316
commit 5ec95086f2
3 changed files with 51 additions and 51 deletions

View File

@ -369,11 +369,11 @@ func TestLocalDeleted(t *testing.T) {
lamport.Default = lamport.Clock{}
local1 := []protocol.FileInfo{
protocol.FileInfo{Name: "a", Version: 1000},
protocol.FileInfo{Name: "b", Version: 1000},
protocol.FileInfo{Name: "c", Version: 1000},
protocol.FileInfo{Name: "d", Version: 1000},
protocol.FileInfo{Name: "z", Version: 1000, Flags: protocol.FlagDirectory},
{Name: "a", Version: 1000},
{Name: "b", Version: 1000},
{Name: "c", Version: 1000},
{Name: "d", Version: 1000},
{Name: "z", Version: 1000, Flags: protocol.FlagDirectory},
}
m.ReplaceWithDelete(protocol.LocalDeviceID, local1)
@ -399,10 +399,10 @@ func TestLocalDeleted(t *testing.T) {
expectedGlobal1 := []protocol.FileInfo{
local1[0],
protocol.FileInfo{Name: "b", Version: 1001, Flags: protocol.FlagDeleted},
{Name: "b", Version: 1001, Flags: protocol.FlagDeleted},
local1[2],
protocol.FileInfo{Name: "d", Version: 1002, Flags: protocol.FlagDeleted},
protocol.FileInfo{Name: "z", Version: 1003, Flags: protocol.FlagDeleted | protocol.FlagDirectory},
{Name: "d", Version: 1002, Flags: protocol.FlagDeleted},
{Name: "z", Version: 1003, Flags: protocol.FlagDeleted | protocol.FlagDirectory},
}
g := globalList(m)
@ -420,10 +420,10 @@ func TestLocalDeleted(t *testing.T) {
expectedGlobal2 := []protocol.FileInfo{
local1[0],
protocol.FileInfo{Name: "b", Version: 1001, Flags: protocol.FlagDeleted},
protocol.FileInfo{Name: "c", Version: 1004, Flags: protocol.FlagDeleted},
protocol.FileInfo{Name: "d", Version: 1002, Flags: protocol.FlagDeleted},
protocol.FileInfo{Name: "z", Version: 1003, Flags: protocol.FlagDeleted | protocol.FlagDirectory},
{Name: "b", Version: 1001, Flags: protocol.FlagDeleted},
{Name: "c", Version: 1004, Flags: protocol.FlagDeleted},
{Name: "d", Version: 1002, Flags: protocol.FlagDeleted},
{Name: "z", Version: 1003, Flags: protocol.FlagDeleted | protocol.FlagDirectory},
}
g = globalList(m)
@ -619,17 +619,17 @@ func TestGlobalReset(t *testing.T) {
m := files.NewSet("test", db)
local := []protocol.FileInfo{
protocol.FileInfo{Name: "a", Version: 1000},
protocol.FileInfo{Name: "b", Version: 1000},
protocol.FileInfo{Name: "c", Version: 1000},
protocol.FileInfo{Name: "d", Version: 1000},
{Name: "a", Version: 1000},
{Name: "b", Version: 1000},
{Name: "c", Version: 1000},
{Name: "d", Version: 1000},
}
remote := []protocol.FileInfo{
protocol.FileInfo{Name: "a", Version: 1000},
protocol.FileInfo{Name: "b", Version: 1001},
protocol.FileInfo{Name: "c", Version: 1002},
protocol.FileInfo{Name: "e", Version: 1000},
{Name: "a", Version: 1000},
{Name: "b", Version: 1001},
{Name: "c", Version: 1002},
{Name: "e", Version: 1000},
}
m.ReplaceWithDelete(protocol.LocalDeviceID, local)
@ -660,23 +660,23 @@ func TestNeed(t *testing.T) {
m := files.NewSet("test", db)
local := []protocol.FileInfo{
protocol.FileInfo{Name: "a", Version: 1000},
protocol.FileInfo{Name: "b", Version: 1000},
protocol.FileInfo{Name: "c", Version: 1000},
protocol.FileInfo{Name: "d", Version: 1000},
{Name: "a", Version: 1000},
{Name: "b", Version: 1000},
{Name: "c", Version: 1000},
{Name: "d", Version: 1000},
}
remote := []protocol.FileInfo{
protocol.FileInfo{Name: "a", Version: 1000},
protocol.FileInfo{Name: "b", Version: 1001},
protocol.FileInfo{Name: "c", Version: 1002},
protocol.FileInfo{Name: "e", Version: 1000},
{Name: "a", Version: 1000},
{Name: "b", Version: 1001},
{Name: "c", Version: 1002},
{Name: "e", Version: 1000},
}
shouldNeed := []protocol.FileInfo{
protocol.FileInfo{Name: "b", Version: 1001},
protocol.FileInfo{Name: "c", Version: 1002},
protocol.FileInfo{Name: "e", Version: 1000},
{Name: "b", Version: 1001},
{Name: "c", Version: 1002},
{Name: "e", Version: 1000},
}
m.ReplaceWithDelete(protocol.LocalDeviceID, local)
@ -701,18 +701,18 @@ func TestLocalVersion(t *testing.T) {
m := files.NewSet("test", db)
local1 := []protocol.FileInfo{
protocol.FileInfo{Name: "a", Version: 1000},
protocol.FileInfo{Name: "b", Version: 1000},
protocol.FileInfo{Name: "c", Version: 1000},
protocol.FileInfo{Name: "d", Version: 1000},
{Name: "a", Version: 1000},
{Name: "b", Version: 1000},
{Name: "c", Version: 1000},
{Name: "d", Version: 1000},
}
local2 := []protocol.FileInfo{
local1[0],
// [1] deleted
local1[2],
protocol.FileInfo{Name: "d", Version: 1002},
protocol.FileInfo{Name: "e", Version: 1000},
{Name: "d", Version: 1002},
{Name: "e", Version: 1000},
}
m.ReplaceWithDelete(protocol.LocalDeviceID, local1)
@ -739,17 +739,17 @@ func TestListDropFolder(t *testing.T) {
s0 := files.NewSet("test0", db)
local1 := []protocol.FileInfo{
protocol.FileInfo{Name: "a", Version: 1000},
protocol.FileInfo{Name: "b", Version: 1000},
protocol.FileInfo{Name: "c", Version: 1000},
{Name: "a", Version: 1000},
{Name: "b", Version: 1000},
{Name: "c", Version: 1000},
}
s0.Replace(protocol.LocalDeviceID, local1)
s1 := files.NewSet("test1", db)
local2 := []protocol.FileInfo{
protocol.FileInfo{Name: "d", Version: 1002},
protocol.FileInfo{Name: "e", Version: 1002},
protocol.FileInfo{Name: "f", Version: 1002},
{Name: "d", Version: 1002},
{Name: "e", Version: 1002},
{Name: "f", Version: 1002},
}
s1.Replace(remoteDevice0, local2)
@ -837,7 +837,7 @@ func TestLongPath(t *testing.T) {
name := b.String() // 5000 characters
local := []protocol.FileInfo{
protocol.FileInfo{Name: string(name), Version: 1000},
{Name: string(name), Version: 1000},
}
s.ReplaceWithDelete(protocol.LocalDeviceID, local)

View File

@ -25,19 +25,19 @@ func init() {
}
var testDataExpected = map[string]protocol.FileInfo{
"foo": protocol.FileInfo{
"foo": {
Name: "foo",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0x7, Hash: []uint8{0xae, 0xc0, 0x70, 0x64, 0x5f, 0xe5, 0x3e, 0xe3, 0xb3, 0x76, 0x30, 0x59, 0x37, 0x61, 0x34, 0xf0, 0x58, 0xcc, 0x33, 0x72, 0x47, 0xc9, 0x78, 0xad, 0xd1, 0x78, 0xb6, 0xcc, 0xdf, 0xb0, 0x1, 0x9f}}},
},
"empty": protocol.FileInfo{
"empty": {
Name: "empty",
Flags: 0,
Modified: 0,
Blocks: []protocol.BlockInfo{{Offset: 0x0, Size: 0x0, Hash: []uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}}},
},
"bar": protocol.FileInfo{
"bar": {
Name: "bar",
Flags: 0,
Modified: 0,

View File

@ -113,10 +113,10 @@ func NewStaggered(folderID, folderPath string, params map[string]string) Version
cleanInterval: cleanInterval,
folderPath: folderPath,
interval: [4]Interval{
Interval{30, 3600}, // first hour -> 30 sec between versions
Interval{3600, 86400}, // next day -> 1 h between versions
Interval{86400, 592000}, // next 30 days -> 1 day between versions
Interval{604800, maxAge * 86400}, // next year -> 1 week between versions
{30, 3600}, // first hour -> 30 sec between versions
{3600, 86400}, // next day -> 1 h between versions
{86400, 592000}, // next 30 days -> 1 day between versions
{604800, maxAge * 86400}, // next year -> 1 week between versions
},
mutex: &mutex,
}