Skip to content

Commit

Permalink
Fix issue with path as directory while using pbuf native vendoring (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
aatarasoff authored Nov 15, 2023
1 parent 7a8425b commit cb9ff02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 183 deletions.
7 changes: 5 additions & 2 deletions internal/registry/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ func VendorRegistryModule(module *model.Module, client v1.RegistryClient) error
outputPath := module.OutputFolder

if module.Path != "" {
modulePath := filepath.Dir(module.Path)
modulePath := module.Path

if strings.HasSuffix(module.Path, ".proto") {
// skip if the file is not in the module path
if originalFilename != module.Path {
continue
}

// get directory
modulePath = filepath.Dir(module.Path)
} else {
// skip if the file is not in the module path
if !strings.HasPrefix(originalFilename, modulePath) {
Expand All @@ -50,7 +53,7 @@ func VendorRegistryModule(module *model.Module, client v1.RegistryClient) error
}

if outputPath != "" {
originalFilename = strings.Replace(originalFilename, filepath.Dir(module.Path), outputPath, 1)
originalFilename = strings.Replace(originalFilename, modulePath, outputPath, 1)
}
} else {
if outputPath != "" {
Expand Down
2 changes: 1 addition & 1 deletion pbuf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modules:
- name: pbufio/pbuf-registry
tag: v0.2.0
path: api/pbuf-registry
out: third_party
out: third_party/pbuf-registry
- name: googleapis
repository: https://github.com/googleapis/googleapis
path: google/api
Expand Down
180 changes: 0 additions & 180 deletions third_party/api/v1/registry.proto

This file was deleted.

0 comments on commit cb9ff02

Please sign in to comment.