mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-29 02:01:43 +00:00
Merge pull request #1028 from weaveworks/codecgen-multiarch
Make unconteinerized build work on OSX
This commit is contained in:
1
vendor/github.com/ugorji/go/codec/codecgen/README.md
generated
vendored
1
vendor/github.com/ugorji/go/codec/codecgen/README.md
generated
vendored
@@ -23,6 +23,7 @@ Usage of codecgen:
|
||||
-c="github.com/ugorji/go/codec": codec path
|
||||
-o="": out file
|
||||
-r=".*": regex for type name to match
|
||||
-nr="": regex for type name to exclude
|
||||
-rt="": tags for go run
|
||||
-t="": build tag to put in file
|
||||
-u=false: Use unsafe, e.g. to avoid unnecessary allocation on []byte->string
|
||||
|
||||
7
vendor/github.com/ugorji/go/codec/codecgen/gen.go
generated
vendored
7
vendor/github.com/ugorji/go/codec/codecgen/gen.go
generated
vendored
@@ -82,7 +82,7 @@ func CodecGenTempWrite{{ .RandString }}() {
|
||||
// fout contains Codec(En|De)codeSelf implementations for every type T.
|
||||
//
|
||||
func Generate(outfile, buildTag, codecPkgPath string, uid int64, useUnsafe bool, goRunTag string,
|
||||
st string, regexName *regexp.Regexp, deleteTempFile bool, infiles ...string) (err error) {
|
||||
st string, regexName *regexp.Regexp, notRegexName *regexp.Regexp, deleteTempFile bool, infiles ...string) (err error) {
|
||||
// For each file, grab AST, find each type, and write a call to it.
|
||||
if len(infiles) == 0 {
|
||||
return
|
||||
@@ -180,7 +180,7 @@ func Generate(outfile, buildTag, codecPkgPath string, uid int64, useUnsafe bool,
|
||||
// FuncType, InterfaceType, StarExpr (ptr), etc
|
||||
switch td.Type.(type) {
|
||||
case *ast.StructType, *ast.Ident, *ast.MapType, *ast.ArrayType, *ast.ChanType:
|
||||
if regexName.FindStringIndex(td.Name.Name) != nil {
|
||||
if regexName.FindStringIndex(td.Name.Name) != nil && notRegexName.FindStringIndex(td.Name.Name) == nil {
|
||||
tv.Types = append(tv.Types, td.Name.Name)
|
||||
}
|
||||
}
|
||||
@@ -259,6 +259,7 @@ func main() {
|
||||
c := flag.String("c", genCodecPath, "codec path")
|
||||
t := flag.String("t", "", "build tag to put in file")
|
||||
r := flag.String("r", ".*", "regex for type name to match")
|
||||
nr := flag.String("nr", "^$", "regex for type name to exclude")
|
||||
rt := flag.String("rt", "", "tags for go run")
|
||||
st := flag.String("st", "codec,json", "struct tag keys to introspect")
|
||||
x := flag.Bool("x", false, "keep temp file")
|
||||
@@ -266,7 +267,7 @@ func main() {
|
||||
d := flag.Int64("d", 0, "random identifier for use in generated code")
|
||||
flag.Parse()
|
||||
if err := Generate(*o, *t, *c, *d, *u, *rt, *st,
|
||||
regexp.MustCompile(*r), !*x, flag.Args()...); err != nil {
|
||||
regexp.MustCompile(*r), regexp.MustCompile(*nr), !*x, flag.Args()...); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "codecgen error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
8
vendor/github.com/ugorji/go/codec/gen.go
generated
vendored
8
vendor/github.com/ugorji/go/codec/gen.go
generated
vendored
@@ -12,7 +12,6 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"sort"
|
||||
@@ -126,6 +125,7 @@ var (
|
||||
genExpectArrayOrMapErr = errors.New("unexpected type. Expecting array/map/slice")
|
||||
genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__")
|
||||
genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`)
|
||||
genCheckVendor bool
|
||||
)
|
||||
|
||||
// genRunner holds some state used during a Gen run.
|
||||
@@ -1626,8 +1626,6 @@ func (x *genV) MethodNamePfx(prefix string, prim bool) string {
|
||||
|
||||
}
|
||||
|
||||
var genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
|
||||
|
||||
// genImportPath returns import path of a non-predeclared named typed, or an empty string otherwise.
|
||||
//
|
||||
// This handles the misbehaviour that occurs when 1.5-style vendoring is enabled,
|
||||
@@ -1678,7 +1676,7 @@ func genNonPtr(t reflect.Type) reflect.Type {
|
||||
|
||||
func genTitleCaseName(s string) string {
|
||||
switch s {
|
||||
case "interface{}":
|
||||
case "interface{}", "interface {}":
|
||||
return "Intf"
|
||||
default:
|
||||
return strings.ToUpper(s[0:1]) + s[1:]
|
||||
@@ -1781,7 +1779,7 @@ func (x genInternal) FastpathLen() (l int) {
|
||||
|
||||
func genInternalZeroValue(s string) string {
|
||||
switch s {
|
||||
case "interface{}":
|
||||
case "interface{}", "interface {}":
|
||||
return "nil"
|
||||
case "bool":
|
||||
return "false"
|
||||
|
||||
12
vendor/github.com/ugorji/go/codec/gen_15.go
generated
vendored
Normal file
12
vendor/github.com/ugorji/go/codec/gen_15.go
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license found in the LICENSE file.
|
||||
|
||||
// +build go1.5,!go1.6
|
||||
|
||||
package codec
|
||||
|
||||
import "os"
|
||||
|
||||
func init() {
|
||||
genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
|
||||
}
|
||||
12
vendor/github.com/ugorji/go/codec/gen_16.go
generated
vendored
Normal file
12
vendor/github.com/ugorji/go/codec/gen_16.go
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license found in the LICENSE file.
|
||||
|
||||
// +build go1.6
|
||||
|
||||
package codec
|
||||
|
||||
import "os"
|
||||
|
||||
func init() {
|
||||
genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0"
|
||||
}
|
||||
Reference in New Issue
Block a user