Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e1b46132
Commit
e1b46132
authored
Oct 06, 2017
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync(k8s.io/gengo): 70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
parent
4f00d3a6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
29 deletions
+55
-29
Godeps.json
Godeps/Godeps.json
+10
-10
args.go
vendor/k8s.io/gengo/args/args.go
+19
-8
parse.go
vendor/k8s.io/gengo/parser/parse.go
+26
-11
No files found.
Godeps/Godeps.json
View file @
e1b46132
...
...
@@ -3042,43 +3042,43 @@
},
{
"ImportPath"
:
"k8s.io/gengo/args"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/examples/deepcopy-gen/generators"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/examples/defaulter-gen/generators"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/examples/import-boss/generators"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/examples/set-gen/generators"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/examples/set-gen/sets"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/generator"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/namer"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/parser"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/gengo/types"
,
"Rev"
:
"
9e661e9308f078838e266cca1c673922088c0ea4
"
"Rev"
:
"
70ad626ed2d7a483d89d2c4c56364d60b48ee8fc
"
},
{
"ImportPath"
:
"k8s.io/heapster/metrics/api/v1/types"
,
...
...
vendor/k8s.io/gengo/args/args.go
View file @
e1b46132
...
...
@@ -39,13 +39,12 @@ import (
// Default returns a defaulted GeneratorArgs. You may change the defaults
// before calling AddFlags.
func
Default
()
*
GeneratorArgs
{
generatorArgs
:=
&
GeneratorArgs
{
OutputBase
:
DefaultSourceTree
(),
GoHeaderFilePath
:
filepath
.
Join
(
DefaultSourceTree
(),
"k8s.io/gengo/boilerplate/boilerplate.go.txt"
),
GeneratedBuildTag
:
"ignore_autogenerated"
,
return
&
GeneratorArgs
{
OutputBase
:
DefaultSourceTree
(),
GoHeaderFilePath
:
filepath
.
Join
(
DefaultSourceTree
(),
"k8s.io/gengo/boilerplate/boilerplate.go.txt"
),
GeneratedBuildTag
:
"ignore_autogenerated"
,
defaultCommandLineFlags
:
true
,
}
generatorArgs
.
AddFlags
(
pflag
.
CommandLine
)
return
generatorArgs
}
// GeneratorArgs has arguments that are passed to generators.
...
...
@@ -76,6 +75,15 @@ type GeneratorArgs struct {
// Any custom arguments go here
CustomArgs
interface
{}
// Whether to use default command line flags
defaultCommandLineFlags
bool
}
// WithoutDefaultFlagParsing disables implicit addition of command line flags and parsing.
func
(
g
*
GeneratorArgs
)
WithoutDefaultFlagParsing
()
*
GeneratorArgs
{
g
.
defaultCommandLineFlags
=
false
return
g
}
func
(
g
*
GeneratorArgs
)
AddFlags
(
fs
*
pflag
.
FlagSet
)
{
...
...
@@ -148,8 +156,11 @@ func DefaultSourceTree() string {
// If you don't need any non-default behavior, use as:
// args.Default().Execute(...)
func
(
g
*
GeneratorArgs
)
Execute
(
nameSystems
namer
.
NameSystems
,
defaultSystem
string
,
pkgs
func
(
*
generator
.
Context
,
*
GeneratorArgs
)
generator
.
Packages
)
error
{
pflag
.
CommandLine
.
AddGoFlagSet
(
goflag
.
CommandLine
)
pflag
.
Parse
()
if
g
.
defaultCommandLineFlags
{
g
.
AddFlags
(
pflag
.
CommandLine
)
pflag
.
CommandLine
.
AddGoFlagSet
(
goflag
.
CommandLine
)
pflag
.
Parse
()
}
b
,
err
:=
g
.
NewBuilder
()
if
err
!=
nil
{
...
...
vendor/k8s.io/gengo/parser/parse.go
View file @
e1b46132
...
...
@@ -27,6 +27,7 @@ import (
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
"github.com/golang/glog"
...
...
@@ -425,13 +426,20 @@ func (b *Builder) typeCheckPackage(pkgPath importPathString) (*tc.Package, error
// FindPackages fetches a list of the user-imported packages.
// Note that you need to call b.FindTypes() first.
func
(
b
*
Builder
)
FindPackages
()
[]
string
{
// Iterate packages in a predictable order.
pkgPaths
:=
[]
string
{}
for
k
:=
range
b
.
typeCheckedPackages
{
pkgPaths
=
append
(
pkgPaths
,
string
(
k
))
}
sort
.
Strings
(
pkgPaths
)
result
:=
[]
string
{}
for
pkgPath
:=
range
b
.
typeCheckedPackage
s
{
if
b
.
userRequested
[
pkgPath
]
{
for
_
,
pkgPath
:=
range
pkgPath
s
{
if
b
.
userRequested
[
importPathString
(
pkgPath
)
]
{
// Since walkType is recursive, all types that are in packages that
// were directly mentioned will be included. We don't need to
// include all types in all transitive packages, though.
result
=
append
(
result
,
string
(
pkgPath
)
)
result
=
append
(
result
,
pkgPath
)
}
}
return
result
...
...
@@ -440,16 +448,17 @@ func (b *Builder) FindPackages() []string {
// FindTypes finalizes the package imports, and searches through all the
// packages for types.
func
(
b
*
Builder
)
FindTypes
()
(
types
.
Universe
,
error
)
{
u
:=
types
.
Universe
{}
// Take a snapshot of pkgs to iterate, since this will recursively mutate
// b.parsed.
keys
:=
[]
importPathS
tring
{}
// b.parsed.
Iterate in a predictable order.
pkgPaths
:=
[]
s
tring
{}
for
pkgPath
:=
range
b
.
parsed
{
keys
=
append
(
keys
,
pkgPath
)
pkgPaths
=
append
(
pkgPaths
,
string
(
pkgPath
)
)
}
for
_
,
pkgPath
:=
range
keys
{
if
err
:=
b
.
findTypesIn
(
pkgPath
,
&
u
);
err
!=
nil
{
sort
.
Strings
(
pkgPaths
)
u
:=
types
.
Universe
{}
for
_
,
pkgPath
:=
range
pkgPaths
{
if
err
:=
b
.
findTypesIn
(
importPathString
(
pkgPath
),
&
u
);
err
!=
nil
{
return
nil
,
err
}
}
...
...
@@ -526,7 +535,13 @@ func (b *Builder) findTypesIn(pkgPath importPathString, u *types.Universe) error
b
.
addVariable
(
*
u
,
nil
,
tv
)
}
}
for
p
:=
range
b
.
importGraph
[
pkgPath
]
{
importedPkgs
:=
[]
string
{}
for
k
:=
range
b
.
importGraph
[
pkgPath
]
{
importedPkgs
=
append
(
importedPkgs
,
string
(
k
))
}
sort
.
Strings
(
importedPkgs
)
for
_
,
p
:=
range
importedPkgs
{
u
.
AddImports
(
string
(
pkgPath
),
p
)
}
return
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment