From 493dc022abfe1ad4e6aefd04441336d42c2046a4 Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Tue, 9 Apr 2019 13:34:31 +0100 Subject: [PATCH] vendor: dep ensure -update k8s.io/gengo Pickup glog => klog switch. --- Gopkg.lock | 4 +- vendor/k8s.io/gengo/.import-restrictions | 3 +- vendor/k8s.io/gengo/.travis.yml | 2 +- vendor/k8s.io/gengo/SECURITY_CONTACTS | 4 +- .../deepcopy-gen/generators/deepcopy.go | 113 ++++++++++-------- .../gengo/examples/deepcopy-gen/main.go | 9 +- .../defaulter-gen/.import-restrictions | 1 + .../defaulter-gen/generators/defaulter.go | 38 +++--- .../gengo/examples/defaulter-gen/main.go | 7 +- .../import-boss/generators/import_restrict.go | 32 +++-- .../k8s.io/gengo/examples/import-boss/main.go | 7 +- .../gengo/examples/set-gen/generators/sets.go | 6 +- .../gengo/examples/set-gen/generators/tags.go | 4 +- vendor/k8s.io/gengo/examples/set-gen/main.go | 7 +- vendor/k8s.io/gengo/generator/execute.go | 8 +- .../k8s.io/gengo/generator/import_tracker.go | 4 +- vendor/k8s.io/gengo/parser/parse.go | 44 +++---- vendor/k8s.io/gengo/types/types.go | 4 +- 18 files changed, 170 insertions(+), 127 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index f7f87ad023..632aeb52b1 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1106,7 +1106,7 @@ [[projects]] branch = "master" - digest = "1:f90b6152db4c5ee920eda292be42f4103498429d4238ea3e4003972b0dc5cfdd" + digest = "1:06449c9193d3d1f9375b97d1ce8a3f7a59d531c69ca34a6b0663cf3c144c2178" name = "k8s.io/gengo" packages = [ "args", @@ -1118,7 +1118,7 @@ "types", ] pruneopts = "T" - revision = "7338e4bfd6915369a1375890db1bbda0158c9863" + revision = "e17681d19d3ac4837a019ece36c2a0ec31ffe985" [[projects]] digest = "1:7a3ef99d492d30157b8e933624a8f0292b4cee5934c23269f7640c8030eb83cd" diff --git a/vendor/k8s.io/gengo/.import-restrictions b/vendor/k8s.io/gengo/.import-restrictions index fd05377f08..b328e2e9c1 100644 --- a/vendor/k8s.io/gengo/.import-restrictions +++ b/vendor/k8s.io/gengo/.import-restrictions @@ -3,7 +3,8 @@ { "SelectorRegexp": "k8s[.]io", "AllowedPrefixes": [ - "k8s.io/gengo" + "k8s.io/gengo", + "k8s.io/klog" ] } ] diff --git a/vendor/k8s.io/gengo/.travis.yml b/vendor/k8s.io/gengo/.travis.yml index a0d74599a6..1fd593acee 100644 --- a/vendor/k8s.io/gengo/.travis.yml +++ b/vendor/k8s.io/gengo/.travis.yml @@ -9,7 +9,7 @@ jobs: include: - stage: Run tests script: - - find . -name vendor -prune -o -name Makefile -execdir make test \; + - find . -name vendor -prune -o -name Makefile -print | xargs -I% sh -c 'make -C $(dirname %) test' - go test -v ./... - stage: Verify examples script: diff --git a/vendor/k8s.io/gengo/SECURITY_CONTACTS b/vendor/k8s.io/gengo/SECURITY_CONTACTS index 3895fb7929..11143173b7 100644 --- a/vendor/k8s.io/gengo/SECURITY_CONTACTS +++ b/vendor/k8s.io/gengo/SECURITY_CONTACTS @@ -1,10 +1,10 @@ # Defined below are the security contacts for this repo. # -# They are the contact point for the Product Security Team to reach out +# They are the contact point for the Product Security Committee to reach out # to for triaging and handling of incoming issues. # # The below names agree to abide by the -# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) +# [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy) # and will be removed and replaced if they violate that agreement. # # DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE diff --git a/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go b/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go index dec7dcaf73..40f1306d5d 100644 --- a/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go +++ b/vendor/k8s.io/gengo/examples/deepcopy-gen/generators/deepcopy.go @@ -29,7 +29,7 @@ import ( "k8s.io/gengo/namer" "k8s.io/gengo/types" - "github.com/golang/glog" + "k8s.io/klog" ) // CustomArgs is used tby the go2idl framework to pass args specific to this @@ -40,33 +40,38 @@ type CustomArgs struct { // This is the comment tag that carries parameters for deep-copy generation. const ( - tagName = "k8s:deepcopy-gen" - interfacesTagName = tagName + ":interfaces" - interfacesNonPointerTagName = tagName + ":nonpointer-interfaces" // attach the DeepCopy methods to the + tagEnabledName = "k8s:deepcopy-gen" + interfacesTagName = tagEnabledName + ":interfaces" + interfacesNonPointerTagName = tagEnabledName + ":nonpointer-interfaces" // attach the DeepCopy methods to the ) // Known values for the comment tag. const tagValuePackage = "package" -// tagValue holds parameters from a tagName tag. -type tagValue struct { +// enabledTagValue holds parameters from a tagName tag. +type enabledTagValue struct { value string register bool } -func extractTag(comments []string) *tagValue { - tagVals := types.ExtractCommentTags("+", comments)[tagName] +func extractEnabledTypeTag(t *types.Type) *enabledTagValue { + comments := append(append([]string{}, t.SecondClosestCommentLines...), t.CommentLines...) + return extractEnabledTag(comments) +} + +func extractEnabledTag(comments []string) *enabledTagValue { + tagVals := types.ExtractCommentTags("+", comments)[tagEnabledName] if tagVals == nil { // No match for the tag. return nil } // If there are multiple values, abort. if len(tagVals) > 1 { - glog.Fatalf("Found %d %s tags: %q", len(tagVals), tagName, tagVals) + klog.Fatalf("Found %d %s tags: %q", len(tagVals), tagEnabledName, tagVals) } // If we got here we are returning something. - tag := &tagValue{} + tag := &enabledTagValue{} // Get the primary value. parts := strings.Split(tagVals[0], ",") @@ -89,7 +94,7 @@ func extractTag(comments []string) *tagValue { tag.register = true } default: - glog.Fatalf("Unsupported %s param: %q", tagName, parts[i]) + klog.Fatalf("Unsupported %s param: %q", tagEnabledName, parts[i]) } } return tag @@ -123,7 +128,7 @@ func DefaultNameSystem() string { func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { boilerplate, err := arguments.LoadGoBoilerplate() if err != nil { - glog.Fatalf("Failed loading boilerplate: %v", err) + klog.Fatalf("Failed loading boilerplate: %v", err) } inputs := sets.NewString(context.Inputs...) @@ -143,25 +148,25 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } for i := range inputs { - glog.V(5).Infof("Considering pkg %q", i) + klog.V(5).Infof("Considering pkg %q", i) pkg := context.Universe[i] if pkg == nil { // If the input had no Go files, for example. continue } - ptag := extractTag(pkg.Comments) + ptag := extractEnabledTag(pkg.Comments) ptagValue := "" ptagRegister := false if ptag != nil { ptagValue = ptag.value if ptagValue != tagValuePackage { - glog.Fatalf("Package %v: unsupported %s value: %q", i, tagName, ptagValue) + klog.Fatalf("Package %v: unsupported %s value: %q", i, tagEnabledName, ptagValue) } ptagRegister = ptag.register - glog.V(5).Infof(" tag.value: %q, tag.register: %t", ptagValue, ptagRegister) + klog.V(5).Infof(" tag.value: %q, tag.register: %t", ptagValue, ptagRegister) } else { - glog.V(5).Infof(" no tag") + klog.V(5).Infof(" no tag") } // If the pkg-scoped tag says to generate, we can skip scanning types. @@ -170,12 +175,12 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat // If the pkg-scoped tag did not exist, scan all types for one that // explicitly wants generation. for _, t := range pkg.Types { - glog.V(5).Infof(" considering type %q", t.Name.String()) - ttag := extractTag(t.CommentLines) + klog.V(5).Infof(" considering type %q", t.Name.String()) + ttag := extractEnabledTypeTag(t) if ttag != nil && ttag.value == "true" { - glog.V(5).Infof(" tag=true") + klog.V(5).Infof(" tag=true") if !copyableType(t) { - glog.Fatalf("Type %v requests deepcopy generation but is not copyable", t) + klog.Fatalf("Type %v requests deepcopy generation but is not copyable", t) } pkgNeedsGeneration = true break @@ -184,7 +189,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } if pkgNeedsGeneration { - glog.V(3).Infof("Package %q needs generation", i) + klog.V(3).Infof("Package %q needs generation", i) path := pkg.Path // if the source path is within a /vendor/ directory (for example, // k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1), allow @@ -254,7 +259,7 @@ func (g *genDeepCopy) Filter(c *generator.Context, t *types.Type) bool { // Filter out types not being processed or not copyable within the package. enabled := g.allTypes if !enabled { - ttag := extractTag(t.CommentLines) + ttag := extractEnabledTypeTag(t) if ttag != nil && ttag.value == "true" { enabled = true } @@ -263,10 +268,10 @@ func (g *genDeepCopy) Filter(c *generator.Context, t *types.Type) bool { return false } if !copyableType(t) { - glog.V(2).Infof("Type %v is not copyable", t) + klog.V(2).Infof("Type %v is not copyable", t) return false } - glog.V(4).Infof("Type %v is copyable", t) + klog.V(4).Infof("Type %v is copyable", t) g.typesForInit = append(g.typesForInit, t) return true } @@ -321,12 +326,12 @@ func deepCopyMethod(t *types.Type) (*types.Signature, error) { return f.Signature, nil } -// deepCopyMethodOrDie returns the signatrue of a DeepCopy method, nil or calls glog.Fatalf +// deepCopyMethodOrDie returns the signatrue of a DeepCopy method, nil or calls klog.Fatalf // if the type does not match. func deepCopyMethodOrDie(t *types.Type) *types.Signature { ret, err := deepCopyMethod(t) if err != nil { - glog.Fatal(err) + klog.Fatal(err) } return ret } @@ -367,12 +372,12 @@ func deepCopyIntoMethod(t *types.Type) (*types.Signature, error) { return f.Signature, nil } -// deepCopyIntoMethodOrDie returns the signature of a DeepCopyInto() method, nil or calls glog.Fatalf +// deepCopyIntoMethodOrDie returns the signature of a DeepCopyInto() method, nil or calls klog.Fatalf // if the type is wrong. func deepCopyIntoMethodOrDie(t *types.Type) *types.Signature { ret, err := deepCopyIntoMethod(t) if err != nil { - glog.Fatal(err) + klog.Fatal(err) } return ret } @@ -391,7 +396,7 @@ func isRootedUnder(pkg string, roots []string) bool { func copyableType(t *types.Type) bool { // If the type opts out of copy-generation, stop. - ttag := extractTag(t.CommentLines) + ttag := extractEnabledTypeTag(t) if ttag != nil && ttag.value == "false" { return false } @@ -460,29 +465,30 @@ func (g *genDeepCopy) Init(c *generator.Context, w io.Writer) error { } func (g *genDeepCopy) needsGeneration(t *types.Type) bool { - tag := extractTag(t.CommentLines) + tag := extractEnabledTypeTag(t) tv := "" if tag != nil { tv = tag.value if tv != "true" && tv != "false" { - glog.Fatalf("Type %v: unsupported %s value: %q", t, tagName, tag.value) + klog.Fatalf("Type %v: unsupported %s value: %q", t, tagEnabledName, tag.value) } } if g.allTypes && tv == "false" { // The whole package is being generated, but this type has opted out. - glog.V(5).Infof("Not generating for type %v because type opted out", t) + klog.V(5).Infof("Not generating for type %v because type opted out", t) return false } if !g.allTypes && tv != "true" { // The whole package is NOT being generated, and this type has NOT opted in. - glog.V(5).Infof("Not generating for type %v because type did not opt in", t) + klog.V(5).Infof("Not generating for type %v because type did not opt in", t) return false } return true } -func extractInterfacesTag(comments []string) []string { +func extractInterfacesTag(t *types.Type) []string { var result []string + comments := append(append([]string{}, t.SecondClosestCommentLines...), t.CommentLines...) values := types.ExtractCommentTags("+", comments)[interfacesTagName] for _, v := range values { if len(v) == 0 { @@ -499,7 +505,8 @@ func extractInterfacesTag(comments []string) []string { return result } -func extractNonPointerInterfaces(comments []string) (bool, error) { +func extractNonPointerInterfaces(t *types.Type) (bool, error) { + comments := append(append([]string{}, t.SecondClosestCommentLines...), t.CommentLines...) values := types.ExtractCommentTags("+", comments)[interfacesNonPointerTagName] if len(values) == 0 { return false, nil @@ -518,7 +525,7 @@ func (g *genDeepCopy) deepCopyableInterfacesInner(c *generator.Context, t *types return nil, nil } - intfs := extractInterfacesTag(append(t.SecondClosestCommentLines, t.CommentLines...)) + intfs := extractInterfacesTag(t) var ts []*types.Type for _, intf := range intfs { @@ -557,7 +564,7 @@ func (g *genDeepCopy) deepCopyableInterfaces(c *generator.Context, t *types.Type TypeSlice(result).Sort() // we need a stable sorting because it determines the order in generation - nonPointerReceiver, err := extractNonPointerInterfaces(append(t.SecondClosestCommentLines, t.CommentLines...)) + nonPointerReceiver, err := extractNonPointerInterfaces(t) if err != nil { return nil, false, err } @@ -576,7 +583,7 @@ func (g *genDeepCopy) GenerateType(c *generator.Context, t *types.Type, w io.Wri if !g.needsGeneration(t) { return nil } - glog.V(5).Infof("Generating deepcopy function for type %v", t) + klog.V(5).Infof("Generating deepcopy function for type %v", t) sw := generator.NewSnippetWriter(w, c, "$", "$") args := argsFromType(t) @@ -678,12 +685,12 @@ func (g *genDeepCopy) generateFor(t *types.Type, sw *generator.SnippetWriter) { f = g.doPointer case types.Interface: // interfaces are handled in-line in the other cases - glog.Fatalf("Hit an interface type %v. This should never happen.", t) + klog.Fatalf("Hit an interface type %v. This should never happen.", t) case types.Alias: // can never happen because we branch on the underlying type which is never an alias - glog.Fatalf("Hit an alias type %v. This should never happen.", t) + klog.Fatalf("Hit an alias type %v. This should never happen.", t) default: - glog.Fatalf("Hit an unsupported type %v.", t) + klog.Fatalf("Hit an unsupported type %v.", t) } f(t, sw) } @@ -711,7 +718,7 @@ func (g *genDeepCopy) doMap(t *types.Type, sw *generator.SnippetWriter) { } if !ut.Key.IsAssignable() { - glog.Fatalf("Hit an unsupported type %v.", uet) + klog.Fatalf("Hit an unsupported type %v for: %v", uet, t) } sw.Do("*out = make($.|raw$, len(*in))\n", t) @@ -738,6 +745,10 @@ func (g *genDeepCopy) doMap(t *types.Type, sw *generator.SnippetWriter) { case uet.IsAssignable(): sw.Do("(*out)[key] = val\n", nil) case uet.Kind == types.Interface: + // Note: do not generate code that won't compile as `DeepCopyinterface{}()` is not a valid function + if uet.Name.Name == "interface{}" { + klog.Fatalf("DeepCopy of %q is unsupported. Instead, use named interfaces with DeepCopy as one of the methods.", uet.Name.Name) + } sw.Do("if val == nil {(*out)[key]=nil} else {\n", nil) // Note: if t.Elem has been an alias "J" of an interface "I" in Go, we will see it // as kind Interface of name "J" here, i.e. generate val.DeepCopyJ(). The golang @@ -754,7 +765,7 @@ func (g *genDeepCopy) doMap(t *types.Type, sw *generator.SnippetWriter) { case uet.Kind == types.Struct: sw.Do("(*out)[key] = *val.DeepCopy()\n", uet) default: - glog.Fatalf("Hit an unsupported type %v.", uet) + klog.Fatalf("Hit an unsupported type %v for %v", uet, t) } sw.Do("}\n", nil) } @@ -786,6 +797,10 @@ func (g *genDeepCopy) doSlice(t *types.Type, sw *generator.SnippetWriter) { g.generateFor(ut.Elem, sw) sw.Do("}\n", nil) } else if uet.Kind == types.Interface { + // Note: do not generate code that won't compile as `DeepCopyinterface{}()` is not a valid function + if uet.Name.Name == "interface{}" { + klog.Fatalf("DeepCopy of %q is unsupported. Instead, use named interfaces with DeepCopy as one of the methods.", uet.Name.Name) + } sw.Do("if (*in)[i] != nil {\n", nil) // Note: if t.Elem has been an alias "J" of an interface "I" in Go, we will see it // as kind Interface of name "J" here, i.e. generate val.DeepCopyJ(). The golang @@ -795,7 +810,7 @@ func (g *genDeepCopy) doSlice(t *types.Type, sw *generator.SnippetWriter) { } else if uet.Kind == types.Struct { sw.Do("(*in)[i].DeepCopyInto(&(*out)[i])\n", nil) } else { - glog.Fatalf("Hit an unsupported type %v.", uet) + klog.Fatalf("Hit an unsupported type %v for %v", uet, t) } sw.Do("}\n", nil) } @@ -856,6 +871,10 @@ func (g *genDeepCopy) doStruct(t *types.Type, sw *generator.SnippetWriter) { sw.Do("in.$.name$.DeepCopyInto(&out.$.name$)\n", args) } case uft.Kind == types.Interface: + // Note: do not generate code that won't compile as `DeepCopyinterface{}()` is not a valid function + if uft.Name.Name == "interface{}" { + klog.Fatalf("DeepCopy of %q is unsupported. Instead, use named interfaces with DeepCopy as one of the methods.", uft.Name.Name) + } sw.Do("if in.$.name$ != nil {\n", args) // Note: if t.Elem has been an alias "J" of an interface "I" in Go, we will see it // as kind Interface of name "J" here, i.e. generate val.DeepCopyJ(). The golang @@ -863,7 +882,7 @@ func (g *genDeepCopy) doStruct(t *types.Type, sw *generator.SnippetWriter) { sw.Do(fmt.Sprintf("out.$.name$ = in.$.name$.DeepCopy%s()\n", uft.Name.Name), args) sw.Do("}\n", nil) default: - glog.Fatalf("Hit an unsupported type %v.", uft) + klog.Fatalf("Hit an unsupported type %v for %v, from %v", uft, ft, t) } } } @@ -900,6 +919,6 @@ func (g *genDeepCopy) doPointer(t *types.Type, sw *generator.SnippetWriter) { sw.Do("*out = new($.Elem|raw$)\n", ut) sw.Do("(*in).DeepCopyInto(*out)\n", nil) default: - glog.Fatalf("Hit an unsupported type %v.", uet) + klog.Fatalf("Hit an unsupported type %v for %v", uet, t) } } diff --git a/vendor/k8s.io/gengo/examples/deepcopy-gen/main.go b/vendor/k8s.io/gengo/examples/deepcopy-gen/main.go index 6c62dd78a4..99433fb78a 100644 --- a/vendor/k8s.io/gengo/examples/deepcopy-gen/main.go +++ b/vendor/k8s.io/gengo/examples/deepcopy-gen/main.go @@ -32,7 +32,7 @@ limitations under the License. // // All generation is governed by comment tags in the source. Any package may // request DeepCopy generation by including a comment in the file-comments of -// one file, of the form: +// a doc.go file, of the form: // // +k8s:deepcopy-gen=package // // DeepCopy functions can be generated for individual types, rather than the @@ -60,11 +60,12 @@ import ( "k8s.io/gengo/args" "k8s.io/gengo/examples/deepcopy-gen/generators" - "github.com/golang/glog" "github.com/spf13/pflag" + "k8s.io/klog" ) func main() { + klog.InitFlags(nil) arguments := args.Default() // Override defaults. @@ -82,7 +83,7 @@ func main() { generators.DefaultNameSystem(), generators.Packages, ); err != nil { - glog.Fatalf("Error: %v", err) + klog.Fatalf("Error: %v", err) } - glog.V(2).Info("Completed successfully.") + klog.V(2).Info("Completed successfully.") } diff --git a/vendor/k8s.io/gengo/examples/defaulter-gen/.import-restrictions b/vendor/k8s.io/gengo/examples/defaulter-gen/.import-restrictions index 7e69de1f82..51132205eb 100644 --- a/vendor/k8s.io/gengo/examples/defaulter-gen/.import-restrictions +++ b/vendor/k8s.io/gengo/examples/defaulter-gen/.import-restrictions @@ -4,6 +4,7 @@ "SelectorRegexp": "k8s[.]io", "AllowedPrefixes": [ "k8s.io/gengo", + "k8s.io/klog", "k8s.io/kubernetes/third_party/forked/golang", "k8s.io/apimachinery/pkg/runtime" ] diff --git a/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go b/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go index 6ab8676a24..7e3bc6b4b1 100644 --- a/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go +++ b/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go @@ -29,7 +29,7 @@ import ( "k8s.io/gengo/namer" "k8s.io/gengo/types" - "github.com/golang/glog" + "k8s.io/klog" ) // CustomArgs is used tby the go2idl framework to pass args specific to this @@ -117,11 +117,11 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package for _, f := range pkg.Functions { if f.Underlying == nil || f.Underlying.Kind != types.Func { - glog.Errorf("Malformed function: %#v", f) + klog.Errorf("Malformed function: %#v", f) continue } if f.Underlying.Signature == nil { - glog.Errorf("Function without signature: %#v", f) + klog.Errorf("Function without signature: %#v", f) continue } signature := f.Underlying.Signature @@ -156,7 +156,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package } v.base = f manualMap[key] = v - glog.V(6).Infof("found base defaulter function for %s from %s", key.Name, f.Name) + klog.V(6).Infof("found base defaulter function for %s from %s", key.Name, f.Name) // Is one of the additional defaulters - a top level defaulter on a type that is // also invoked. case strings.HasPrefix(f.Name.Name, buffer.String()+"_"): @@ -176,7 +176,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package } v.additional = append(v.additional, f) manualMap[key] = v - glog.V(6).Infof("found additional defaulter function for %s from %s", key.Name, f.Name) + klog.V(6).Infof("found additional defaulter function for %s from %s", key.Name, f.Name) } buffer.Reset() sw.Do("$.inType|objectdefaultfn$", args) @@ -189,7 +189,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package } v.object = f manualMap[key] = v - glog.V(6).Infof("found object defaulter function for %s from %s", key.Name, f.Name) + klog.V(6).Infof("found object defaulter function for %s from %s", key.Name, f.Name) } buffer.Reset() } @@ -198,7 +198,7 @@ func getManualDefaultingFunctions(context *generator.Context, pkg *types.Package func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages { boilerplate, err := arguments.LoadGoBoilerplate() if err != nil { - glog.Fatalf("Failed loading boilerplate: %v", err) + klog.Fatalf("Failed loading boilerplate: %v", err) } packages := generator.Packages{} @@ -214,7 +214,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat // We are generating defaults only for packages that are explicitly // passed as InputDir. for _, i := range context.Inputs { - glog.V(5).Infof("considering pkg %q", i) + klog.V(5).Infof("considering pkg %q", i) pkg := context.Universe[i] if pkg == nil { // If the input had no Go files, for example. @@ -248,7 +248,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat shouldCreateObjectDefaulterFn := func(t *types.Type) bool { if defaults, ok := existingDefaulters[t]; ok && defaults.object != nil { // A default generator is defined - glog.V(5).Infof(" an object defaulter already exists as %s", defaults.base.Name) + klog.V(5).Infof(" an object defaulter already exists as %s", defaults.base.Name) return false } // opt-out @@ -285,7 +285,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat var err error typesPkg, err = context.AddDirectory(filepath.Join(pkg.Path, inputTags[0])) if err != nil { - glog.Fatalf("cannot import package %s", inputTags[0]) + klog.Fatalf("cannot import package %s", inputTags[0]) } // update context.Order to the latest context.Universe orderer := namer.Orderer{Namer: namer.NewPublicNamer(1)} @@ -299,7 +299,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } if namer.IsPrivateGoName(t.Name.Name) { // We won't be able to convert to a private type. - glog.V(5).Infof(" found a type %v, but it is a private name", t) + klog.V(5).Infof(" found a type %v, but it is a private name", t) continue } @@ -338,7 +338,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat // prune any types that were not used for t, d := range newDefaulters { if d.object == nil { - glog.V(6).Infof("did not generate defaulter for %s because no child defaulters were registered", t.Name) + klog.V(6).Infof("did not generate defaulter for %s because no child defaulters were registered", t.Name) delete(newDefaulters, t) } } @@ -346,7 +346,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } if len(newDefaulters) == 0 { - glog.V(5).Infof("no defaulters in package %s", pkg.Name) + klog.V(5).Infof("no defaulters in package %s", pkg.Name) } path := pkg.Path @@ -421,7 +421,7 @@ func (c *callTreeForType) build(t *types.Type, root bool) *callNode { parent.call = append(parent.call, newDefaults.object) // if we will be generating the defaulter, it by definition is a covering // defaulter, so we halt recursion - glog.V(6).Infof("the defaulter %s will be generated as an object defaulter", t.Name) + klog.V(6).Infof("the defaulter %s will be generated as an object defaulter", t.Name) return parent case defaults.object != nil: @@ -434,7 +434,7 @@ func (c *callTreeForType) build(t *types.Type, root bool) *callNode { // if the base function indicates it "covers" (it already includes defaulters) // we can halt recursion if checkTag(defaults.base.CommentLines, "covers") { - glog.V(6).Infof("the defaulter %s indicates it covers all sub generators", t.Name) + klog.V(6).Infof("the defaulter %s indicates it covers all sub generators", t.Name) return parent } } @@ -496,7 +496,7 @@ func (c *callTreeForType) build(t *types.Type, root bool) *callNode { } } if len(parent.children) == 0 && len(parent.call) == 0 { - //glog.V(6).Infof("decided type %s needs no generation", t.Name) + //klog.V(6).Infof("decided type %s needs no generation", t.Name) return nil } return parent @@ -596,11 +596,11 @@ func (g *genDefaulter) GenerateType(c *generator.Context, t *types.Type, w io.Wr return nil } - glog.V(5).Infof("generating for type %v", t) + klog.V(5).Infof("generating for type %v", t) callTree := newCallTreeForType(g.existingDefaulters, g.newDefaulters).build(t, true) if callTree == nil { - glog.V(5).Infof(" no defaulters defined") + klog.V(5).Infof(" no defaulters defined") return nil } i := 0 @@ -609,7 +609,7 @@ func (g *genDefaulter) GenerateType(c *generator.Context, t *types.Type, w io.Wr return } path := callPath(append(ancestors, current)) - glog.V(5).Infof(" %d: %s", i, path) + klog.V(5).Infof(" %d: %s", i, path) i++ }) diff --git a/vendor/k8s.io/gengo/examples/defaulter-gen/main.go b/vendor/k8s.io/gengo/examples/defaulter-gen/main.go index 822ec4c5b9..fcfdcb54f4 100644 --- a/vendor/k8s.io/gengo/examples/defaulter-gen/main.go +++ b/vendor/k8s.io/gengo/examples/defaulter-gen/main.go @@ -45,11 +45,12 @@ import ( "k8s.io/gengo/args" "k8s.io/gengo/examples/defaulter-gen/generators" - "github.com/golang/glog" "github.com/spf13/pflag" + "k8s.io/klog" ) func main() { + klog.InitFlags(nil) arguments := args.Default() // Override defaults. @@ -69,7 +70,7 @@ func main() { generators.DefaultNameSystem(), generators.Packages, ); err != nil { - glog.Fatalf("Error: %v", err) + klog.Fatalf("Error: %v", err) } - glog.V(2).Info("Completed successfully.") + klog.V(2).Info("Completed successfully.") } diff --git a/vendor/k8s.io/gengo/examples/import-boss/generators/import_restrict.go b/vendor/k8s.io/gengo/examples/import-boss/generators/import_restrict.go index 7ed7c33a78..ea5716b6ce 100644 --- a/vendor/k8s.io/gengo/examples/import-boss/generators/import_restrict.go +++ b/vendor/k8s.io/gengo/examples/import-boss/generators/import_restrict.go @@ -19,6 +19,7 @@ package generators import ( "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -33,7 +34,7 @@ import ( "k8s.io/gengo/namer" "k8s.io/gengo/types" - "github.com/golang/glog" + "k8s.io/klog" ) const ( @@ -196,37 +197,54 @@ func (importRuleFile) VerifyFile(f *generator.File, path string) error { return nil } + forbiddenImports := map[string]string{} + allowedMismatchedImports := []string{} for _, r := range rules.Rules { re, err := regexp.Compile(r.SelectorRegexp) if err != nil { return fmt.Errorf("regexp `%s` in file %q doesn't compile: %v", r.SelectorRegexp, actualPath, err) } for v := range f.Imports { - glog.V(4).Infof("Checking %v matches %v: %v\n", r.SelectorRegexp, v, re.MatchString(v)) + klog.V(4).Infof("Checking %v matches %v: %v\n", r.SelectorRegexp, v, re.MatchString(v)) if !re.MatchString(v) { continue } for _, forbidden := range r.ForbiddenPrefixes { - glog.V(4).Infof("Checking %v against %v\n", v, forbidden) + klog.V(4).Infof("Checking %v against %v\n", v, forbidden) if strings.HasPrefix(v, forbidden) { - return fmt.Errorf("import %v has forbidden prefix %v", v, forbidden) + forbiddenImports[v] = forbidden } } found := false for _, allowed := range r.AllowedPrefixes { - glog.V(4).Infof("Checking %v against %v\n", v, allowed) + klog.V(4).Infof("Checking %v against %v\n", v, allowed) if strings.HasPrefix(v, allowed) { found = true break } } if !found { - return fmt.Errorf("import %v did not match any allowed prefix", v) + allowedMismatchedImports = append(allowedMismatchedImports, v) } } } + + if len(forbiddenImports) > 0 || len(allowedMismatchedImports) > 0 { + var errorBuilder strings.Builder + for i, f := range forbiddenImports { + fmt.Fprintf(&errorBuilder, "import %v has forbidden prefix %v\n", i, f) + } + if len(allowedMismatchedImports) > 0 { + sort.Sort(sort.StringSlice(allowedMismatchedImports)) + fmt.Fprintf(&errorBuilder, "the following imports did not match any allowed prefix:\n") + for _, i := range allowedMismatchedImports { + fmt.Fprintf(&errorBuilder, " %v\n", i) + } + } + return errors.New(errorBuilder.String()) + } if len(rules.Rules) > 0 { - glog.V(2).Infof("%v passes rules found in %v\n", path, actualPath) + klog.V(2).Infof("%v passes rules found in %v\n", path, actualPath) } return nil diff --git a/vendor/k8s.io/gengo/examples/import-boss/main.go b/vendor/k8s.io/gengo/examples/import-boss/main.go index 7d0ba942f8..44b0d63eeb 100644 --- a/vendor/k8s.io/gengo/examples/import-boss/main.go +++ b/vendor/k8s.io/gengo/examples/import-boss/main.go @@ -61,18 +61,19 @@ import ( "k8s.io/gengo/args" "k8s.io/gengo/examples/import-boss/generators" - "github.com/golang/glog" + "k8s.io/klog" ) func main() { + klog.InitFlags(nil) arguments := args.Default() if err := arguments.Execute( generators.NameSystems(), generators.DefaultNameSystem(), generators.Packages, ); err != nil { - glog.Errorf("Error: %v", err) + klog.Errorf("Error: %v", err) os.Exit(1) } - glog.V(2).Info("Completed successfully.") + klog.V(2).Info("Completed successfully.") } diff --git a/vendor/k8s.io/gengo/examples/set-gen/generators/sets.go b/vendor/k8s.io/gengo/examples/set-gen/generators/sets.go index 8c5b4184ba..d0698d33cd 100644 --- a/vendor/k8s.io/gengo/examples/set-gen/generators/sets.go +++ b/vendor/k8s.io/gengo/examples/set-gen/generators/sets.go @@ -25,7 +25,7 @@ import ( "k8s.io/gengo/namer" "k8s.io/gengo/types" - "github.com/golang/glog" + "k8s.io/klog" ) // NameSystems returns the name system used by the generators in this package. @@ -47,13 +47,13 @@ func DefaultNameSystem() string { func Packages(_ *generator.Context, arguments *args.GeneratorArgs) generator.Packages { boilerplate, err := arguments.LoadGoBoilerplate() if err != nil { - glog.Fatalf("Failed loading boilerplate: %v", err) + klog.Fatalf("Failed loading boilerplate: %v", err) } return generator.Packages{&generator.DefaultPackage{ PackageName: "sets", PackagePath: arguments.OutputPackagePath, - HeaderText: boilerplate, + HeaderText: boilerplate, PackageDocumentation: []byte( `// Package sets has auto-generated set types. `), diff --git a/vendor/k8s.io/gengo/examples/set-gen/generators/tags.go b/vendor/k8s.io/gengo/examples/set-gen/generators/tags.go index 34aa77231f..bb3b4d2573 100644 --- a/vendor/k8s.io/gengo/examples/set-gen/generators/tags.go +++ b/vendor/k8s.io/gengo/examples/set-gen/generators/tags.go @@ -17,8 +17,8 @@ limitations under the License. package generators import ( - "github.com/golang/glog" "k8s.io/gengo/types" + "k8s.io/klog" ) // extractBoolTagOrDie gets the comment-tags for the key and asserts that, if @@ -27,7 +27,7 @@ import ( func extractBoolTagOrDie(key string, lines []string) bool { val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines) if err != nil { - glog.Fatalf(err.Error()) + klog.Fatalf(err.Error()) } return val } diff --git a/vendor/k8s.io/gengo/examples/set-gen/main.go b/vendor/k8s.io/gengo/examples/set-gen/main.go index 7efc8e6ae9..e93ea615fc 100644 --- a/vendor/k8s.io/gengo/examples/set-gen/main.go +++ b/vendor/k8s.io/gengo/examples/set-gen/main.go @@ -30,18 +30,19 @@ import ( "k8s.io/gengo/args" "k8s.io/gengo/examples/set-gen/generators" - "github.com/golang/glog" + "k8s.io/klog" ) func main() { + klog.InitFlags(nil) arguments := args.Default() if err := arguments.Execute( generators.NameSystems(), generators.DefaultNameSystem(), generators.Packages, ); err != nil { - glog.Errorf("Error: %v", err) + klog.Errorf("Error: %v", err) os.Exit(1) } - glog.V(2).Info("Completed successfully.") + klog.V(2).Info("Completed successfully.") } diff --git a/vendor/k8s.io/gengo/generator/execute.go b/vendor/k8s.io/gengo/generator/execute.go index 38dffff975..b5f5aaeb44 100644 --- a/vendor/k8s.io/gengo/generator/execute.go +++ b/vendor/k8s.io/gengo/generator/execute.go @@ -29,7 +29,7 @@ import ( "k8s.io/gengo/namer" "k8s.io/gengo/types" - "github.com/golang/glog" + "k8s.io/klog" ) func errs2strings(errors []error) []string { @@ -64,7 +64,7 @@ type DefaultFileType struct { } func (ft DefaultFileType) AssembleFile(f *File, pathname string) error { - glog.V(2).Infof("Assembling file %q", pathname) + klog.V(2).Infof("Assembling file %q", pathname) destFile, err := os.Create(pathname) if err != nil { return err @@ -91,7 +91,7 @@ func (ft DefaultFileType) AssembleFile(f *File, pathname string) error { } func (ft DefaultFileType) VerifyFile(f *File, pathname string) error { - glog.V(2).Infof("Verifying file %q", pathname) + klog.V(2).Infof("Verifying file %q", pathname) friendlyName := filepath.Join(f.PackageName, f.Name) b := &bytes.Buffer{} et := NewErrorTracker(b) @@ -214,7 +214,7 @@ func (c *Context) addNameSystems(namers namer.NameSystems) *Context { // import path already, this will be appended to 'outDir'. func (c *Context) ExecutePackage(outDir string, p Package) error { path := filepath.Join(outDir, p.Path()) - glog.V(2).Infof("Processing package %q, disk location %q", p.Name(), path) + klog.V(2).Infof("Processing package %q, disk location %q", p.Name(), path) // Filter out any types the *package* doesn't care about. packageContext := c.filteredBy(p.Filter) os.MkdirAll(path, 0755) diff --git a/vendor/k8s.io/gengo/generator/import_tracker.go b/vendor/k8s.io/gengo/generator/import_tracker.go index d4ba5e9073..5d058410ac 100644 --- a/vendor/k8s.io/gengo/generator/import_tracker.go +++ b/vendor/k8s.io/gengo/generator/import_tracker.go @@ -19,7 +19,7 @@ package generator import ( "strings" - "github.com/golang/glog" + "k8s.io/klog" "k8s.io/gengo/namer" "k8s.io/gengo/types" @@ -42,7 +42,7 @@ func golangTrackerLocalName(tracker namer.ImportTracker, t types.Name) string { // Using backslashes in package names causes gengo to produce Go code which // will not compile with the gc compiler. See the comment on GoSeperator. if strings.ContainsRune(path, '\\') { - glog.Warningf("Warning: backslash used in import path '%v', this is unsupported.\n", path) + klog.Warningf("Warning: backslash used in import path '%v', this is unsupported.\n", path) } dirs := strings.Split(path, namer.GoSeperator) diff --git a/vendor/k8s.io/gengo/parser/parse.go b/vendor/k8s.io/gengo/parser/parse.go index 7b043d716d..1c6c55019c 100644 --- a/vendor/k8s.io/gengo/parser/parse.go +++ b/vendor/k8s.io/gengo/parser/parse.go @@ -31,8 +31,8 @@ import ( "sort" "strings" - "github.com/golang/glog" "k8s.io/gengo/types" + "k8s.io/klog" ) // This clarifies when a pkg path has been canonicalized. @@ -89,7 +89,7 @@ func New() *Builder { // The returned string will have some/path/bin/go, so remove the last two elements. c.GOROOT = filepath.Dir(filepath.Dir(strings.Trim(string(p), "\n"))) } else { - glog.Warningf("Warning: $GOROOT not set, and unable to run `which go` to find it: %v\n", err) + klog.Warningf("Warning: $GOROOT not set, and unable to run `which go` to find it: %v\n", err) } } // Force this to off, since we don't properly parse CGo. All symbols must @@ -136,7 +136,7 @@ func (b *Builder) importBuildPackage(dir string) (*build.Package, error) { } // Remember it under the user-provided name. - glog.V(5).Infof("saving buildPackage %s", dir) + klog.V(5).Infof("saving buildPackage %s", dir) b.buildPackages[dir] = buildPkg canonicalPackage := canonicalizeImportPath(buildPkg.ImportPath) if dir != string(canonicalPackage) { @@ -145,7 +145,7 @@ func (b *Builder) importBuildPackage(dir string) (*build.Package, error) { return buildPkg, nil } // Must be new, save it under the canonical name, too. - glog.V(5).Infof("saving buildPackage %s", canonicalPackage) + klog.V(5).Infof("saving buildPackage %s", canonicalPackage) b.buildPackages[string(canonicalPackage)] = buildPkg } @@ -175,11 +175,11 @@ func (b *Builder) AddFileForTest(pkg string, path string, src []byte) error { func (b *Builder) addFile(pkgPath importPathString, path string, src []byte, userRequested bool) error { for _, p := range b.parsed[pkgPath] { if path == p.name { - glog.V(5).Infof("addFile %s %s already parsed, skipping", pkgPath, path) + klog.V(5).Infof("addFile %s %s already parsed, skipping", pkgPath, path) return nil } } - glog.V(6).Infof("addFile %s %s", pkgPath, path) + klog.V(6).Infof("addFile %s %s", pkgPath, path) p, err := parser.ParseFile(b.fset, path, src, parser.DeclarationErrors|parser.ParseComments) if err != nil { return err @@ -221,7 +221,7 @@ func (b *Builder) AddDir(dir string) error { func (b *Builder) AddDirRecursive(dir string) error { // Add the root. if _, err := b.importPackage(dir, true); err != nil { - glog.Warningf("Ignoring directory %v: %v", dir, err) + klog.Warningf("Ignoring directory %v: %v", dir, err) } // filepath.Walk includes the root dir, but we already did that, so we'll @@ -236,7 +236,7 @@ func (b *Builder) AddDirRecursive(dir string) error { // Add it. if _, err := b.importPackage(pkg, true); err != nil { - glog.Warningf("Ignoring child directory %v: %v", pkg, err) + klog.Warningf("Ignoring child directory %v: %v", pkg, err) } } } @@ -284,7 +284,7 @@ func (b *Builder) AddDirectoryTo(dir string, u *types.Universe) (*types.Package, // The implementation of AddDir. A flag indicates whether this directory was // user-requested or just from following the import graph. func (b *Builder) addDir(dir string, userRequested bool) error { - glog.V(5).Infof("addDir %s", dir) + klog.V(5).Infof("addDir %s", dir) buildPkg, err := b.importBuildPackage(dir) if err != nil { return err @@ -292,7 +292,7 @@ func (b *Builder) addDir(dir string, userRequested bool) error { canonicalPackage := canonicalizeImportPath(buildPkg.ImportPath) pkgPath := canonicalPackage if dir != string(canonicalPackage) { - glog.V(5).Infof("addDir %s, canonical path is %s", dir, pkgPath) + klog.V(5).Infof("addDir %s, canonical path is %s", dir, pkgPath) } // Sanity check the pkg dir has not changed. @@ -324,13 +324,13 @@ func (b *Builder) addDir(dir string, userRequested bool) error { // importPackage is a function that will be called by the type check package when it // needs to import a go package. 'path' is the import path. func (b *Builder) importPackage(dir string, userRequested bool) (*tc.Package, error) { - glog.V(5).Infof("importPackage %s", dir) + klog.V(5).Infof("importPackage %s", dir) var pkgPath = importPathString(dir) // Get the canonical path if we can. if buildPkg := b.buildPackages[dir]; buildPkg != nil { canonicalPackage := canonicalizeImportPath(buildPkg.ImportPath) - glog.V(5).Infof("importPackage %s, canonical path is %s", dir, canonicalPackage) + klog.V(5).Infof("importPackage %s, canonical path is %s", dir, canonicalPackage) pkgPath = canonicalPackage } @@ -349,7 +349,7 @@ func (b *Builder) importPackage(dir string, userRequested bool) (*tc.Package, er // Get the canonical path now that it has been added. if buildPkg := b.buildPackages[dir]; buildPkg != nil { canonicalPackage := canonicalizeImportPath(buildPkg.ImportPath) - glog.V(5).Infof("importPackage %s, canonical path is %s", dir, canonicalPackage) + klog.V(5).Infof("importPackage %s, canonical path is %s", dir, canonicalPackage) pkgPath = canonicalPackage } } @@ -365,9 +365,9 @@ func (b *Builder) importPackage(dir string, userRequested bool) (*tc.Package, er if err != nil { switch { case ignoreError && pkg != nil: - glog.V(2).Infof("type checking encountered some issues in %q, but ignoring.\n", pkgPath) + klog.V(2).Infof("type checking encountered some issues in %q, but ignoring.\n", pkgPath) case !ignoreError && pkg != nil: - glog.V(2).Infof("type checking encountered some errors in %q\n", pkgPath) + klog.V(2).Infof("type checking encountered some errors in %q\n", pkgPath) return nil, err default: return nil, err @@ -389,10 +389,10 @@ func (a importAdapter) Import(path string) (*tc.Package, error) { // errors, so you may check whether the package is nil or not even if you get // an error. func (b *Builder) typeCheckPackage(pkgPath importPathString) (*tc.Package, error) { - glog.V(5).Infof("typeCheckPackage %s", pkgPath) + klog.V(5).Infof("typeCheckPackage %s", pkgPath) if pkg, ok := b.typeCheckedPackages[pkgPath]; ok { if pkg != nil { - glog.V(6).Infof("typeCheckPackage %s already done", pkgPath) + klog.V(6).Infof("typeCheckPackage %s already done", pkgPath) return pkg, nil } // We store a nil right before starting work on a package. So @@ -403,7 +403,7 @@ func (b *Builder) typeCheckPackage(pkgPath importPathString) (*tc.Package, error } parsedFiles, ok := b.parsed[pkgPath] if !ok { - return nil, fmt.Errorf("No files for pkg %q: %#v", pkgPath, b.parsed) + return nil, fmt.Errorf("No files for pkg %q", pkgPath) } files := make([]*ast.File, len(parsedFiles)) for i := range parsedFiles { @@ -416,7 +416,7 @@ func (b *Builder) typeCheckPackage(pkgPath importPathString) (*tc.Package, error // method. So there can't be cycles in the import graph. Importer: importAdapter{b}, Error: func(err error) { - glog.V(2).Infof("type checker: %v\n", err) + klog.V(2).Infof("type checker: %v\n", err) }, } pkg, err := c.Check(string(pkgPath), b.fset, files, nil) @@ -469,7 +469,7 @@ func (b *Builder) FindTypes() (types.Universe, error) { // findTypesIn finalizes the package import and searches through the package // for types. func (b *Builder) findTypesIn(pkgPath importPathString, u *types.Universe) error { - glog.V(5).Infof("findTypesIn %s", pkgPath) + klog.V(5).Infof("findTypesIn %s", pkgPath) pkg := b.typeCheckedPackages[pkgPath] if pkg == nil { return fmt.Errorf("findTypesIn(%s): package is not known", pkgPath) @@ -479,7 +479,7 @@ func (b *Builder) findTypesIn(pkgPath importPathString, u *types.Universe) error // packages they asked for depend on will be included. // But we don't need to include all types in all // *packages* they depend on. - glog.V(5).Infof("findTypesIn %s: package is not user requested", pkgPath) + klog.V(5).Infof("findTypesIn %s: package is not user requested", pkgPath) return nil } @@ -775,7 +775,7 @@ func (b *Builder) walkType(u types.Universe, useName *types.Name, in tc.Type) *t return out } out.Kind = types.Unsupported - glog.Warningf("Making unsupported type entry %q for: %#v\n", out, t) + klog.Warningf("Making unsupported type entry %q for: %#v\n", out, t) return out } } diff --git a/vendor/k8s.io/gengo/types/types.go b/vendor/k8s.io/gengo/types/types.go index aa3b7128e9..ec25248e7e 100644 --- a/vendor/k8s.io/gengo/types/types.go +++ b/vendor/k8s.io/gengo/types/types.go @@ -51,10 +51,10 @@ func ParseFullyQualifiedName(fqn string) Name { cs := strings.Split(fqn, ".") pkg := "" if len(cs) > 1 { - pkg = strings.Join(cs[0:len(cs) - 1], ".") + pkg = strings.Join(cs[0:len(cs)-1], ".") } return Name{ - Name: cs[len(cs) - 1], + Name: cs[len(cs)-1], Package: pkg, } }