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
f1248b9c
Commit
f1248b9c
authored
Mar 04, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate to new conversion generator
parent
a690c2ca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
7 deletions
+49
-7
conversion.go
cmd/libs/go2idl/conversion-gen/generators/conversion.go
+0
-0
main.go
cmd/libs/go2idl/conversion-gen/main.go
+47
-0
deepcopy.go
cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go
+2
-7
No files found.
cmd/libs/go2idl/conversion-gen/generators/conversion.go
0 → 100644
View file @
f1248b9c
This diff is collapsed.
Click to expand it.
cmd/libs/go2idl/conversion-gen/main.go
0 → 100644
View file @
f1248b9c
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// conversion-gen is a tool for auto-generating Conversion functions.
//
// Structs in the input directories with the below line in their comments
// will be ignored during generation.
// // +genconversion=false
package
main
import
(
"k8s.io/kubernetes/cmd/libs/go2idl/args"
"k8s.io/kubernetes/cmd/libs/go2idl/conversion-gen/generators"
"github.com/golang/glog"
)
func
main
()
{
arguments
:=
args
.
Default
()
// Override defaults. These are Kubernetes specific input locations.
arguments
.
InputDirs
=
[]
string
{
"k8s.io/kubernetes/pkg/api/v1"
,
}
if
err
:=
arguments
.
Execute
(
generators
.
NameSystems
(),
generators
.
DefaultNameSystem
(),
generators
.
Packages
,
);
err
!=
nil
{
glog
.
Fatalf
(
"Error: %v"
,
err
)
}
glog
.
Info
(
"Completed successfully."
)
}
cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go
View file @
f1248b9c
...
...
@@ -95,10 +95,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
return
generators
},
FilterFunc
:
func
(
c
*
generator
.
Context
,
t
*
types
.
Type
)
bool
{
if
t
.
Name
.
Package
!=
path
{
return
false
}
return
copyableWithinPackage
(
t
)
return
t
.
Name
.
Package
==
path
},
})
}
...
...
@@ -111,7 +108,7 @@ const (
conversionPackagePath
=
"k8s.io/kubernetes/pkg/conversion"
)
// genDeepCopy produces a file with a
set for a single type
.
// genDeepCopy produces a file with a
utogenerated deep-copy functions
.
type
genDeepCopy
struct
{
generator
.
DefaultGen
targetPackage
string
...
...
@@ -137,7 +134,6 @@ func (g *genDeepCopy) Namers(c *generator.Context) namer.NameSystems {
return
namer
.
NameSystems
{
"raw"
:
namer
.
NewRawNamer
(
g
.
targetPackage
,
g
.
imports
)}
}
// Filter ignores all but one type because we're making a single file per type.
func
(
g
*
genDeepCopy
)
Filter
(
c
*
generator
.
Context
,
t
*
types
.
Type
)
bool
{
// Filter out all types not copyable within the package.
copyable
:=
copyableWithinPackage
(
t
)
...
...
@@ -231,7 +227,6 @@ func (g *genDeepCopy) Init(c *generator.Context, w io.Writer) error {
return
sw
.
Error
()
}
// GenerateType makes the body of a file implementing a set for type t.
func
(
g
*
genDeepCopy
)
GenerateType
(
c
*
generator
.
Context
,
t
*
types
.
Type
,
w
io
.
Writer
)
error
{
sw
:=
generator
.
NewSnippetWriter
(
w
,
c
,
"$"
,
"$"
)
funcName
:=
g
.
funcNameTmpl
(
t
)
...
...
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