Renamed gengo SourcePath -> Dir

This commit is contained in:
Tim Hockin 2024-01-16 22:05:12 -08:00
parent 96b91f364a
commit 7a084b3352
No known key found for this signature in database
6 changed files with 8 additions and 8 deletions

View File

@ -325,7 +325,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
&generator.SimpleTarget{
PkgName: filepath.Base(pkg.Path),
PkgPath: pkg.Path,
PkgDir: pkg.SourcePath, // output pkg is the same as the input
PkgDir: pkg.Dir, // output pkg is the same as the input
HeaderComment: boilerplate,
FilterFunc: func(c *generator.Context, t *types.Type) bool {
return t.Name.Package == typesPkg.Path

View File

@ -189,7 +189,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
&generator.SimpleTarget{
PkgName: strings.Split(filepath.Base(pkg.Path), ".")[0],
PkgPath: pkg.Path,
PkgDir: pkg.SourcePath, // output pkg is the same as the input
PkgDir: pkg.Dir, // output pkg is the same as the input
HeaderComment: boilerplate,
FilterFunc: func(c *generator.Context, t *types.Type) bool {
return t.Name.Package == pkg.Path

View File

@ -419,7 +419,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
&generator.SimpleTarget{
PkgName: filepath.Base(pkg.Path),
PkgPath: pkg.Path,
PkgDir: pkg.SourcePath, // output pkg is the same as the input
PkgDir: pkg.Dir, // output pkg is the same as the input
HeaderComment: boilerplate,
FilterFunc: func(c *generator.Context, t *types.Type) bool {

View File

@ -182,7 +182,7 @@ func Run(g *Generator) {
log.Fatalf("BUG: can't find input modifiers for %q", input)
}
pkg := c.Universe[input]
protopkg := newProtobufPackage(pkg.Path, pkg.SourcePath, mod.name, mod.allTypes, omitTypes)
protopkg := newProtobufPackage(pkg.Path, pkg.Dir, mod.name, mod.allTypes, omitTypes)
header := append([]byte{}, boilerplate...)
header = append(header, protopkg.HeaderComment...)
protopkg.HeaderComment = header

View File

@ -230,7 +230,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
&generator.SimpleTarget{
PkgName: strings.Split(filepath.Base(pkg.Path), ".")[0],
PkgPath: pkg.Path,
PkgDir: pkg.SourcePath, // output pkg is the same as the input
PkgDir: pkg.Dir, // output pkg is the same as the input
HeaderComment: boilerplate,
FilterFunc: func(c *generator.Context, t *types.Type) bool {
return t.Name.Package == pkg.Path

View File

@ -63,7 +63,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
continue
}
registerFileName := "register.go"
searchPath := path.Join(pkg.SourcePath, registerFileName)
searchPath := path.Join(pkg.Dir, registerFileName)
if _, err := os.Stat(path.Join(searchPath)); err == nil {
klog.V(5).Infof("skipping the generation of %s file because %s already exists in the path %s", args.OutputFile, registerFileName, searchPath)
continue
@ -103,8 +103,8 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
targets = append(targets,
&generator.SimpleTarget{
PkgName: pkg.Name,
PkgPath: pkg.Path, // output to same pkg as input
PkgDir: pkg.SourcePath, // output to same pkg as input
PkgPath: pkg.Path, // output to same pkg as input
PkgDir: pkg.Dir, // output to same pkg as input
HeaderComment: boilerplate,
GeneratorsFunc: func(c *generator.Context) (generators []generator.Generator) {
return []generator.Generator{