this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

all: resolve a handful of linter warnings

cue/parser's use of astinternal is just in the tests,
so there's no need to import it in the non-test code.
There's also no reason to define a func variable.

Remove a few unused fields and one type.

In internal/core/export's test, use an underscore assignment
so that the debugValue constant doesn't trigger "unused" warnings.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Id117bb2e5a8c6fd6c7d01f7f7782719663a6fddb
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195020
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>

+5 -11
-3
cue/parser/parser.go
··· 25 25 "cuelang.org/go/cue/scanner" 26 26 "cuelang.org/go/cue/token" 27 27 "cuelang.org/go/internal" 28 - "cuelang.org/go/internal/astinternal" 29 28 ) 30 - 31 - var debugStr = astinternal.DebugStr 32 29 33 30 // The parser structure holds the parser's internal state. 34 31 type parser struct {
+4 -3
cue/parser/parser_test.go
··· 20 20 "testing" 21 21 22 22 "cuelang.org/go/cue/ast" 23 + "cuelang.org/go/internal/astinternal" 23 24 ) 24 25 25 26 func TestParse(t *testing.T) { ··· 685 686 mode = append(mode, ParseFuncs) 686 687 } 687 688 f, err := ParseFile("input", tc.in, mode...) 688 - got := debugStr(f) 689 + got := astinternal.DebugStr(f) 689 690 if err != nil { 690 691 got += "\n" + err.Error() 691 692 } ··· 858 859 return true 859 860 }, nil) 860 861 if sel == nil { 861 - t.Fatalf("found no *SelectorExpr: %#v %s", f.Decls[0], debugStr(f)) 862 + t.Fatalf("found no *SelectorExpr: %#v %s", f.Decls[0], astinternal.DebugStr(f)) 862 863 } 863 864 const wantSel = "&{fmt _ {<nil>} {{}}}" 864 865 if fmt.Sprint(sel) != wantSel { ··· 877 878 if err != nil { 878 879 t.Errorf("unexpected error: %v", err) 879 880 } 880 - t.Error(debugStr(f)) 881 + t.Error(astinternal.DebugStr(f)) 881 882 }
-2
internal/core/dep/dep_test.go
··· 33 33 "cuelang.org/go/internal/value" 34 34 ) 35 35 36 - type visitFunc func(*adt.OpContext, *adt.ImportReference, *adt.Vertex, dep.VisitFunc) error 37 - 38 36 func TestVisit(t *testing.T) { 39 37 test := cuetxtar.TxTarTest{ 40 38 Root: "./testdata",
+1
internal/core/export/value_test.go
··· 44 44 @step(4c) 45 45 } 46 46 ` 47 + var _ = debugValue // avoid "unused const" warnings 47 48 48 49 test := cuetxtar.TxTarTest{ 49 50 Root: "./testdata/main",
-1
internal/core/runtime/extern.go
··· 100 100 } 101 101 102 102 type fieldInfo struct { 103 - file *ast.File 104 103 extern string 105 104 funcName string 106 105 attrBody string
-2
internal/tdtest/tdtest.go
··· 54 54 t *testing.T 55 55 56 56 table []TC 57 - toRun []int 58 57 59 58 updateEnabled bool 60 - file string 61 59 info *info 62 60 } 63 61