all: re-run go generate using Go 1.14.3
Also switch all go:generate directives to use go run so that we don't
have to faff around with making sure the correct version of a tool is in
our PATH.
Accordingly adjust the qgo generator to generate go:generate directives
that us go run.
Change-Id: I4f299692e5a06837fa28cee167b27bed58b6a5ff
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6063
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/builtin.go b/cue/builtin.go
index 4a680bb..a13d384 100644
--- a/cue/builtin.go
+++ b/cue/builtin.go
@@ -13,7 +13,7 @@
// limitations under the License.
//go:generate go run gen.go
-//go:generate goimports -w -local cuelang.org/go builtins.go
+//go:generate go run golang.org/x/tools/cmd/goimports -w -local cuelang.org/go builtins.go
//go:generate gofmt -s -w builtins.go
package cue
diff --git a/cue/builtins.go b/cue/builtins.go
index 1dd46a7..0957474 100644
--- a/cue/builtins.go
+++ b/cue/builtins.go
@@ -3121,10 +3121,10 @@
Params: []kind{listKind, stringKind},
Result: stringKind,
Func: func(c *callCtxt) {
- a, sep := c.strList(0), c.string(1)
+ elems, sep := c.strList(0), c.string(1)
if c.do() {
c.ret = func() interface{} {
- return strings.Join(a, sep)
+ return strings.Join(elems, sep)
}()
}
},
diff --git a/internal/cmd/qgo/qgo.go b/internal/cmd/qgo/qgo.go
index 1f9c942..d1fcbb6 100644
--- a/internal/cmd/qgo/qgo.go
+++ b/internal/cmd/qgo/qgo.go
@@ -80,7 +80,7 @@
func main() {
flag.Parse()
- genLine = "//go:generate " + strings.Join(os.Args, " ")
+ genLine = "//go:generate go run cuelang.org/go/internal/cmd/qgo " + strings.Join(os.Args[1:], " ")
args := flag.Args()
if len(args) == 0 {
diff --git a/pkg/encoding/hex/hex.go b/pkg/encoding/hex/hex.go
index 478632a..4a9fa1a 100644
--- a/pkg/encoding/hex/hex.go
+++ b/pkg/encoding/hex/hex.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -stripstr -exclude=Decode$,Encode$,EncodeToString,Dumper extract encoding/hex
+//go:generate go run cuelang.org/go/internal/cmd/qgo -stripstr -exclude=Decode$,Encode$,EncodeToString,Dumper extract encoding/hex
package hex
diff --git a/pkg/encoding/json/json.go b/pkg/encoding/json/json.go
index 3bb0642..2da0b3a 100644
--- a/pkg/encoding/json/json.go
+++ b/pkg/encoding/json/json.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude=Compact,Indent,arshal$ extract encoding/json
+//go:generate go run cuelang.org/go/internal/cmd/qgo -exclude=Compact,Indent,arshal$ extract encoding/json
package json
diff --git a/pkg/html/html.go b/pkg/html/html.go
index 548392b..7f6cefb 100644
--- a/pkg/html/html.go
+++ b/pkg/html/html.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -stripstr extract html
+//go:generate go run cuelang.org/go/internal/cmd/qgo -stripstr extract html
package html
diff --git a/pkg/math/big.go b/pkg/math/big.go
index 5f20b82..41b3ffc 100644
--- a/pkg/math/big.go
+++ b/pkg/math/big.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude= extract math/big
+//go:generate go run cuelang.org/go/internal/cmd/qgo -exclude= extract math/big
package math
diff --git a/pkg/path/path.go b/pkg/path/path.go
index fecc049..bd82f26 100644
--- a/pkg/path/path.go
+++ b/pkg/path/path.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude=Split,Join extract path
+//go:generate go run cuelang.org/go/internal/cmd/qgo -exclude=Split,Join extract path
package path
diff --git a/pkg/regexp/regexp.go b/pkg/regexp/regexp.go
index fe34a5d..19dd2c4 100644
--- a/pkg/regexp/regexp.go
+++ b/pkg/regexp/regexp.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude=Compile,Append,Reader,Match$ -stripstr extract regexp
+//go:generate go run cuelang.org/go/internal/cmd/qgo -exclude=Compile,Append,Reader,Match$ -stripstr extract regexp
package regexp
diff --git a/pkg/strconv/strconv.go b/pkg/strconv/strconv.go
index b3e556e..afeca28 100644
--- a/pkg/strconv/strconv.go
+++ b/pkg/strconv/strconv.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude=Append,Unquote,Itoa,CanBackquote extract strconv
+//go:generate go run cuelang.org/go/internal/cmd/qgo -exclude=Append,Unquote,Itoa,CanBackquote extract strconv
package strconv
@@ -155,8 +155,9 @@
}
// QuoteToGraphic returns a double-quoted Go string literal representing s.
-// The returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for
-// non-ASCII characters and non-printable characters as defined by IsGraphic.
+// The returned string leaves Unicode graphic characters, as defined by
+// IsGraphic, unchanged and uses Go escape sequences (\t, \n, \xFF, \u0100)
+// for non-graphic characters.
func QuoteToGraphic(s string) string {
return strconv.QuoteToGraphic(s)
}
@@ -177,9 +178,9 @@
}
// QuoteRuneToGraphic returns a single-quoted Go character literal representing
-// the rune. The returned string uses Go escape sequences (\t, \n, \xFF,
-// \u0100) for non-ASCII characters and non-printable characters as defined
-// by IsGraphic.
+// the rune. If the rune is not a Unicode graphic character,
+// as defined by IsGraphic, the returned string will use a Go escape sequence
+// (\t, \n, \xFF, \u0100).
func QuoteRuneToGraphic(r rune) string {
return strconv.QuoteRuneToGraphic(r)
}
diff --git a/pkg/strings/strings.go b/pkg/strings/strings.go
index a2077fb..3945718 100644
--- a/pkg/strings/strings.go
+++ b/pkg/strings/strings.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude=Rune$,Func$,^Map$,Special$,EqualFold,Byte,Title$,ToValidUTF8,All$ extract strings
+//go:generate go run cuelang.org/go/internal/cmd/qgo -exclude=Rune$,Func$,^Map$,Special$,EqualFold,Byte,Title$,ToValidUTF8,All$ extract strings
package strings
@@ -129,10 +129,10 @@
return strings.Fields(s)
}
-// Join concatenates the elements of a to create a single string. The separator string
-// sep is placed between elements in the resulting string.
-func Join(a []string, sep string) string {
- return strings.Join(a, sep)
+// Join concatenates the elements of its first argument to create a single string. The separator
+// string sep is placed between elements in the resulting string.
+func Join(elems []string, sep string) string {
+ return strings.Join(elems, sep)
}
// HasPrefix tests whether the string s begins with prefix.
diff --git a/pkg/text/template/template.go b/pkg/text/template/template.go
index 9e2eab1..2784e5c 100644
--- a/pkg/text/template/template.go
+++ b/pkg/text/template/template.go
@@ -1,4 +1,4 @@
-// Copyright 2018 The CUE Authors
+// Copyright 2020 The CUE Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo -exclude=Escaper$,Must,Parse -stripstr extract text/template
+//go:generate go run cuelang.org/go/internal/cmd/qgo -exclude=Escaper$,Must,Parse -stripstr extract text/template
package template
diff --git a/pkg/tool/cli/cli.go b/pkg/tool/cli/cli.go
index dd29681..8ba4878 100644
--- a/pkg/tool/cli/cli.go
+++ b/pkg/tool/cli/cli.go
@@ -15,6 +15,7 @@
package cli
//go:generate go run gen.go
+//go:generate gofmt -s -w .
import (
"fmt"
diff --git a/pkg/tool/exec/exec.go b/pkg/tool/exec/exec.go
index 7c2db97..62c2cec 100644
--- a/pkg/tool/exec/exec.go
+++ b/pkg/tool/exec/exec.go
@@ -15,6 +15,7 @@
package exec
//go:generate go run gen.go
+//go:generate gofmt -s -w .
import (
"fmt"
diff --git a/pkg/tool/file/file.go b/pkg/tool/file/file.go
index 7514a03..7c206ca 100644
--- a/pkg/tool/file/file.go
+++ b/pkg/tool/file/file.go
@@ -15,6 +15,7 @@
package file
//go:generate go run gen.go
+//go:generate gofmt -s -w .
import (
"io/ioutil"
diff --git a/pkg/tool/http/http.go b/pkg/tool/http/http.go
index eaa77bc..4c6f9e6 100644
--- a/pkg/tool/http/http.go
+++ b/pkg/tool/http/http.go
@@ -15,6 +15,7 @@
package http
//go:generate go run gen.go
+//go:generate gofmt -s -w .
import (
"io"
diff --git a/pkg/tool/os/env.go b/pkg/tool/os/env.go
index 5065ce8..df64b97 100644
--- a/pkg/tool/os/env.go
+++ b/pkg/tool/os/env.go
@@ -15,6 +15,7 @@
package os
//go:generate go run gen.go
+//go:generate gofmt -s -w .
import (
"os"