const GoSeperator … // Returns whether a name is a private Go name. func IsPrivateGoName(name string) bool { … } // NewPublicNamer is a helper function that returns a namer that makes // CamelCase names. See the NameStrategy struct for an explanation of the // arguments to this constructor. func NewPublicNamer(prependPackageNames int, ignoreWords ...string) *NameStrategy { … } // NewPrivateNamer is a helper function that returns a namer that makes // camelCase names. See the NameStrategy struct for an explanation of the // arguments to this constructor. func NewPrivateNamer(prependPackageNames int, ignoreWords ...string) *NameStrategy { … } // NewRawNamer will return a Namer that makes a name by which you would // directly refer to a type, optionally keeping track of the import paths // necessary to reference the names it provides. Tracker may be nil. // The 'pkg' is the full package name, in which the Namer is used - all // types from that package will be referenced by just type name without // referencing the package. // // For example, if the type is map[string]int, a raw namer will literally // return "map[string]int". // // Or if the type, in package foo, is "type Bar struct { ... }", then the raw // namer will return "foo.Bar" as the name of the type, and if 'tracker' was // not nil, will record that package foo needs to be imported. func NewRawNamer(pkg string, tracker ImportTracker) *rawNamer { … } type Names … type Namer … type NameSystems … type NameStrategy … // IC ensures the first character is uppercase. func IC(in string) string { … } // IL ensures the first character is lowercase. func IL(in string) string { … } // Joiner lets you specify functions that preprocess the various components of // a name before joining them. You can construct e.g. camelCase or CamelCase or // any other way of joining words. (See the IC and IL convenience functions.) func Joiner(first, others func(string) string) func(pre string, in []string, post string) string { … } func (ns *NameStrategy) removePrefixAndSuffix(s string) string { … } var importPathNameSanitizer … // filters out unwanted directory names and sanitizes remaining names. func (ns *NameStrategy) filterDirs(path string) []string { … } // See the comment on NameStrategy. func (ns *NameStrategy) Name(t *types.Type) string { … } type ImportTracker … type rawNamer … // Name makes a name the way you'd write it to literally refer to type t, // making ordinary assumptions about how you've imported t's package (or using // r.tracker to specifically track the package imports). func (r *rawNamer) Name(t *types.Type) string { … }