-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(internal/gengapic): write snippet output to cloud.google.com/go #1313
Conversation
* Write snippets at the top level of the google-cloud-go namespace.
Draft, pending manual testing with OwlBot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome change, love the helper method.
func (g *generator) snippetsOutDir() string { | ||
if strings.Contains(g.opts.pkgPath, "cloud.google.com/go/") { | ||
// Write snippet metadata at the top level of the google-cloud-go namespace, not at the client package. | ||
// This matches the destination directory structure in google-cloud-go. | ||
pkg := strings.TrimPrefix(g.opts.pkgPath, "cloud.google.com/go/") | ||
return filepath.Join("cloud.google.com/go", "internal", "generated", "snippets", filepath.FromSlash(pkg)) | ||
} | ||
return filepath.Join(g.opts.outDir, "internal", "snippets") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, Chris.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it!
deep-copy-regex
in.OwlBot.yaml
, both client files and snippets are copied to the correct destinations in google-cloud-go. (deep-remove-regex
will also need to be updated to remove deleted snippets.)Results from `bazelisk build //google/cloud/asset/v1:gapi-cloud-asset-v1-go`
Results from `docker run --rm --user$(id -u):$ (id -g) -v $GOOGLE_CLOUD_GO:/repo -v $GOOGLEAPIS/bazel-bin:/bazel-bin gcr.io/cloud-devrel-public-resources/owlbot-cli:latest copy-bazel-bin --config-file=.github/.OwlBot.yaml --source-dir /bazel-bin --dest /repo`