Posts

Showing posts with the label GoLang

Google Cloud Storage (GCS) + GoLang - File Upload, Download, List, and Delete Example

Image
To set up and use Google Cloud Storage in GoLang for uploading, listing, downloading, and deleting files, follow these steps: 1. Set Up Google Cloud Project Create a Google Cloud Project : Go to the Google Cloud Console . Create a new project or use an existing one. Enable Google Cloud Storage API : Navigate to APIs & Services > Library in the console. Search for "Cloud Storage" and enable it for your project. Create a Storage Bucket : Navigate to Storage > Browser in the console. Click Create Bucket , give it a unique name, choose a location, and configure other settings. Set Up a Service Account : Go to IAM & Admin > Service Accounts . Create a new service account with the Storage Admin role. Generate a key (JSON) and download it to your local machine. 2. Install the GoLang Google Cloud Storage Library Install the official library using go get : go get cloud.google. com / go /storage 3. Configure Authentication Set the GOOGLE_APPLICATION_CREDENTIALS e...