all: gofmt -s
While at it, remove a couple of unused code low-hanging fruit.
Change-Id: Idcca881c8496f7a102ce84f1434dfb1e441b8eb9
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4921
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/builtin_test.go b/cue/builtin_test.go
index d89bcba..1c8df6e 100644
--- a/cue/builtin_test.go
+++ b/cue/builtin_test.go
@@ -24,12 +24,12 @@
func TestBuiltins(t *testing.T) {
test := func(pkg, expr string) []*bimport {
- return []*bimport{&bimport{"",
+ return []*bimport{{"",
[]string{fmt.Sprintf("import %q\n(%s)", pkg, expr)},
}}
}
testExpr := func(expr string) []*bimport {
- return []*bimport{&bimport{"",
+ return []*bimport{{"",
[]string{fmt.Sprintf("(%s)", expr)},
}}
}
diff --git a/cue/builtins.go b/cue/builtins.go
index 72cdecb..7b2e4e1 100644
--- a/cue/builtins.go
+++ b/cue/builtins.go
@@ -163,10 +163,10 @@
}
var builtinPackages = map[string]*builtinPkg{
- "": &builtinPkg{
+ "": {
native: []*builtin{{}},
},
- "crypto/md5": &builtinPkg{
+ "crypto/md5": {
native: []*builtin{{
Name: "Size",
Const: "16",
@@ -188,7 +188,7 @@
},
}},
},
- "crypto/sha1": &builtinPkg{
+ "crypto/sha1": {
native: []*builtin{{
Name: "Size",
Const: "20",
@@ -210,7 +210,7 @@
},
}},
},
- "crypto/sha256": &builtinPkg{
+ "crypto/sha256": {
native: []*builtin{{
Name: "Size",
Const: "32",
@@ -248,7 +248,7 @@
},
}},
},
- "crypto/sha512": &builtinPkg{
+ "crypto/sha512": {
native: []*builtin{{
Name: "Size",
Const: "64",
@@ -318,7 +318,7 @@
},
}},
},
- "encoding/base64": &builtinPkg{
+ "encoding/base64": {
native: []*builtin{{
Name: "EncodedLen",
Params: []kind{topKind, intKind},
@@ -381,7 +381,7 @@
},
}},
},
- "encoding/csv": &builtinPkg{
+ "encoding/csv": {
native: []*builtin{{
Name: "Encode",
Params: []kind{topKind},
@@ -435,7 +435,7 @@
},
}},
},
- "encoding/hex": &builtinPkg{
+ "encoding/hex": {
native: []*builtin{{
Name: "EncodedLen",
Params: []kind{intKind},
@@ -498,7 +498,7 @@
},
}},
},
- "encoding/json": &builtinPkg{
+ "encoding/json": {
native: []*builtin{{
Name: "Valid",
Params: []kind{bytesKind | stringKind},
@@ -643,7 +643,7 @@
},
}},
},
- "encoding/yaml": &builtinPkg{
+ "encoding/yaml": {
native: []*builtin{{
Name: "Marshal",
Params: []kind{topKind},
@@ -767,7 +767,7 @@
},
}},
},
- "html": &builtinPkg{
+ "html": {
native: []*builtin{{
Name: "Escape",
Params: []kind{stringKind},
@@ -794,7 +794,7 @@
},
}},
},
- "list": &builtinPkg{
+ "list": {
native: []*builtin{{
Name: "Drop",
Params: []kind{listKind, intKind},
@@ -1206,7 +1206,7 @@
}
}`,
},
- "math": &builtinPkg{
+ "math": {
native: []*builtin{{
Name: "MaxExp",
Const: "2147483647",
@@ -1949,7 +1949,7 @@
},
}},
},
- "math/bits": &builtinPkg{
+ "math/bits": {
native: []*builtin{{
Name: "Lsh",
Params: []kind{intKind, intKind},
@@ -2093,7 +2093,7 @@
},
}},
},
- "net": &builtinPkg{
+ "net": {
native: []*builtin{{
Name: "SplitHostPort",
Params: []kind{stringKind},
@@ -2363,7 +2363,7 @@
},
}},
},
- "path": &builtinPkg{
+ "path": {
native: []*builtin{{
Name: "Split",
Params: []kind{stringKind},
@@ -2451,7 +2451,7 @@
},
}},
},
- "regexp": &builtinPkg{
+ "regexp": {
native: []*builtin{{
Name: "Valid",
Params: []kind{stringKind},
@@ -2635,7 +2635,7 @@
},
}},
},
- "strconv": &builtinPkg{
+ "strconv": {
native: []*builtin{{
Name: "Unquote",
Params: []kind{stringKind},
@@ -2857,7 +2857,7 @@
},
}},
},
- "strings": &builtinPkg{
+ "strings": {
native: []*builtin{{
Name: "ByteAt",
Params: []kind{bytesKind | stringKind, intKind},
@@ -3286,7 +3286,7 @@
},
}},
},
- "struct": &builtinPkg{
+ "struct": {
native: []*builtin{{
Name: "MinFields",
Params: []kind{structKind, intKind},
@@ -3323,7 +3323,7 @@
},
}},
},
- "text/tabwriter": &builtinPkg{
+ "text/tabwriter": {
native: []*builtin{{
Name: "Write",
Params: []kind{topKind},
@@ -3370,7 +3370,7 @@
},
}},
},
- "text/template": &builtinPkg{
+ "text/template": {
native: []*builtin{{
Name: "Execute",
Params: []kind{stringKind, topKind},
@@ -3421,7 +3421,7 @@
},
}},
},
- "time": &builtinPkg{
+ "time": {
native: []*builtin{{
Name: "Nanosecond",
Const: "1",
@@ -3622,7 +3622,7 @@
},
}},
},
- "tool": &builtinPkg{
+ "tool": {
native: []*builtin{{}},
cue: `{
Command: {
@@ -3642,7 +3642,7 @@
Name :: =~"^\\PL([-](\\PL|\\PN))*$"
}`,
},
- "tool/cli": &builtinPkg{
+ "tool/cli": {
native: []*builtin{{}},
cue: `{
Print: {
@@ -3651,7 +3651,7 @@
}
}`,
},
- "tool/exec": &builtinPkg{
+ "tool/exec": {
native: []*builtin{{}},
cue: `{
Run: {
@@ -3667,7 +3667,7 @@
}
}`,
},
- "tool/file": &builtinPkg{
+ "tool/file": {
native: []*builtin{{}},
cue: `{
Read: {
@@ -3694,7 +3694,7 @@
}
}`,
},
- "tool/http": &builtinPkg{
+ "tool/http": {
native: []*builtin{{}},
cue: `{
Get: Do & {
@@ -3736,7 +3736,7 @@
}
}`,
},
- "tool/os": &builtinPkg{
+ "tool/os": {
native: []*builtin{{}},
cue: `{
Name :: !="" & !~"^[$]"
diff --git a/cue/go_test.go b/cue/go_test.go
index 1a554cf..db7fe08 100644
--- a/cue/go_test.go
+++ b/cue/go_test.go
@@ -98,13 +98,13 @@
map[string]interface{}{"a": 1, "x": nil}, "<0>{x: _, a: 1}",
}, {
map[string][]int{
- "a": []int{1},
- "b": []int{3, 4},
+ "a": {1},
+ "b": {3, 4},
}, "<0>{a: [1], b: [3,4]}",
}, {
map[bool]int{}, "_|_(unsupported Go type for map key (bool))",
}, {
- map[struct{}]int{struct{}{}: 2}, "_|_(unsupported Go type for map key (struct {}))",
+ map[struct{}]int{{}: 2}, "_|_(unsupported Go type for map key (struct {}))",
}, {
map[int]int{1: 2}, `<0>{"1": 2}`,
}, {
diff --git a/cue/load/match_test.go b/cue/load/match_test.go
index f2876d5..04ef648 100644
--- a/cue/load/match_test.go
+++ b/cue/load/match_test.go
@@ -15,7 +15,6 @@
package load
import (
- "io"
"os"
"path/filepath"
"reflect"
@@ -97,14 +96,6 @@
}
}
-type readNopCloser struct {
- io.Reader
-}
-
-func (r readNopCloser) Close() error {
- return nil
-}
-
var (
cfg = &Config{BuildTags: []string{"enable"}}
defCfg = &Config{}
diff --git a/cue/parser/error_test.go b/cue/parser/error_test.go
index 5af605f..68eea4c 100644
--- a/cue/parser/error_test.go
+++ b/cue/parser/error_test.go
@@ -42,8 +42,6 @@
"cuelang.org/go/internal/source"
)
-const testdata = "testdata"
-
func getPos(f *token.File, offset int) token.Pos {
if f != nil {
return f.Pos(offset, 0)
diff --git a/encoding/jsonschema/decode.go b/encoding/jsonschema/decode.go
index afa502d..33cb400 100644
--- a/encoding/jsonschema/decode.go
+++ b/encoding/jsonschema/decode.go
@@ -407,7 +407,7 @@
Token: token.ISA,
Value: ast.NewIdent("_"),
Attrs: []*ast.Attribute{
- &ast.Attribute{Text: fmt.Sprintf("@%s(%s)", tag, value)},
+ {Text: fmt.Sprintf("@%s(%s)", tag, value)},
},
}
}