Run 'gofmt -s -w' on these files
rht committed
May 19, 2015 at 00:42 UTC
ac7edddb94a70f5f76e23d87c3da085eb97cf34a
23 files changed
+149
-149
cmd/ipfs/ipfs.go
+10
-10
@@ -97,17 +97,17 @@ func (d *cmdDetails) usesRepo() bool { return !d.doesNotUseRepo
97
// properties so that other code can make decisions about whether to invoke a
98
// command or return an error to the user.
99
var cmdDetailsMap = map[*cmds.Command]cmdDetails{
100
- initCmd: cmdDetails{doesNotUseConfigAsInput: true, cannotRunOnDaemon: true, doesNotUseRepo: true},
100
+ initCmd: {doesNotUseConfigAsInput: true, cannotRunOnDaemon: true, doesNotUseRepo: true},
101
102
// daemonCmd allows user to initialize the config. Thus, it may be called
103
// without using the config as input
104
- daemonCmd: cmdDetails{doesNotUseConfigAsInput: true, cannotRunOnDaemon: true},
105
- commandsClientCmd: cmdDetails{doesNotUseRepo: true},
106
- commands.CommandsDaemonCmd: cmdDetails{doesNotUseRepo: true},
107
- commands.DiagCmd: cmdDetails{cannotRunOnClient: true},
108
- commands.VersionCmd: cmdDetails{doesNotUseConfigAsInput: true, doesNotUseRepo: true}, // must be permitted to run before init
109
- commands.UpdateCmd: cmdDetails{preemptsAutoUpdate: true, cannotRunOnDaemon: true},
110
- commands.UpdateCheckCmd: cmdDetails{preemptsAutoUpdate: true},
111
- commands.UpdateLogCmd: cmdDetails{preemptsAutoUpdate: true},
112
- commands.LogCmd: cmdDetails{cannotRunOnClient: true},
104
+ daemonCmd: {doesNotUseConfigAsInput: true, cannotRunOnDaemon: true},
105
+ commandsClientCmd: {doesNotUseRepo: true},
106
+ commands.CommandsDaemonCmd: {doesNotUseRepo: true},
107
+ commands.DiagCmd: {cannotRunOnClient: true},
108
+ commands.VersionCmd: {doesNotUseConfigAsInput: true, doesNotUseRepo: true}, // must be permitted to run before init
109
+ commands.UpdateCmd: {preemptsAutoUpdate: true, cannotRunOnDaemon: true},
110
+ commands.UpdateCheckCmd: {preemptsAutoUpdate: true},
111
+ commands.UpdateLogCmd: {preemptsAutoUpdate: true},
112
+ commands.LogCmd: {cannotRunOnClient: true},
113
}
commands/cli/parse_test.go
+10
-10
@@ -1,11 +1,11 @@
1
package cli
2
3
import (
4
- "strings"
5
- "testing"
4
"io"
5
"io/ioutil"
6
"os"
7
+ "strings"
8
+ "testing"
9
10
"github.com/ipfs/go-ipfs/commands"
11
)
@@ -122,35 +122,35 @@ func TestOptionParsing(t *testing.T) {
122
func TestArgumentParsing(t *testing.T) {
123
rootCmd := &commands.Command{
124
Subcommands: map[string]*commands.Command{
125
- "noarg": &commands.Command{},
126
- "onearg": &commands.Command{
125
+ "noarg": {},
126
+ "onearg": {
127
Arguments: []commands.Argument{
128
commands.StringArg("a", true, false, "some arg"),
129
},
130
},
131
- "twoargs": &commands.Command{
131
+ "twoargs": {
132
Arguments: []commands.Argument{
133
commands.StringArg("a", true, false, "some arg"),
134
commands.StringArg("b", true, false, "another arg"),
135
},
136
},
137
- "variadic": &commands.Command{
137
+ "variadic": {
138
Arguments: []commands.Argument{
139
commands.StringArg("a", true, true, "some arg"),
140
},
141
},
142
- "optional": &commands.Command{
142
+ "optional": {
143
Arguments: []commands.Argument{
144
commands.StringArg("b", false, true, "another arg"),
145
},
146
},
147
- "reversedoptional": &commands.Command{
147
+ "reversedoptional": {
148
Arguments: []commands.Argument{
149
commands.StringArg("a", false, false, "some arg"),
150
commands.StringArg("b", true, false, "another arg"),
151
},
152
},
153
- "stdinenabled": &commands.Command{
153
+ "stdinenabled": {
154
Arguments: []commands.Argument{
155
commands.StringArg("a", true, true, "some arg").EnableStdin(),
156
},
@@ -204,7 +204,7 @@ func TestArgumentParsing(t *testing.T) {
204
testFail([]string{"reversedoptional", "value1", "value2", "value3"}, "provided too many args, only takes 1")
205
206
// Use a temp file to simulate stdin
207
- fileToSimulateStdin := func(t *testing.T, content string) (*os.File) {
207
+ fileToSimulateStdin := func(t *testing.T, content string) *os.File {
208
fstdin, err := ioutil.TempFile("", "")
209
if err != nil {
210
t.Fatal(err)
core/commands/diag_test.go
+3
-3
@@ -8,15 +8,15 @@ import (
8
func TestPrintDiagnostics(t *testing.T) {
9
output := DiagnosticOutput{
10
Peers: []DiagnosticPeer{
11
- DiagnosticPeer{ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg",
11
+ {ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg",
12
UptimeSeconds: 14,
13
Connections: []DiagnosticConnection{
14
- DiagnosticConnection{ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg",
14
+ {ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg",
15
NanosecondsLatency: 1347899,
16
},
17
},
18
},
19
- DiagnosticPeer{ID: "QmUaUZDp6QWJabBYSKfiNmXLAXD8HNKnWZh9Zoz6Zri9Ti",
19
+ {ID: "QmUaUZDp6QWJabBYSKfiNmXLAXD8HNKnWZh9Zoz6Zri9Ti",
20
UptimeSeconds: 14,
21
},
22
},
core/core_test.go
+4
-4
@@ -14,7 +14,7 @@ func TestInitialization(t *testing.T) {
14
id := testIdentity
15
16
good := []*config.Config{
17
- &config.Config{
17
+ {
18
Identity: id,
19
Datastore: config.Datastore{
20
Type: "memory",
@@ -25,7 +25,7 @@ func TestInitialization(t *testing.T) {
25
},
26
},
27
28
- &config.Config{
28
+ {
29
Identity: id,
30
Datastore: config.Datastore{
31
Type: "leveldb",
@@ -39,8 +39,8 @@ func TestInitialization(t *testing.T) {
39
}
40
41
bad := []*config.Config{
42
- &config.Config{},
43
- &config.Config{Datastore: config.Datastore{Type: "memory"}},
42
+ {},
43
+ {Datastore: config.Datastore{Type: "memory"}},
44
}
45
46
for i, c := range good {
diagnostics/diag.go
+1
-1
@@ -179,7 +179,7 @@ func decodeDiagJson(data []byte) (*DiagInfo, error) {
179
func (d *Diagnostics) getDiagnosticFromPeers(ctx context.Context, peers map[peer.ID]int, pmes *pb.Message) (<-chan *DiagInfo, error) {
180
respdata := make(chan *DiagInfo)
181
wg := sync.WaitGroup{}
182
- for p, _ := range peers {
182
+ for p := range peers {
183
wg.Add(1)
184
log.Debugf("Sending diagnostic request to peer: %s", p)
185
go func(p peer.ID) {
diagnostics/vis.go
+1
-1
@@ -35,7 +35,7 @@ func GetGraphJson(dinfo []*DiagInfo) []byte {
35
36
var links []*link
37
linkexists := make([][]bool, len(nodes))
38
- for i, _ := range linkexists {
38
+ for i := range linkexists {
39
linkexists[i] = make([]bool, len(nodes))
40
}
41
exchange/bitswap/decision/engine_test.go
+2
-2
@@ -128,10 +128,10 @@ func TestPartnerWantsThenCancels(t *testing.T) {
128
129
type testCase [][]string
130
testcases := []testCase{
131
- testCase{
131
+ {
132
alphabet, vowels,
133
},
134
- testCase{
134
+ {
135
alphabet, stringsComplement(alphabet, vowels),
136
},
137
}
exchange/bitswap/message/message_test.go
+1
-1
@@ -27,7 +27,7 @@ func TestNewMessageFromProto(t *testing.T) {
27
protoMessage := new(pb.Message)
28
protoMessage.Wantlist = new(pb.Message_Wantlist)
29
protoMessage.Wantlist.Entries = []*pb.Message_Wantlist_Entry{
30
- &pb.Message_Wantlist_Entry{Block: proto.String(str)},
30
+ {Block: proto.String(str)},
31
}
32
if !wantlistContains(protoMessage.Wantlist, str) {
33
t.Fail()
fuse/ipns/ipns_unix.go
+1
-1
@@ -183,7 +183,7 @@ func (r *Root) Forget() {
183
func (r *Root) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
184
log.Debug("Root ReadDirAll")
185
listing := []fuse.Dirent{
186
- fuse.Dirent{
186
+ {
187
Name: "local",
188
Type: fuse.DT_Link,
189
},
merkledag/merkledag.go
+1
-1
@@ -181,7 +181,7 @@ func (ds *dagService) GetNodes(ctx context.Context, keys []u.Key) []NodeGetter {
181
182
promises := make([]NodeGetter, len(keys))
183
sendChans := make([]chan<- *Node, len(keys))
184
- for i, _ := range keys {
184
+ for i := range keys {
185
promises[i], sendChans[i] = newNodePromise(ctx)
186
}
187
merkledag/merkledag_test.go
+1
-1
@@ -132,7 +132,7 @@ func SubtestNodeStat(t *testing.T, n *Node) {
132
type devZero struct{}
133
134
func (_ devZero) Read(b []byte) (int, error) {
135
- for i, _ := range b {
135
+ for i := range b {
136
b[i] = 0
137
}
138
return len(b), nil
p2p/net/mock/mock_notif_test.go
+1
-1
@@ -109,7 +109,7 @@ func TestNotifications(t *testing.T) {
109
110
// there's one stream per conn that we need to drain....
111
// unsure where these are coming from
112
- for i, _ := range nets {
112
+ for i := range nets {
113
n := notifiees[i]
114
testOCStream(n, nil)
115
testOCStream(n, nil)
routing/dht/dht_test.go
+3
-3
@@ -215,7 +215,7 @@ func TestProvides(t *testing.T) {
215
}
216
}
217
218
- for k, _ := range testCaseValues {
218
+ for k := range testCaseValues {
219
log.Debugf("announcing provider for %s", k)
220
if err := dhts[3].Provide(ctx, k); err != nil {
221
t.Fatal(err)
@@ -226,7 +226,7 @@ func TestProvides(t *testing.T) {
226
time.Sleep(time.Millisecond * 6)
227
228
n := 0
229
- for k, _ := range testCaseValues {
229
+ for k := range testCaseValues {
230
n = (n + 1) % 3
231
232
log.Debugf("getting providers for %s from %d", k, n)
@@ -521,7 +521,7 @@ func TestProvidesMany(t *testing.T) {
521
}
522
}
523
524
- for k, _ := range testCaseValues {
524
+ for k := range testCaseValues {
525
// everyone should be able to find it...
526
for _, dht := range dhts {
527
log.Debugf("getting providers for %s at %s", k, dht.self)
routing/dht/providers.go
+1
-1
@@ -77,7 +77,7 @@ func (pm *ProviderManager) run() {
77
78
case lc := <-pm.getlocal:
79
var keys []u.Key
80
- for k, _ := range pm.local {
80
+ for k := range pm.local {
81
keys = append(keys, k)
82
}
83
lc <- keys
routing/keyspace/xor_test.go
+15
-15
@@ -10,9 +10,9 @@ import (
10
11
func TestPrefixLen(t *testing.T) {
12
cases := [][]byte{
13
- []byte{0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00},
14
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
15
- []byte{0x00, 0x58, 0xFF, 0x80, 0x00, 0x00, 0xF0},
13
+ {0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00},
14
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
15
+ {0x00, 0x58, 0xFF, 0x80, 0x00, 0x00, 0xF0},
16
}
17
lens := []int{24, 56, 9}
18
@@ -28,15 +28,15 @@ func TestPrefixLen(t *testing.T) {
28
func TestXorKeySpace(t *testing.T) {
29
30
ids := [][]byte{
31
- []byte{0xFF, 0xFF, 0xFF, 0xFF},
32
- []byte{0x00, 0x00, 0x00, 0x00},
33
- []byte{0xFF, 0xFF, 0xFF, 0xF0},
31
+ {0xFF, 0xFF, 0xFF, 0xFF},
32
+ {0x00, 0x00, 0x00, 0x00},
33
+ {0xFF, 0xFF, 0xFF, 0xF0},
34
}
35
36
ks := [][2]Key{
37
- [2]Key{XORKeySpace.Key(ids[0]), XORKeySpace.Key(ids[0])},
38
- [2]Key{XORKeySpace.Key(ids[1]), XORKeySpace.Key(ids[1])},
39
- [2]Key{XORKeySpace.Key(ids[2]), XORKeySpace.Key(ids[2])},
37
+ {XORKeySpace.Key(ids[0]), XORKeySpace.Key(ids[0])},
38
+ {XORKeySpace.Key(ids[1]), XORKeySpace.Key(ids[1])},
39
+ {XORKeySpace.Key(ids[2]), XORKeySpace.Key(ids[2])},
40
}
41
42
for i, set := range ks {
@@ -75,12 +75,12 @@ func TestXorKeySpace(t *testing.T) {
75
func TestDistancesAndCenterSorting(t *testing.T) {
76
77
adjs := [][]byte{
78
- []byte{173, 149, 19, 27, 192, 183, 153, 192, 177, 175, 71, 127, 177, 79, 207, 38, 166, 169, 247, 96, 121, 228, 139, 240, 144, 172, 183, 232, 54, 123, 253, 14},
79
- []byte{223, 63, 97, 152, 4, 169, 47, 219, 64, 87, 25, 45, 196, 61, 215, 72, 234, 119, 138, 220, 82, 188, 73, 140, 232, 5, 36, 192, 20, 184, 17, 25},
80
- []byte{73, 176, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 127},
81
- []byte{73, 176, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 127},
82
- []byte{73, 176, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 126},
83
- []byte{73, 0, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 127},
78
+ {173, 149, 19, 27, 192, 183, 153, 192, 177, 175, 71, 127, 177, 79, 207, 38, 166, 169, 247, 96, 121, 228, 139, 240, 144, 172, 183, 232, 54, 123, 253, 14},
79
+ {223, 63, 97, 152, 4, 169, 47, 219, 64, 87, 25, 45, 196, 61, 215, 72, 234, 119, 138, 220, 82, 188, 73, 140, 232, 5, 36, 192, 20, 184, 17, 25},
80
+ {73, 176, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 127},
81
+ {73, 176, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 127},
82
+ {73, 176, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 126},
83
+ {73, 0, 221, 176, 149, 143, 22, 42, 129, 124, 213, 114, 232, 95, 189, 154, 18, 3, 122, 132, 32, 199, 53, 185, 58, 157, 117, 78, 52, 146, 157, 127},
84
}
85
86
keys := make([]Key, len(adjs))
routing/supernode/client.go
+1
-1
@@ -86,7 +86,7 @@ func (c *Client) Provide(ctx context.Context, k u.Key) error {
86
msg := pb.NewMessage(pb.Message_ADD_PROVIDER, string(k), 0)
87
// FIXME how is connectedness defined for the local node
88
pri := []pb.PeerRoutingInfo{
89
- pb.PeerRoutingInfo{
89
+ {
90
PeerInfo: peer.PeerInfo{
91
ID: c.local,
92
Addrs: c.peerhost.Addrs(),
routing/supernode/server.go
+1
-1
@@ -73,7 +73,7 @@ func (s *Server) handleMessage(
73
case dhtpb.Message_FIND_NODE:
74
p := s.peerstore.PeerInfo(peer.ID(req.GetKey()))
75
pri := []dhtpb.PeerRoutingInfo{
76
- dhtpb.PeerRoutingInfo{
76
+ {
77
PeerInfo: p,
78
// Connectedness: TODO
79
},
thirdparty/pq/container_test.go
+5
-5
@@ -41,11 +41,11 @@ func TestQueuesReturnTypeIsSameAsParameterToPush(t *testing.T) {
41
func TestCorrectnessOfPop(t *testing.T) {
42
q := New(PriorityComparator)
43
tasks := []TestElem{
44
- TestElem{Key: "a", Priority: 9},
45
- TestElem{Key: "b", Priority: 4},
46
- TestElem{Key: "c", Priority: 3},
47
- TestElem{Key: "d", Priority: 0},
48
- TestElem{Key: "e", Priority: 6},
44
+ {Key: "a", Priority: 9},
45
+ {Key: "b", Priority: 4},
46
+ {Key: "c", Priority: 3},
47
+ {Key: "d", Priority: 0},
48
+ {Key: "e", Priority: 6},
49
}
50
for _, e := range tasks {
51
q.Push(&e)
tour/all.go
+72
-72
@@ -43,85 +43,85 @@ var (
43
44
// Topics contains a mapping of Tour Topic ID to Topic
45
var allTopics = []Topic{
46
- Topic{ID: Introduction(0), Content: IntroHelloMars},
47
- Topic{ID: Introduction(1), Content: IntroTour},
48
- Topic{ID: Introduction(2), Content: IntroAboutIpfs},
49
-
50
- Topic{ID: FileBasics(1), Content: FileBasicsFilesystem},
51
- Topic{ID: FileBasics(2), Content: FileBasicsGetting},
52
- Topic{ID: FileBasics(3), Content: FileBasicsAdding},
53
- Topic{ID: FileBasics(4), Content: FileBasicsDirectories},
54
- Topic{ID: FileBasics(5), Content: FileBasicsDistributed},
55
- Topic{ID: FileBasics(6), Content: FileBasicsMounting},
56
-
57
- Topic{NodeBasics(0), NodeBasicsInit},
58
- Topic{NodeBasics(1), NodeBasicsHelp},
59
- Topic{NodeBasics(2), NodeBasicsUpdate},
60
- Topic{NodeBasics(3), NodeBasicsConfig},
61
-
62
- Topic{MerkleDag(0), MerkleDagIntro},
63
- Topic{MerkleDag(1), MerkleDagContentAddressing},
64
- Topic{MerkleDag(2), MerkleDagContentAddressingLinks},
65
- Topic{MerkleDag(3), MerkleDagRedux},
66
- Topic{MerkleDag(4), MerkleDagIpfsObjects},
67
- Topic{MerkleDag(5), MerkleDagIpfsPaths},
68
- Topic{MerkleDag(6), MerkleDagImmutability},
69
- Topic{MerkleDag(7), MerkleDagUseCaseUnixFS},
70
- Topic{MerkleDag(8), MerkleDagUseCaseGitObjects},
71
- Topic{MerkleDag(9), MerkleDagUseCaseOperationalTransforms},
72
-
73
- Topic{Network(0), Network_Intro},
74
- Topic{Network(1), Network_Ipfs_Peers},
75
- Topic{Network(2), Network_Daemon},
76
- Topic{Network(3), Network_Routing},
77
- Topic{Network(4), Network_Exchange},
78
- Topic{Network(5), Network_Intro},
46
+ {ID: Introduction(0), Content: IntroHelloMars},
47
+ {ID: Introduction(1), Content: IntroTour},
48
+ {ID: Introduction(2), Content: IntroAboutIpfs},
49
+
50
+ {ID: FileBasics(1), Content: FileBasicsFilesystem},
51
+ {ID: FileBasics(2), Content: FileBasicsGetting},
52
+ {ID: FileBasics(3), Content: FileBasicsAdding},
53
+ {ID: FileBasics(4), Content: FileBasicsDirectories},
54
+ {ID: FileBasics(5), Content: FileBasicsDistributed},
55
+ {ID: FileBasics(6), Content: FileBasicsMounting},
56
+
57
+ {NodeBasics(0), NodeBasicsInit},
58
+ {NodeBasics(1), NodeBasicsHelp},
59
+ {NodeBasics(2), NodeBasicsUpdate},
60
+ {NodeBasics(3), NodeBasicsConfig},
61
+
62
+ {MerkleDag(0), MerkleDagIntro},
63
+ {MerkleDag(1), MerkleDagContentAddressing},
64
+ {MerkleDag(2), MerkleDagContentAddressingLinks},
65
+ {MerkleDag(3), MerkleDagRedux},
66
+ {MerkleDag(4), MerkleDagIpfsObjects},
67
+ {MerkleDag(5), MerkleDagIpfsPaths},
68
+ {MerkleDag(6), MerkleDagImmutability},
69
+ {MerkleDag(7), MerkleDagUseCaseUnixFS},
70
+ {MerkleDag(8), MerkleDagUseCaseGitObjects},
71
+ {MerkleDag(9), MerkleDagUseCaseOperationalTransforms},
72
+
73
+ {Network(0), Network_Intro},
74
+ {Network(1), Network_Ipfs_Peers},
75
+ {Network(2), Network_Daemon},
76
+ {Network(3), Network_Routing},
77
+ {Network(4), Network_Exchange},
78
+ {Network(5), Network_Intro},
79
80
// TODO daemon - {API, API Clients, Example} how old-school http + ftp
81
// clients show it
82
- Topic{Daemon(0), Daemon_Intro},
83
- Topic{Daemon(1), Daemon_Running_Commands},
84
- Topic{Daemon(2), Daemon_Web_UI},
82
+ {Daemon(0), Daemon_Intro},
83
+ {Daemon(1), Daemon_Running_Commands},
84
+ {Daemon(2), Daemon_Web_UI},
85
86
- Topic{Routing(0), Routing_Intro},
87
- Topic{Routing(1), Rouing_Interface},
88
- Topic{Routing(2), Routing_Resolving},
89
- Topic{Routing(3), Routing_DHT},
90
- Topic{Routing(4), Routing_Other},
86
+ {Routing(0), Routing_Intro},
87
+ {Routing(1), Rouing_Interface},
88
+ {Routing(2), Routing_Resolving},
89
+ {Routing(3), Routing_DHT},
90
+ {Routing(4), Routing_Other},
91
92
// TODO Exchange_Providing
93
// TODO Exchange_Providers
94
- Topic{Exchange(0), Exchange_Intro},
95
- Topic{Exchange(1), Exchange_Getting_Blocks},
96
- Topic{Exchange(2), Exchange_Strategies},
97
- Topic{Exchange(3), Exchange_Bitswap},
98
-
99
- Topic{Ipns(0), Ipns_Name_System},
100
- Topic{Ipns(1), Ipns_Mutability},
101
- Topic{Ipns(2), Ipns_PKI_Review},
102
- Topic{Ipns(3), Ipns_Publishing},
103
- Topic{Ipns(4), Ipns_Resolving},
104
- Topic{Ipns(5), Ipns_Consistency},
105
- Topic{Ipns(6), Ipns_Records_Etc},
106
-
107
- Topic{Mounting(0), Mounting_General},
108
- Topic{Mounting(1), Mounting_Ipfs},
109
- Topic{Mounting(2), Mounting_Ipns},
110
-
111
- Topic{Plumbing(0), Plumbing_Intro},
112
- Topic{Plumbing(1), Plumbing_Ipfs_Block},
113
- Topic{Plumbing(2), Plumbing_Ipfs_Object},
114
- Topic{Plumbing(3), Plumbing_Ipfs_Refs},
115
- Topic{Plumbing(4), Plumbing_Ipfs_Ping},
116
- Topic{Plumbing(5), Plumbing_Ipfs_Id},
117
-
118
- Topic{Formats(0), Formats_MerkleDag},
119
- Topic{Formats(1), Formats_Multihash},
120
- Topic{Formats(2), Formats_Multiaddr},
121
- Topic{Formats(3), Formats_Multicodec},
122
- Topic{Formats(4), Formats_Multicodec},
123
- Topic{Formats(5), Formats_Multikey},
124
- Topic{Formats(6), Formats_Protocol_Specific},
94
+ {Exchange(0), Exchange_Intro},
95
+ {Exchange(1), Exchange_Getting_Blocks},
96
+ {Exchange(2), Exchange_Strategies},
97
+ {Exchange(3), Exchange_Bitswap},
98
+
99
+ {Ipns(0), Ipns_Name_System},
100
+ {Ipns(1), Ipns_Mutability},
101
+ {Ipns(2), Ipns_PKI_Review},
102
+ {Ipns(3), Ipns_Publishing},
103
+ {Ipns(4), Ipns_Resolving},
104
+ {Ipns(5), Ipns_Consistency},
105
+ {Ipns(6), Ipns_Records_Etc},
106
+
107
+ {Mounting(0), Mounting_General},
108
+ {Mounting(1), Mounting_Ipfs},
109
+ {Mounting(2), Mounting_Ipns},
110
+
111
+ {Plumbing(0), Plumbing_Intro},
112
+ {Plumbing(1), Plumbing_Ipfs_Block},
113
+ {Plumbing(2), Plumbing_Ipfs_Object},
114
+ {Plumbing(3), Plumbing_Ipfs_Refs},
115
+ {Plumbing(4), Plumbing_Ipfs_Ping},
116
+ {Plumbing(5), Plumbing_Ipfs_Id},
117
+
118
+ {Formats(0), Formats_MerkleDag},
119
+ {Formats(1), Formats_Multihash},
120
+ {Formats(2), Formats_Multiaddr},
121
+ {Formats(3), Formats_Multicodec},
122
+ {Formats(4), Formats_Multicodec},
123
+ {Formats(5), Formats_Multikey},
124
+ {Formats(6), Formats_Protocol_Specific},
125
}
126
127
// Introduction
unixfs/mod/dagmodifier.go
+1
-1
@@ -95,7 +95,7 @@ func (dm *DagModifier) WriteAt(b []byte, offset int64) (int, error) {
95
type zeroReader struct{}
96
97
func (zr zeroReader) Read(b []byte) (int, error) {
98
- for i, _ := range b {
98
+ for i := range b {
99
b[i] = 0
100
}
101
return len(b), nil
util/key_set.go
+1
-1
@@ -39,7 +39,7 @@ func (wl *ks) Keys() []Key {
39
wl.lock.RLock()
40
defer wl.lock.RUnlock()
41
keys := make([]Key, 0)
42
- for k, _ := range wl.data {
42
+ for k := range wl.data {
43
keys = append(keys, k)
44
}
45
return keys
util/log.go
+1
-1
@@ -72,7 +72,7 @@ func SetDebugLogging() {
72
// SetAllLoggers changes the logging.Level of all loggers to lvl
73
func SetAllLoggers(lvl logging.Level) {
74
logging.SetLevel(lvl, "")
75
- for n, _ := range loggers {
75
+ for n := range loggers {
76
logging.SetLevel(lvl, n)
77
}
78
}
util/util_test.go
+12
-12
@@ -29,20 +29,20 @@ func TestKey(t *testing.T) {
29
30
func TestXOR(t *testing.T) {
31
cases := [][3][]byte{
32
- [3][]byte{
33
- []byte{0xFF, 0xFF, 0xFF},
34
- []byte{0xFF, 0xFF, 0xFF},
35
- []byte{0x00, 0x00, 0x00},
32
+ {
33
+ {0xFF, 0xFF, 0xFF},
34
+ {0xFF, 0xFF, 0xFF},
35
+ {0x00, 0x00, 0x00},
36
},
37
- [3][]byte{
38
- []byte{0x00, 0xFF, 0x00},
39
- []byte{0xFF, 0xFF, 0xFF},
40
- []byte{0xFF, 0x00, 0xFF},
37
+ {
38
+ {0x00, 0xFF, 0x00},
39
+ {0xFF, 0xFF, 0xFF},
40
+ {0xFF, 0x00, 0xFF},
41
},
42
- [3][]byte{
43
- []byte{0x55, 0x55, 0x55},
44
- []byte{0x55, 0xFF, 0xAA},
45
- []byte{0x00, 0xAA, 0xFF},
42
+ {
43
+ {0x55, 0x55, 0x55},
44
+ {0x55, 0xFF, 0xAA},
45
+ {0x00, 0xAA, 0xFF},
46
},
47
}
48