All Products
Search
Document Center

Object Storage Service:Introduction (Go SDK V1)

Last Updated:Nov 28, 2025

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

new_bucket.go

Initialize the client

create_bucket.go

Create a bucket (Go SDK V1)

bucket_acl.go

Manage bucket ACLs (Go SDK V1)

bucket_policy.go

Authorization policy

bucket_referer.go

Hotlink protection (Go SDK V1)

bucket_lifecycle.go

Lifecycle

bucket_logging.go

Access logging

bucket_cors.go

Cross-domain access

bucket_website.go

Static website hosting (mirroring-based back-to-origin) (Go SDK V1)

bucket_encryption.go

Server-side encryption (Go SDK V1)

bucket_requestpayment.go

Pay-by-requester mode (Go SDK V1)

bucket_inventory.go

Bucket inventory (Go SDK V1)

bucket_accessmonitor.go

Access tracking (Go SDK V1)

bucket_metaquery.go

Data indexing (Go SDK V1)

list_buckets.go

List buckets (Go SDK V1)

bucket_stat.go

Get bucket storage capacity (Go SDK V1)

bucket_tagging.go

Bucket tagging (Go SDK V1)

put_object.go

Upload files, including Simple upload (Go SDK V1) and Resumable upload (Go SDK V1)

append_object.go

Append upload

get_object.go

Download files, including Streaming download (Go SDK V1) and Conditional download (Go SDK V1)

delete_object.go

Delete a file (Go SDK V1)

copy_object.go

Copy a file (Go SDK V1)

list_objects.go

List files (Go SDK V1)

archive.go

Restore a file (Go SDK V1)

object_acl.go

Manage file ACLs

sign_url.go

Generate a signed URL

object_tagging.go

Object tagging

select_object.go

Query a file (Go SDK V1)

object_meta.go

Manage file metadata (Go SDK V1)

livechannel.go

Manage LiveChannels (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.