mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-28 03:47:34 +00:00
Allow go2idl to generate non-Go file types
Remove some indentation from file generation for specific languages, allow SnippetWriter's io.Writer to be accessed, and add Path to types.Name for languages where Package and Path can be disjoint.
This commit is contained in:
@@ -175,7 +175,7 @@ type Blah struct {
|
||||
|
||||
_, u, o := construct(t, structTest, namer.NewPublicNamer(0))
|
||||
t.Logf("%#v", o)
|
||||
blahT := u.Get(types.Name{"base/foo/proto", "Blah"})
|
||||
blahT := u.Get(types.Name{Package: "base/foo/proto", Name: "Blah"})
|
||||
if blahT == nil {
|
||||
t.Fatal("type not found")
|
||||
}
|
||||
@@ -344,11 +344,11 @@ type Interface interface{Method(a, b string) (c, d string)}
|
||||
}
|
||||
|
||||
// Also do some one-off checks
|
||||
gtest := u.Get(types.Name{"g", "Test"})
|
||||
gtest := u.Get(types.Name{Package: "g", Name: "Test"})
|
||||
if e, a := 1, len(gtest.Methods); e != a {
|
||||
t.Errorf("expected %v but found %v methods: %#v", e, a, gtest)
|
||||
}
|
||||
iface := u.Get(types.Name{"g", "Interface"})
|
||||
iface := u.Get(types.Name{Package: "g", Name: "Interface"})
|
||||
if e, a := 1, len(iface.Methods); e != a {
|
||||
t.Errorf("expected %v but found %v methods: %#v", e, a, iface)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user