Commit f1397e31 authored by rht's avatar rht Committed by Jeromy

strings.Split -> path.SplitList

License: MIT
Signed-off-by: default avatarrht <rhtbot@gmail.com>
parent 65f87fd7
...@@ -2,9 +2,9 @@ package record ...@@ -2,9 +2,9 @@ package record
import ( import (
"errors" "errors"
"strings"
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-ipfs/blocks/key"
path "github.com/ipfs/go-ipfs/path"
) )
// A SelectorFunc selects the best value for the given key from // A SelectorFunc selects the best value for the given key from
...@@ -18,7 +18,7 @@ func (s Selector) BestRecord(k key.Key, recs [][]byte) (int, error) { ...@@ -18,7 +18,7 @@ func (s Selector) BestRecord(k key.Key, recs [][]byte) (int, error) {
return 0, errors.New("no records given!") return 0, errors.New("no records given!")
} }
parts := strings.Split(string(k), "/") parts := path.SplitList(string(k))
if len(parts) < 3 { if len(parts) < 3 {
log.Infof("Record key does not have selectorfunc: %s", k) log.Infof("Record key does not have selectorfunc: %s", k)
return 0, errors.New("record key does not have selectorfunc") return 0, errors.New("record key does not have selectorfunc")
......
...@@ -3,10 +3,10 @@ package record ...@@ -3,10 +3,10 @@ package record
import ( import (
"bytes" "bytes"
"errors" "errors"
"strings"
key "github.com/ipfs/go-ipfs/blocks/key" key "github.com/ipfs/go-ipfs/blocks/key"
ci "github.com/ipfs/go-ipfs/p2p/crypto" ci "github.com/ipfs/go-ipfs/p2p/crypto"
path "github.com/ipfs/go-ipfs/path"
pb "github.com/ipfs/go-ipfs/routing/dht/pb" pb "github.com/ipfs/go-ipfs/routing/dht/pb"
u "github.com/ipfs/go-ipfs/util" u "github.com/ipfs/go-ipfs/util"
) )
...@@ -37,7 +37,7 @@ type ValidChecker struct { ...@@ -37,7 +37,7 @@ type ValidChecker struct {
// It runs needed validators // It runs needed validators
func (v Validator) VerifyRecord(r *pb.Record) error { func (v Validator) VerifyRecord(r *pb.Record) error {
// Now, check validity func // Now, check validity func
parts := strings.Split(r.GetKey(), "/") parts := path.SplitList(r.GetKey())
if len(parts) < 3 { if len(parts) < 3 {
log.Infof("Record key does not have validator: %s", key.Key(r.GetKey())) log.Infof("Record key does not have validator: %s", key.Key(r.GetKey()))
return nil return nil
...@@ -54,7 +54,7 @@ func (v Validator) VerifyRecord(r *pb.Record) error { ...@@ -54,7 +54,7 @@ func (v Validator) VerifyRecord(r *pb.Record) error {
func (v Validator) IsSigned(k key.Key) (bool, error) { func (v Validator) IsSigned(k key.Key) (bool, error) {
// Now, check validity func // Now, check validity func
parts := strings.Split(string(k), "/") parts := path.SplitList(string(k))
if len(parts) < 3 { if len(parts) < 3 {
log.Infof("Record key does not have validator: %s", k) log.Infof("Record key does not have validator: %s", k)
return false, nil return false, nil
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment