Skip to content

Commit 6923617

Browse files
committed
internal/core/export: fix a few staticcheck warnings
Remove some unused code; it's always in the git history if needed. While here, replace uses of the deprecated io/ioutil in tests. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Ic7ec2a7937f99c093c27df469f84090592991ef5 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1169108 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent 2f6b27b commit 6923617

File tree

4 files changed

+2
-34
lines changed

4 files changed

+2
-34
lines changed

internal/core/export/export.go

-18
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,6 @@ type exporter struct {
284284
letAlias map[*ast.LetClause]*ast.LetClause
285285
references map[*adt.Vertex]*referenceInfo
286286

287-
usedHidden map[string]bool
288-
289287
pivotter *pivotter
290288
}
291289

@@ -786,19 +784,3 @@ func (e *exporter) setDocs(x adt.Node) {
786784
f.docSources = []adt.Conjunct{adt.MakeRootConjunct(nil, x)}
787785
e.stack[len(e.stack)-1] = f
788786
}
789-
790-
// func (e *Exporter) promise(upCount int32, f completeFunc) {
791-
// e.todo = append(e.todo, f)
792-
// }
793-
794-
func (e *exporter) errf(format string, args ...interface{}) *ast.BottomLit {
795-
err := &exporterError{}
796-
e.errs = errors.Append(e.errs, err)
797-
return &ast.BottomLit{}
798-
}
799-
800-
type errTODO errors.Error
801-
802-
type exporterError struct {
803-
errTODO
804-
}

internal/core/export/expr.go

-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ func (c *conjuncts) addConjunct(f adt.Feature, t adt.ArcType, env *adt.Environme
353353

354354
type field struct {
355355
arcType adt.ArcType
356-
docs []*ast.CommentGroup
357356
arc *adt.Vertex
358357
conjuncts []conjunct
359358
}

internal/core/export/self.go

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ func (d *depData) usageCount() int {
110110

111111
type refData struct {
112112
dst *depData
113-
ref ast.Expr
114113
}
115114

116115
func (v *depData) node() *adt.Vertex {

internal/core/export/self_test.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ package export_test
1616

1717
import (
1818
"bytes"
19-
"io/ioutil"
20-
"log"
2119
"strings"
2220
"testing"
2321

@@ -116,12 +114,7 @@ func patch(t *testing.T, r *cue.Context, orig *txtar.Archive, f *ast.File) cue.V
116114
Data: b,
117115
})
118116

119-
dir, err := ioutil.TempDir("", "test")
120-
if err != nil {
121-
log.Fatal(err)
122-
}
123-
124-
instance := cuetxtar.Load(&a, dir)[0]
117+
instance := cuetxtar.Load(&a, t.TempDir())[0]
125118
if instance.Err != nil {
126119
t.Fatal(instance.Err)
127120
}
@@ -156,13 +149,8 @@ module: "mod.test/a"
156149
t.Skip()
157150
}
158151

159-
dir, err := ioutil.TempDir("", "test")
160-
if err != nil {
161-
log.Fatal(err)
162-
}
163-
164152
a := txtar.Parse([]byte(in))
165-
instance := cuetxtar.Load(a, dir)[0]
153+
instance := cuetxtar.Load(a, t.TempDir())[0]
166154
if instance.Err != nil {
167155
t.Fatal(instance.Err)
168156
}

0 commit comments

Comments
 (0)