diff --git a/codecHelpers_test.go b/codecHelpers_test.go index 857df766..a515f0c4 100644 --- a/codecHelpers_test.go +++ b/codecHelpers_test.go @@ -9,7 +9,7 @@ import ( "github.com/ipld/go-ipld-prime/schema" ) -func Example_Marshal() { +func Example_marshal() { type Foobar struct { Foo string Bar string @@ -28,7 +28,7 @@ func Example_Marshal() { // TODO: Example_Unmarshal, which uses nil and infers a typesystem. However, to match Example_Unmarshal_withSchema, that appears to need more features in bindnode. -func Example_Unmarshal_withSchema() { +func Example_unmarshal_withSchema() { typesys := schema.MustTypeSystem( schema.SpawnStruct("Foobar", []schema.StructField{ diff --git a/fluent/qp/qp.go b/fluent/qp/qp.go index 94b29242..7d7a7d17 100644 --- a/fluent/qp/qp.go +++ b/fluent/qp/qp.go @@ -150,7 +150,7 @@ func (f floatParam) Assemble(na datamodel.NodeAssembler) { } func Float(f float64) Assemble { - return intParam(f).Assemble + return floatParam(f).Assemble } type stringParam string diff --git a/go.mod b/go.mod index d838a9e0..f4e17e8f 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/multiformats/go-multihash v0.1.0 github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e github.com/warpfork/go-testmark v0.3.0 + golang.org/x/text v0.3.7 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 4c43127f..2d56679e 100644 --- a/go.sum +++ b/go.sum @@ -66,6 +66,9 @@ golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 h1:46ULzRKLh1CwgRq2dC5SlBzEq golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/linking/cid/cidLink.go b/linking/cid/cidLink.go index 835e950a..9685ce61 100644 --- a/linking/cid/cidLink.go +++ b/linking/cid/cidLink.go @@ -48,7 +48,7 @@ func (lp LinkPrototype) BuildLink(hashsum []byte) datamodel.Link { p := lp.Prefix length := p.MhLength - if p.MhType == multihash.ID { + if p.MhType == multihash.IDENTITY { length = -1 } if p.Version == 0 && (p.MhType != multihash.SHA2_256 || diff --git a/node/bindnode/infer.go b/node/bindnode/infer.go index 92f38b68..c11c7f9e 100644 --- a/node/bindnode/infer.go +++ b/node/bindnode/infer.go @@ -348,7 +348,7 @@ func inferGoType(typ schema.Type, status map[schema.TypeName]inferredStatus, lev // from IPLD Schema field names like "foo" to Go field names like "Foo". func fieldNameFromSchema(name string) string { - fieldName := strings.Title(name) + fieldName := strings.Title(name) //lint:ignore SA1019 cases.Title doesn't work for this if !token.IsIdentifier(fieldName) { panic(fmt.Sprintf("bindnode: inferred field name %q is not a valid Go identifier", fieldName)) } @@ -418,10 +418,8 @@ func inferSchema(typ reflect.Type, level int) schema.Type { return schemaTypeBytes } - etyp := typ.Elem() nullable := false - if etyp.Kind() == reflect.Ptr { - etyp = etyp.Elem() + if typ.Elem().Kind() == reflect.Ptr { nullable = true } etypSchema := inferSchema(typ.Elem(), level+1) @@ -433,7 +431,7 @@ func inferSchema(typ reflect.Type, level int) schema.Type { defaultTypeSystem.Accumulate(typSchema) return typSchema } - panic(fmt.Sprintf("%s", typ.Kind())) + panic(fmt.Sprintf("%d", typ.Kind())) } // There are currently 27 reflect.Kind iota values, diff --git a/node/bindnode/node.go b/node/bindnode/node.go index 83fe021c..8bf2c6bc 100644 --- a/node/bindnode/node.go +++ b/node/bindnode/node.go @@ -905,8 +905,6 @@ type _mapAssembler struct { // TODO: more state checks curKey _assembler - - nextIndex int // only used by repr.go } func (w *_mapAssembler) AssembleKey() datamodel.NodeAssembler { @@ -1000,8 +998,6 @@ type _unionAssembler struct { // TODO: more state checks curKey _assembler - - nextIndex int // only used by repr.go } func (w *_unionAssembler) AssembleKey() datamodel.NodeAssembler { diff --git a/node/tests/schemaLinks.go b/node/tests/schemaLinks.go index b78f2805..75e2236f 100644 --- a/node/tests/schemaLinks.go +++ b/node/tests/schemaLinks.go @@ -24,7 +24,7 @@ import ( var store = memstore.Store{} func encode(n datamodel.Node) (datamodel.Node, datamodel.Link) { - lp := cidlink.LinkPrototype{cid.Prefix{ + lp := cidlink.LinkPrototype{Prefix: cid.Prefix{ Version: 1, Codec: 0x0129, MhType: 0x13, diff --git a/node/tests/testutil.go b/node/tests/testutil.go index 2c4b92d3..3be37c60 100644 --- a/node/tests/testutil.go +++ b/node/tests/testutil.go @@ -10,38 +10,9 @@ import ( // they'd probably be much less fragile and give better error messages that way. // On the other hand, the functions for condensing two-arg returns wouldn't go away anyway. -func plz(n datamodel.Node, e error) datamodel.Node { - if e != nil { - panic(e) - } - return n -} - -func plzStr(n datamodel.Node, e error) string { - if e != nil { - panic(e) - } - if s, ok := n.AsString(); ok == nil { - return s - } else { - panic(ok) - } -} - -func str(n datamodel.Node) string { - if s, ok := n.AsString(); ok == nil { - return s - } else { - panic(ok) - } -} - -func erp(n datamodel.Node, e error) interface{} { - if e != nil { - return e - } - return n -} +// various benchmarks assign their final result here, +// in order to defuse the possibility of their work being elided. +var sink interface{} //lint:ignore U1000 used by benchmarks // purely to syntactically flip large inline closures so we can see the argument at the top rather than the bottom of the block. func withNode(n datamodel.Node, cb func(n datamodel.Node)) { diff --git a/node/tests/util.go b/node/tests/util.go index 0ce32e93..4e8ba61b 100644 --- a/node/tests/util.go +++ b/node/tests/util.go @@ -9,10 +9,6 @@ import ( "github.com/ipld/go-ipld-prime/traversal/selector" ) -// various benchmarks assign their final result here, -// in order to defuse the possibility of their work being elided. -var sink interface{} - func mustNodeFromJsonString(np datamodel.NodePrototype, str string) datamodel.Node { nb := np.NewBuilder() must.NotError(json.Decode(nb, strings.NewReader(str))) diff --git a/printer/printer.go b/printer/printer.go index 21cf355a..763c3543 100644 --- a/printer/printer.go +++ b/printer/printer.go @@ -107,6 +107,7 @@ func (cfg Config) oneline(typ schema.Type, isInKey bool) bool { return isInKey // Future: this could become customizable, with some kind of Always|OnlyInKeys|Never option enum per type. } +/* TODO: not implemented or used // useRepr decides if a value should be printed using its representation. // Sometimes configuring this to be true for structs or unions with stringy representations // will cause map printouts using them as keys to become drastically more readable @@ -114,6 +115,7 @@ func (cfg Config) oneline(typ schema.Type, isInKey bool) bool { func (cfg Config) useRepr(typ schema.Type, isInKey bool) bool { return false } +*/ // useCmplxKeys decides if a map should print itself using a multi-line and extra-indented style for keys. func (cfg Config) useCmplxKeys(mapn datamodel.Node) bool { diff --git a/schema/gen/go/adjunctCfg.go b/schema/gen/go/adjunctCfg.go index 910eeea1..13adbd05 100644 --- a/schema/gen/go/adjunctCfg.go +++ b/schema/gen/go/adjunctCfg.go @@ -65,7 +65,7 @@ func (cfg *AdjunctCfg) FieldSymbolUpper(f schema.StructField) string { if x, ok := cfg.fieldSymbolUpperOverrides[FieldTuple{f.Type().Name(), f.Name()}]; ok { return x } - return strings.Title(f.Name()) + return strings.Title(f.Name()) //lint:ignore SA1019 cases.Title doesn't work for this } // Comments returns a bool for whether comments should be included in gen output or not. @@ -171,7 +171,7 @@ func sizeOfSchemaType(t schema.Type) uintptr { // and validated more aggressively up front when adjcfg is loaded. func (cfg *AdjunctCfg) UnionMemlayout(t schema.Type) string { if t.TypeKind() != schema.TypeKind_Union { - panic(fmt.Errorf("%s is not a union!", t.Name())) + panic(fmt.Errorf("%s is not a union", t.Name())) } v, ok := cfg.CfgUnionMemlayout[t.Name()] if !ok { diff --git a/schema/gen/go/genBoolReprBool.go b/schema/gen/go/genBoolReprBool.go index fe642103..f563292b 100644 --- a/schema/gen/go/genBoolReprBool.go +++ b/schema/gen/go/genBoolReprBool.go @@ -77,7 +77,7 @@ func (g boolReprBoolReprGenerator) EmitNodePrototypeType(w io.Writer) { `, w, g.AdjCfg, g) } func (g boolReprBoolReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { - return boolReprBoolReprBuilderGenerator{g.AdjCfg, g.Type} + return boolReprBoolReprBuilderGenerator(g) } type boolReprBoolReprBuilderGenerator struct { diff --git a/schema/gen/go/genBytesReprBytes.go b/schema/gen/go/genBytesReprBytes.go index d1b404f8..9374bb36 100644 --- a/schema/gen/go/genBytesReprBytes.go +++ b/schema/gen/go/genBytesReprBytes.go @@ -77,7 +77,7 @@ func (g bytesReprBytesReprGenerator) EmitNodePrototypeType(w io.Writer) { `, w, g.AdjCfg, g) } func (g bytesReprBytesReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { - return bytesReprBytesReprBuilderGenerator{g.AdjCfg, g.Type} + return bytesReprBytesReprBuilderGenerator(g) } type bytesReprBytesReprBuilderGenerator struct { diff --git a/schema/gen/go/genFloatReprFloat.go b/schema/gen/go/genFloatReprFloat.go index a7c1c4ee..be0c918c 100644 --- a/schema/gen/go/genFloatReprFloat.go +++ b/schema/gen/go/genFloatReprFloat.go @@ -77,7 +77,7 @@ func (g float64ReprFloatReprGenerator) EmitNodePrototypeType(w io.Writer) { `, w, g.AdjCfg, g) } func (g float64ReprFloatReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { - return float64ReprFloatReprBuilderGenerator{g.AdjCfg, g.Type} + return float64ReprFloatReprBuilderGenerator(g) } type float64ReprFloatReprBuilderGenerator struct { diff --git a/schema/gen/go/genIntReprInt.go b/schema/gen/go/genIntReprInt.go index 06ac3ba4..5991ad91 100644 --- a/schema/gen/go/genIntReprInt.go +++ b/schema/gen/go/genIntReprInt.go @@ -77,7 +77,7 @@ func (g intReprIntReprGenerator) EmitNodePrototypeType(w io.Writer) { `, w, g.AdjCfg, g) } func (g intReprIntReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { - return intReprIntReprBuilderGenerator{g.AdjCfg, g.Type} + return intReprIntReprBuilderGenerator(g) } type intReprIntReprBuilderGenerator struct { diff --git a/schema/gen/go/genLinkReprLink.go b/schema/gen/go/genLinkReprLink.go index 75553b3d..23647c97 100644 --- a/schema/gen/go/genLinkReprLink.go +++ b/schema/gen/go/genLinkReprLink.go @@ -77,7 +77,7 @@ func (g linkReprLinkReprGenerator) EmitNodePrototypeType(w io.Writer) { `, w, g.AdjCfg, g) } func (g linkReprLinkReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { - return linkReprLinkReprBuilderGenerator{g.AdjCfg, g.Type} + return linkReprLinkReprBuilderGenerator(g) } type linkReprLinkReprBuilderGenerator struct { diff --git a/schema/gen/go/genStringReprString.go b/schema/gen/go/genStringReprString.go index 8389f174..05c346df 100644 --- a/schema/gen/go/genStringReprString.go +++ b/schema/gen/go/genStringReprString.go @@ -77,7 +77,7 @@ func (g stringReprStringReprGenerator) EmitNodePrototypeType(w io.Writer) { `, w, g.AdjCfg, g) } func (g stringReprStringReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { - return stringReprStringReprBuilderGenerator{g.AdjCfg, g.Type} + return stringReprStringReprBuilderGenerator(g) } type stringReprStringReprBuilderGenerator struct { diff --git a/schema/gen/go/genUnionReprKinded.go b/schema/gen/go/genUnionReprKinded.go index d98a8fba..6fe32f1a 100644 --- a/schema/gen/go/genUnionReprKinded.go +++ b/schema/gen/go/genUnionReprKinded.go @@ -343,11 +343,7 @@ func (g unionKindedReprGenerator) EmitNodePrototypeType(w io.Writer) { // --- NodeBuilder and NodeAssembler ---> func (g unionKindedReprGenerator) GetNodeBuilderGenerator() NodeBuilderGenerator { - return unionKindedReprBuilderGenerator{ - g.AdjCfg, - g.PkgName, - g.Type, - } + return unionKindedReprBuilderGenerator(g) } type unionKindedReprBuilderGenerator struct { diff --git a/schema/gen/go/mixins/templateUtil.go b/schema/gen/go/mixins/templateUtil.go index 267ea129..39389c2e 100644 --- a/schema/gen/go/mixins/templateUtil.go +++ b/schema/gen/go/mixins/templateUtil.go @@ -11,7 +11,7 @@ import ( func doTemplate(tmplstr string, w io.Writer, data interface{}) { tmpl := template.Must(template.New(""). Funcs(template.FuncMap{ - "title": func(s string) string { return strings.Title(s) }, + "title": func(s string) string { return strings.Title(s) }, //lint:ignore SA1019 cases.Title doesn't work for this }). Parse(testutil.Dedent(tmplstr))) if err := tmpl.Execute(w, data); err != nil { diff --git a/schema/gen/go/templateUtil.go b/schema/gen/go/templateUtil.go index 6cf2282d..ab68f044 100644 --- a/schema/gen/go/templateUtil.go +++ b/schema/gen/go/templateUtil.go @@ -103,7 +103,7 @@ func doTemplate(tmplstr string, w io.Writer, adjCfg *AdjunctCfg, data interface{ } }, "add": func(a, b int) int { return a + b }, - "title": func(s string) string { return strings.Title(s) }, + "title": func(s string) string { return strings.Title(s) }, //lint:ignore SA1019 cases.Title doesn't work for this }). Parse(testutil.Dedent(tmplstr))) if err := tmpl.Execute(w, data); err != nil { diff --git a/schema/gen/go/testutil_test.go b/schema/gen/go/testutil_test.go deleted file mode 100644 index bb6c1126..00000000 --- a/schema/gen/go/testutil_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package gengo - -import ( - "github.com/ipld/go-ipld-prime/datamodel" -) - -// This file is full of helper functions. Most are moderately embarassing. -// -// We should probably turn half of this into Wish Checkers; -// they'd probably be much less fragile and give better error messages that way. -// On the other hand, the functions for condensing two-arg returns wouldn't go away anyway. - -func plz(n datamodel.Node, e error) datamodel.Node { - if e != nil { - panic(e) - } - return n -} -func plzStr(n datamodel.Node, e error) string { - if e != nil { - panic(e) - } - if s, ok := n.AsString(); ok == nil { - return s - } else { - panic(ok) - } -} -func str(n datamodel.Node) string { - if s, ok := n.AsString(); ok == nil { - return s - } else { - panic(ok) - } -} -func erp(n datamodel.Node, e error) interface{} { - if e != nil { - return e - } - return n -} - -// purely to syntactically flip large inline closures so we can see the argument at the top rather than the bottom of the block. -func withNode(n datamodel.Node, cb func(n datamodel.Node)) { - cb(n) -} diff --git a/schema/type.go b/schema/type.go index 6912b5f7..7db8720b 100644 --- a/schema/type.go +++ b/schema/type.go @@ -185,11 +185,15 @@ type UnionRepresentation_Keyed struct { type UnionRepresentation_Kinded struct { table map[datamodel.Kind]TypeName } + +//lint:ignore U1000 implementation TODO type UnionRepresentation_Envelope struct { discriminantKey string contentKey string table map[string]TypeName // key is user-defined freetext } + +//lint:ignore U1000 implementation TODO type UnionRepresentation_Inline struct { discriminantKey string table map[string]TypeName // key is user-defined freetext @@ -228,6 +232,8 @@ type StructRepresentation_Map struct { implicits map[string]ImplicitValue } type StructRepresentation_Tuple struct{} + +//lint:ignore U1000 implementation TODO type StructRepresentation_StringPairs struct{ sep1, sep2 string } type StructRepresentation_Stringjoin struct{ sep string } diff --git a/storage/fsstore/fsstore.go b/storage/fsstore/fsstore.go index f23c301d..7a6b29e5 100644 --- a/storage/fsstore/fsstore.go +++ b/storage/fsstore/fsstore.go @@ -211,7 +211,7 @@ func CheckAndMakeBasepath(basepath string) error { return fmt.Errorf("fsstore: failed to make staging dir: %w", err) } if !fi.IsDir() { - return fmt.Errorf("fsstore: staging dir path contains not a dir!") + return fmt.Errorf("fsstore: staging dir path contains not a dir") } default: return fmt.Errorf("fsstore: failed to make staging dir: %w", err) diff --git a/storage/sharding/sharding_test.go b/storage/sharding/sharding_test.go index fd7580e2..6a1e2eed 100644 --- a/storage/sharding/sharding_test.go +++ b/storage/sharding/sharding_test.go @@ -11,7 +11,7 @@ func printShard(fn func(string, *[]string), key string) { fmt.Printf("%s => %s\n", key, path.Join(v...)) } -func Example_Shard_r133() { +func Example_shard_R133() { printShard(Shard_r133, "abcdefgh") printShard(Shard_r133, "abcdefg") printShard(Shard_r133, "abcdef") @@ -29,7 +29,7 @@ func Example_Shard_r133() { } -func Example_Shard_r122() { +func Example_shard_r122() { printShard(Shard_r122, "abcdefgh") printShard(Shard_r122, "abcdefg") printShard(Shard_r122, "abcdef") @@ -46,7 +46,7 @@ func Example_Shard_r122() { // abc => 00/ab/abc } -func Example_Shard_r12() { +func Example_shard_r12() { printShard(Shard_r12, "abcde") printShard(Shard_r12, "abcd") printShard(Shard_r12, "abc") diff --git a/traversal/selector/exploreRecursive_test.go b/traversal/selector/exploreRecursive_test.go index e811edf4..6a55e4d9 100644 --- a/traversal/selector/exploreRecursive_test.go +++ b/traversal/selector/exploreRecursive_test.go @@ -223,7 +223,7 @@ func TestExploreRecursiveExplore(t *testing.T) { qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, parentsSelector, RecursionLimit{RecursionLimit_Depth, maxDepth - 2}, nil}) qt.Check(t, err, qt.IsNil) rs, _ = rs.Explore(rn, datamodel.PathSegmentOfInt(0)) - rn, err = rn.LookupByIndex(0) + _, err = rn.LookupByIndex(0) qt.Check(t, rs, qt.IsNil) qt.Check(t, err, qt.IsNil) }) @@ -277,7 +277,7 @@ func TestExploreRecursiveExplore(t *testing.T) { qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, subTree, RecursionLimit{RecursionLimit_None, 0}, nil}) qt.Check(t, err, qt.IsNil) rs, _ = rs.Explore(rn, datamodel.PathSegmentOfString("Parents")) - rn, err = rn.LookupByString("Parents") + _, err = rn.LookupByString("Parents") qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, parentsSelector, RecursionLimit{RecursionLimit_None, 0}, nil}) qt.Check(t, err, qt.IsNil) }) @@ -353,7 +353,7 @@ func TestExploreRecursiveExplore(t *testing.T) { qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, subTree, RecursionLimit{RecursionLimit_Depth, maxDepth - 1}, nil}) qt.Check(t, err, qt.IsNil) rs, _ = rs.Explore(rn, datamodel.PathSegmentOfString("Parents")) - rn, err = rn.LookupByString("Parents") + _, err = rn.LookupByString("Parents") qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, parentsSelector, RecursionLimit{RecursionLimit_Depth, maxDepth - 1}, nil}) qt.Check(t, err, qt.IsNil) @@ -373,7 +373,7 @@ func TestExploreRecursiveExplore(t *testing.T) { qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, ExploreRecursive{sideSelector, sideSelector, RecursionLimit{RecursionLimit_Depth, maxDepth - 2}, nil}, RecursionLimit{RecursionLimit_Depth, maxDepth}, nil}) qt.Check(t, err, qt.IsNil) rs, _ = rs.Explore(rn, datamodel.PathSegmentOfString("sauce")) - rn, err = rn.LookupByString("sauce") + _, err = rn.LookupByString("sauce") qt.Check(t, rs, qt.IsNil) qt.Check(t, err, qt.IsNil) @@ -397,7 +397,7 @@ func TestExploreRecursiveExplore(t *testing.T) { qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, ExploreRecursive{sideSelector, sideSelector, RecursionLimit{RecursionLimit_Depth, maxDepth - 1}, nil}, RecursionLimit{RecursionLimit_Depth, maxDepth - 1}, nil}) qt.Check(t, err, qt.IsNil) rs, _ = rs.Explore(rn, datamodel.PathSegmentOfString("whiz")) - rn, err = rn.LookupByString("whiz") + _, err = rn.LookupByString("whiz") qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, ExploreRecursive{sideSelector, sideSelector, RecursionLimit{RecursionLimit_Depth, maxDepth - 2}, nil}, RecursionLimit{RecursionLimit_Depth, maxDepth - 1}, nil}) qt.Check(t, err, qt.IsNil) }) @@ -439,7 +439,7 @@ func TestExploreRecursiveExplore(t *testing.T) { qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, parentsSelector, RecursionLimit{RecursionLimit_Depth, maxDepth - 1}, nil}) qt.Check(t, err, qt.IsNil) rs, _ = rs.Explore(rn, datamodel.PathSegmentOfInt(0)) - rn, err = rn.LookupByIndex(0) + _, err = rn.LookupByIndex(0) qt.Check(t, rs, deepEqualsAllowAllUnexported, ExploreRecursive{subTree, ExploreUnion{[]Selector{Matcher{}, subTree}}, RecursionLimit{RecursionLimit_Depth, maxDepth - 2}, nil}) qt.Check(t, err, qt.IsNil) }) diff --git a/traversal/walk_test.go b/traversal/walk_test.go index 94dba615..6ea51a6c 100644 --- a/traversal/walk_test.go +++ b/traversal/walk_test.go @@ -129,6 +129,7 @@ func TestWalkMatching(t *testing.T) { ssb.ExploreAll(ssb.ExploreRecursiveEdge()), )) s, err := ss.Selector() + qt.Check(t, err, qt.IsNil) var order int lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(&store) @@ -173,6 +174,7 @@ func TestWalkMatching(t *testing.T) { t.Run("traversing lists should work", func(t *testing.T) { ss := ssb.ExploreRange(0, 3, ssb.Matcher()) s, err := ss.Selector() + qt.Check(t, err, qt.IsNil) var order int lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(&store) @@ -216,6 +218,7 @@ func TestWalkMatching(t *testing.T) { }))) }) s, err := ss.Selector() + qt.Check(t, err, qt.IsNil) var order int lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(&store) @@ -280,6 +283,7 @@ func TestWalkMatching(t *testing.T) { }))) }) s, err := ss.Selector() + qt.Check(t, err, qt.IsNil) var order int lsys := cidlink.DefaultLinkSystem() lsys.SetReadStorage(&store)