Skip to content

Implement Google Cloud Storage (GCS) module#46

Merged
intel352 merged 5 commits intomainfrom
copilot/implement-gcs-storage-functionality
Feb 22, 2026
Merged

Implement Google Cloud Storage (GCS) module#46
intel352 merged 5 commits intomainfrom
copilot/implement-gcs-storage-functionality

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 22, 2026

module/storage_gcs.go was a registered storage.gcs module type that returned "GCS storage not yet implemented" on every operation, making it unusable at runtime.

Changes

module/storage_gcs.go

  • Added *storage.Client field; wired up real GCS SDK (cloud.google.com/go/storage)
  • Start(): calls storage.NewClient(); supports explicit service account credentials via credentialsFile (using non-deprecated option.WithAuthCredentialsFile(option.ServiceAccount, ...)) or falls back to Application Default Credentials
  • Stop(): closes the client; safe to call before Start()
  • List(): iterates bucket.Objects() with prefix filter
  • Get(): returns io.ReadCloser via object.NewReader()
  • Put(): streams from io.Reader via object.NewWriter() + io.Copy
  • Delete(): delegates to object.Delete()
  • Stat(): maps object.Attrs()store.FileInfo (name, size, modified time)
  • MkdirAll(): no-op (object storage has no directories)
  • All methods return "GCS client not initialized; call Start first" when called before Start()
  • Removed (stub) from the Start() log message

module/storage_gcs_test.go

New test file mirroring s3_storage_test.go:

  • Name(), Init(), ProvidesServices(), RequiresServices()
  • Config setters (SetBucket, SetProject, SetCredentialsFile)
  • All storage operations return errors without an initialized client
  • Stop() without Start() is safe
  • MkdirAll() is a no-op

go.mod / go.sum

Added cloud.google.com/go/storage v1.60.0.

Original prompt

Problem

The module/storage_gcs.go file is listed as a supported module type (storage.gcs) in the README and example docs, but every operation returns fmt.Errorf("GCS storage not yet implemented"). The Start() method logs "GCS storage started (stub)". This means any user configuring storage.gcs in their workflow YAML will get runtime errors on every operation.

Current State

// module/storage_gcs.go
func (g *GCSStorage) List(_ context.Context, _ string) ([]store.FileInfo, error) {
    return nil, fmt.Errorf("GCS storage not yet implemented")
}
func (g *GCSStorage) Get(_ context.Context, _ string) (io.ReadCloser, error) {
    return nil, fmt.Errorf("GCS storage not yet implemented")
}
func (g *GCSStorage) Put(_ context.Context, _ string, _ io.Reader) error {
    return fmt.Errorf("GCS storage not yet implemented")
}
func (g *GCSStorage) Delete(_ context.Context, _ string) error {
    return fmt.Errorf("GCS storage not yet implemented")
}
func (g *GCSStorage) Stat(_ context.Context, _ string) (store.FileInfo, error) {
    return store.FileInfo{}, fmt.Errorf("GCS storage not yet implemented")
}

Requirements

  1. Add the Google Cloud Storage SDK dependency (cloud.google.com/go/storage).
  2. Implement all StorageProvider methods in module/storage_gcs.go:
    • Start(): Initialize the GCS client using storage.NewClient(). Support credentials from credentialsFile field or Application Default Credentials.
    • Stop(): Close the GCS client.
    • List(ctx, prefix): Use bucket.Objects() iterator to list objects with the given prefix, return []store.FileInfo.
    • Get(ctx, key): Use object.NewReader() to return an io.ReadCloser.
    • Put(ctx, key, reader): Use object.NewWriter() to upload from io.Reader.
    • Delete(ctx, key): Use object.Delete().
    • Stat(ctx, key): Use object.Attrs() to return store.FileInfo with name, size, and modified time.
  3. Follow the pattern established by module/s3_storage.go for structure and error handling.
  4. Write tests in module/storage_gcs_test.go following the pattern in module/s3_storage_test.go:
    • Test Name(), Init(), ProvidesServices(), RequiresServices()
    • Test config setters (SetBucket, SetProject, SetCredentialsFile)
    • Test operations fail gracefully without initialized client
    • Test Stop() is safe to call without Start()
  5. Ensure all existing tests pass (go test ./...).
  6. Remove the (stub) label from the Start() log message.

This pull request was created from Copilot chat.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits February 22, 2026 19:30
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement GCS storage functionality in storage module Implement Google Cloud Storage (GCS) module Feb 22, 2026
Copilot AI requested a review from intel352 February 22, 2026 19:38
@intel352 intel352 marked this pull request as ready for review February 22, 2026 19:55
@intel352 intel352 merged commit 40dccfa into main Feb 22, 2026
14 checks passed
@intel352 intel352 deleted the copilot/implement-gcs-storage-functionality branch February 22, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants