Skip to content

Commit

Permalink
chore(internal/postprocessor): add MoveSnippets to main.go (#7523)
Browse files Browse the repository at this point in the history
* update OwlBot SHA
  • Loading branch information
quartzmo authored Apr 7, 2023
1 parent a6c6701 commit 7afc98a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-go:latest
digest: sha256:2793e9664b2ad41670c953aad7ea552d0da414f6a486edd10655ae2d7da72093
digest: sha256:33751ca85cc06cecb9ff2f6d7dc846e01664121d8842c9a7e45af649b02752e1
25 changes: 25 additions & 0 deletions internal/postprocessor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ func (p *postProcessor) run(ctx context.Context) error {
if err := p.InitializeNewModules(manifest); err != nil {
return err
}
if err := p.MoveSnippets(); err != nil {
return err
}
prTitle, prBody, err := p.GetNewPRTitleAndBody(ctx)
if err != nil {
return err
Expand Down Expand Up @@ -302,6 +305,28 @@ func (p *postProcessor) getDirs() []string {
return dirs
}

func (p *postProcessor) MoveSnippets() error {
log.Println("moving snippets")
dirs := p.getDirs()
for _, dir := range dirs {

snpDirs, err := filepath.Glob(filepath.Join(dir, "apiv*", "internal"))
if err != nil {
return err
}
for _, snpDir := range snpDirs {
// TODO(chrisdsmith): Move to correct location in google-cloud-go/internal/generated/snippets
// instead of deleting.
log.Printf("deleting snippets dir: %s", snpDir)
err = os.RemoveAll(snpDir)
if err != nil {
return err
}
}
}
return nil
}

func (p *postProcessor) TidyAffectedMods() error {
dirs := p.getDirs()
for _, dir := range dirs {
Expand Down

0 comments on commit 7afc98a

Please sign in to comment.