Matthias Andreas Benkard | 832a54e | 2019-01-29 09:27:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2015 The Kubernetes Authors. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // Package namer has support for making different type naming systems. |
| 18 | // |
| 19 | // This is because sometimes you want to refer to the literal type, sometimes |
| 20 | // you want to make a name for the thing you're generating, and you want to |
| 21 | // make the name based on the type. For example, if you have `type foo string`, |
| 22 | // you want to be able to generate something like `func FooPrinter(f *foo) { |
| 23 | // Print(string(*f)) }`; that is, you want to refer to a public name, a literal |
| 24 | // name, and the underlying literal name. |
| 25 | // |
| 26 | // This package supports the idea of a "Namer" and a set of "NameSystems" to |
| 27 | // support these use cases. |
| 28 | // |
| 29 | // Additionally, a "RawNamer" can optionally keep track of what needs to be |
| 30 | // imported. |
| 31 | package namer // import "k8s.io/gengo/namer" |