Skip to content

Commit

Permalink
internal/core/export: fix a few staticcheck warnings
Browse files Browse the repository at this point in the history
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í <mvdan@mvdan.cc>
Change-Id: Ic7ec2a7937f99c093c27df469f84090592991ef5
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1169108
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
  • Loading branch information
mvdan committed Sep 19, 2023
1 parent 2f6b27b commit 6923617
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
18 changes: 0 additions & 18 deletions internal/core/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ type exporter struct {
letAlias map[*ast.LetClause]*ast.LetClause
references map[*adt.Vertex]*referenceInfo

usedHidden map[string]bool

pivotter *pivotter
}

Expand Down Expand Up @@ -786,19 +784,3 @@ func (e *exporter) setDocs(x adt.Node) {
f.docSources = []adt.Conjunct{adt.MakeRootConjunct(nil, x)}
e.stack[len(e.stack)-1] = f
}

// func (e *Exporter) promise(upCount int32, f completeFunc) {
// e.todo = append(e.todo, f)
// }

func (e *exporter) errf(format string, args ...interface{}) *ast.BottomLit {
err := &exporterError{}
e.errs = errors.Append(e.errs, err)
return &ast.BottomLit{}
}

type errTODO errors.Error

type exporterError struct {
errTODO
}
1 change: 0 additions & 1 deletion internal/core/export/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ func (c *conjuncts) addConjunct(f adt.Feature, t adt.ArcType, env *adt.Environme

type field struct {
arcType adt.ArcType
docs []*ast.CommentGroup
arc *adt.Vertex
conjuncts []conjunct
}
Expand Down
1 change: 0 additions & 1 deletion internal/core/export/self.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func (d *depData) usageCount() int {

type refData struct {
dst *depData
ref ast.Expr
}

func (v *depData) node() *adt.Vertex {
Expand Down
16 changes: 2 additions & 14 deletions internal/core/export/self_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ package export_test

import (
"bytes"
"io/ioutil"
"log"
"strings"
"testing"

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

dir, err := ioutil.TempDir("", "test")
if err != nil {
log.Fatal(err)
}

instance := cuetxtar.Load(&a, dir)[0]
instance := cuetxtar.Load(&a, t.TempDir())[0]
if instance.Err != nil {
t.Fatal(instance.Err)
}
Expand Down Expand Up @@ -156,13 +149,8 @@ module: "mod.test/a"
t.Skip()
}

dir, err := ioutil.TempDir("", "test")
if err != nil {
log.Fatal(err)
}

a := txtar.Parse([]byte(in))
instance := cuetxtar.Load(a, dir)[0]
instance := cuetxtar.Load(a, t.TempDir())[0]
if instance.Err != nil {
t.Fatal(instance.Err)
}
Expand Down

0 comments on commit 6923617

Please sign in to comment.