From d6bb4bdd5b1018a3f906b9586ae76932ab5e5d58 Mon Sep 17 00:00:00 2001 From: Joakim Tangnes Date: Fri, 1 Aug 2025 09:20:29 +0200 Subject: [PATCH] feat(types): add the raw id to the pubsub topic --- envconfig_test.go | 4 ++++ types/google.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/envconfig_test.go b/envconfig_test.go index 5b83321..2accda1 100644 --- a/envconfig_test.go +++ b/envconfig_test.go @@ -220,6 +220,10 @@ func TestProcess(t *testing.T) { t.Errorf("expected %q, got %q", u, s.UrlPointer.Value.String()) } + if s.GooglePubSubTopic.ID != "projects/project-id/topics/topic-id" { + t.Errorf("expected %s, got %s", "projects/project-id/topics/topic-id", s.GooglePubSubTopic.ID) + } + if s.GooglePubSubTopic.ProjectID != "project-id" { t.Errorf("expected %s, got %s", "project-id", s.GooglePubSubTopic.ProjectID) } diff --git a/types/google.go b/types/google.go index 0adc545..d027f3a 100644 --- a/types/google.go +++ b/types/google.go @@ -17,6 +17,7 @@ var ( ) type GooglePubSubTopic struct { + ID string // The raw ID passed ProjectID string TopicID string } @@ -27,6 +28,7 @@ func (pst *GooglePubSubTopic) Set(value string) error { return ErrInvalidGoogleTopicID } + pst.ID = value pst.ProjectID = m[1] pst.TopicID = m[2]