go-google-drive-client

A simple Go client for interacting with Google Drive using the Google Drive API (v3).
available operations
- create folder
- upload file
- update file
- download file
- get file by id
- delete file
- set permissions (for user, group, domain or to anyone)
It is important to mention that for GCP everything is a file, be it a regular file or a folder (which is called a drive). So whenever you see a fileId param, it can be either a regular file or a folder.
setup
Before using this client, you need to set up a Google Cloud Project and enable the Google Drive API. Follow these steps:
- Create a new project in the Google Cloud Console.
- Enable the Google Drive API for your project.
- Create credentials (service account key) for your project:
- Go to the "Credentials" page.
- Click "Create Credentials" and select "Service account key".
- Choose or create a new service account.
- Set the role to
Editor
or another role that grants the necessary permissions.
- Select JSON for the key type and download the file.
- Save the downloaded JSON.
For more detailed instructions, see the Google Drive API documentation.
examples
unit tests
make test
unit tests coverage
make coverage