This topic provides sample code for various scenarios that use the Go SDK for Object Storage Service (OSS). The code is based on the V1 (aliyun-oss-go-sdk) code repository.
SDK source code and API documentation
Visit GitHub to obtain the OSS Go SDK source code. For more information, see the OSS Go SDK API documentation.
Sample programs
The OSS Go SDK provides a rich set of sample programs for your reference or direct use. The samples include the following:
Sample file | Sample content |
Static website hosting (mirroring-based back-to-origin) (Go SDK V1) | |
Upload files, including Simple upload (Go SDK V1) and Resumable upload (Go SDK V1) | |
Download files, including Streaming download (Go SDK V1) and Conditional download (Go SDK V1) | |
Learn about OSS Go SDK V2
The OSS Go SDK V2 (alibabacloud-oss-go-sdk-v2) is a major rewrite of the V1 (aliyun-oss-go-sdk) code repository. V2 is a completely new version built on Go 1.18 and later. It simplifies underlying operations such as identity verification, automatic request retries, and error handling. V2 also provides flexible parameter settings and advanced interfaces, such as paginators, transfer managers, and file-like interfaces. These features significantly improve developer efficiency and experience.
To get started with V2, see the alibabacloud-oss-go-sdk-v2 developer guide.
To upgrade from V1 to V2, see the migration guide.