From e5c3f7a6473c5e35c6966967d8facd00eed31e7b Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Tue, 2 May 2023 10:58:12 -0500 Subject: [PATCH] chore: add exception or non service lib (#7866) This library does not contain services so it should not have a version file. We should find a better way to handle such cases in future if there are more of these. --- .github/.OwlBot.lock.yaml | 2 +- internal/postprocessor/main.go | 2 +- internal/postprocessor/main_test.go | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 5f724af3a4d2..a40020647477 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-go:latest - digest: sha256:8b4f6b8ecbd7fe80feb5c4449c0bca2abc6d2ecca0999120da23c4b1c90ca81d + digest: sha256:7f4378b2797923822b452565b346173e306e2587a75f0662437eaba12afd344f diff --git a/internal/postprocessor/main.go b/internal/postprocessor/main.go index 7025817412aa..c40117a9324d 100644 --- a/internal/postprocessor/main.go +++ b/internal/postprocessor/main.go @@ -250,7 +250,7 @@ func (p *postProcessor) generateModule(modPath, importPath string) error { func (p *postProcessor) generateVersionFile(moduleName, path string) error { // These directories are not modules on purpose, don't generate a version // file for them. - if strings.Contains(path, "debugger/apiv2") { + if strings.Contains(path, "debugger/apiv2") || strings.Contains(path, "orgpolicy/apiv1") { return nil } pathSegments := strings.Split(filepath.Dir(path), "/") diff --git a/internal/postprocessor/main_test.go b/internal/postprocessor/main_test.go index 6d09ec010ab0..cf603ea215e3 100644 --- a/internal/postprocessor/main_test.go +++ b/internal/postprocessor/main_test.go @@ -16,7 +16,6 @@ package main import ( "flag" - "io/ioutil" "log" "os" "path/filepath" @@ -143,13 +142,13 @@ func TestUpdateSnippetsMetadata(t *testing.T) { // Assert result and restore testdata f := filepath.FromSlash("testdata/internal/generated/snippets/video/stitcher/apiv1/snippet_metadata.google.cloud.video.stitcher.v1.json") - read, err := ioutil.ReadFile(f) + read, err := os.ReadFile(f) if err != nil { t.Fatal(err) } if strings.Contains(string(read), "3.45.6") { s := strings.Replace(string(read), "3.45.6", "$VERSION", 1) - err = ioutil.WriteFile(f, []byte(s), 0) + err = os.WriteFile(f, []byte(s), 0) if err != nil { t.Fatal(err) }