Skip to content

Commit

Permalink
all: re-run go generate using Go 1.14.3
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
myitcv authored and mpvl committed May 15, 2020
1 parent e027d80 commit 238d821
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 31 deletions.
2 changes: 1 addition & 1 deletion cue/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cue/builtins.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/cmd/qgo/qgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func init() {
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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/encoding/hex/hex.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pkg/encoding/json/json.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pkg/html/html.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pkg/math/big.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pkg/path/path.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pkg/regexp/regexp.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
15 changes: 8 additions & 7 deletions pkg/strconv/strconv.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -155,8 +155,9 @@ func QuoteToASCII(s string) string {
}

// 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)
}
Expand All @@ -177,9 +178,9 @@ func QuoteRuneToASCII(r rune) string {
}

// 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)
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/strings/strings.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -129,10 +129,10 @@ func Fields(s string) []string {
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.
Expand Down
4 changes: 2 additions & 2 deletions pkg/text/template/template.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions pkg/tool/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package cli

//go:generate go run gen.go
//go:generate gofmt -s -w .

import (
"fmt"
Expand Down
1 change: 1 addition & 0 deletions pkg/tool/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package exec

//go:generate go run gen.go
//go:generate gofmt -s -w .

import (
"fmt"
Expand Down
1 change: 1 addition & 0 deletions pkg/tool/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package file

//go:generate go run gen.go
//go:generate gofmt -s -w .

import (
"io/ioutil"
Expand Down
1 change: 1 addition & 0 deletions pkg/tool/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package http

//go:generate go run gen.go
//go:generate gofmt -s -w .

import (
"io"
Expand Down
1 change: 1 addition & 0 deletions pkg/tool/os/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package os

//go:generate go run gen.go
//go:generate gofmt -s -w .

import (
"os"
Expand Down

0 comments on commit 238d821

Please sign in to comment.