Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xuxiaowei-com-cn/ct-oos-go

基于 Go 语言开发的 天翼云 对象存储(经典版)I型 脚手架
https://github.com/xuxiaowei-com-cn/ct-oos-go

cli ct go oos

Last synced: 5 days ago
JSON representation

基于 Go 语言开发的 天翼云 对象存储(经典版)I型 脚手架

Awesome Lists containing this project

README

        


ct-oos-go


基于 Go 语言开发的 天翼云 对象存储(经典版)I型 脚手架



License-Anti


Link-996


QQ群



企业微信群


基于 Go 语言开发的 天翼云 对象存储(经典版)I型 脚手架


为简化开发工作、提高生产率、解决常见问题而生


bilibili 粉丝


CSDN 码龄


CSDN 粉丝


CSDN 访问


CSDN 博客


IntelliJ IDEA


GitHub stars


GitHub forks


GitHub watchers


GitHub last commit


码云Gitee stars


码云Gitee forks


Gitlab stars


Gitlab forks


OSCS Status


total lines


code style

## 可执行程序

- Windows/Linux/Mac、x86/arm 可执行程序:https://github.com/xuxiaowei-com-cn/ct-oos-go/releases

## 开发命令

### get

```shell
go env -w GOPROXY=https://goproxy.cn,direct
# go env -w GOPROXY=https://mirrors.aliyun.com/goproxy,direct
go get -u github.com/urfave/cli/v2
go get -u github.com/xuxiaowei-com-cn/ct-oos-go-sdk
go get -u github.com/xuxiaowei-com-cn/git-go@main
go get -u gopkg.in/yaml.v3
```

### mod

```shell
go mod tidy
```

```shell
go mod download
```

### run

```shell
go run main.go
```

### run help

- Windows 环境为 %xxx%
- Linux 环境为 $xxx

```shell
go run main.go --help
```

```shell
$ go run main.go --help
NAME:
ct-oos-go - 基于 Go 语言开发的 天翼云 对象存储(经典版)I型 命令行工具

USAGE:
ct-oos-go [global options] command [command options] [arguments...]

VERSION:
dev

AUTHOR:
徐晓伟

COMMANDS:
bucket 桶
put 上传对象
upload 上传文件-分片
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version

COPYRIGHT:
徐晓伟工作室
```

- bucket

```shell
$ go run main.go bucket --help
NAME:
ct-oos-go bucket - 桶

USAGE:
ct-oos-go bucket command [command options] [arguments...]

COMMANDS:
get-location 获取 location bucket
help, h Shows a list of commands or help for one command

OPTIONS:
--access-key value 天翼云 AccessKey [%CT_OOS_ACCESS_KEY%]
--secret-key value 天翼云 SecretKey [%CT_OOS_SECRET_KEY%]
--endpoint value 天翼云 Endpoint [%CT_OOS_ENDPOINT%]
--bucket-name value, --bucket value 天翼云 bucketName [%CT_OOS_BUCKET_NAME%]
--enable-log 开启日志 (default: false)
--log-name value 日志名称-前缀 (default: "ct-oos-go")
--log-folder value 日志文件夹,默认是当前用户主目录下的 .ct-oos-go 文件夹
--connect-timeout-sec value 连接超时时间,单位是 s (default: 3)
--read-write-timeout-sec value 读写超时时间,单位是 s (default: 3)
--microseconds 日志打印时间精确到微秒 (default: false)
--long-file 日志打印使用长包名 (default: false)
--help, -h show help
```

- put

```shell
$ go run main.go put --help
NAME:
ct-oos-go put - 上传对象

USAGE:
ct-oos-go put command [command options] [arguments...]

COMMANDS:
string 上传 字符串
file 上传 文件
folder 上传 文件夹
help, h Shows a list of commands or help for one command

OPTIONS:
--access-key value 天翼云 AccessKey [%CT_OOS_ACCESS_KEY%]
--secret-key value 天翼云 SecretKey [%CT_OOS_SECRET_KEY%]
--endpoint value 天翼云 Endpoint [%CT_OOS_ENDPOINT%]
--bucket-name value, --bucket value 天翼云 bucketName [%CT_OOS_BUCKET_NAME%]
--uri value 上传路径-URI
--string value 上传字符串
--file value 上传文件
--folder value 上传文件夹
--force 是否强制上传,会覆盖文件 (default: false)
--enable-log 开启日志 (default: false)
--log-name value 日志名称-前缀 (default: "ct-oos-go")
--log-folder value 日志文件夹,默认是当前用户主目录下的 .ct-oos-go 文件夹
--connect-timeout-sec value 连接超时时间,单位是 s (default: 3)
--read-write-timeout-sec value 读写超时时间,单位是 s (default: 3)
--microseconds 日志打印时间精确到微秒 (default: false)
--long-file 日志打印使用长包名 (default: false)
--help, -h show help
```

- upload

```shell
$ go run main.go upload --help
NAME:
ct-oos-go upload - 上传文件-分片

USAGE:
ct-oos-go upload command [command options] [arguments...]

COMMANDS:
file 上传 文件-分片
folder 上传 文件夹-分片
help, h Shows a list of commands or help for one command

OPTIONS:
--access-key value 天翼云 AccessKey [%CT_OOS_ACCESS_KEY%]
--secret-key value 天翼云 SecretKey [%CT_OOS_SECRET_KEY%]
--endpoint value 天翼云 Endpoint [%CT_OOS_ENDPOINT%]
--bucket-name value, --bucket value 天翼云 bucketName [%CT_OOS_BUCKET_NAME%]
--uri value 上传路径-URI
--file value 上传文件
--folder value 上传文件夹
--part-size value 文件分片大小,单位 M,最小值 5 M,分片数量不能超过 10000 (default: 5)
--routine value 线程 (default: 3)
--force 是否强制上传,会覆盖文件 (default: false)
--enable-log 开启日志 (default: false)
--log-name value 日志名称-前缀 (default: "ct-oos-go")
--log-folder value 日志文件夹,默认是当前用户主目录下的 .ct-oos-go 文件夹
--connect-timeout-sec value 连接超时时间,单位是 s (default: 3)
--read-write-timeout-sec value 读写超时时间,单位是 s (default: 3)
--microseconds 日志打印时间精确到微秒 (default: false)
--long-file 日志打印使用长包名 (default: false)
--help, -h show help
```

### test

```shell
go test ./... -v
```

### build

```shell
go build
# GOOS=:设置构建的目标操作系统(darwin | freebsd | linux | windows)
# GOARCH=:设置构建的目标操作系统(386 | amd64 | arm | arm64)
# -v:打印编译过程中的详细信息
# -ldflags:设置在编译时传递给链接器的参数
# -ldflags "-s -w -buildid="
# -s: 删除符号表信息,减小可执行文件的大小。
# -w: 删除调试信息,使可执行文件在运行时不会打印调试信息。
# -buildid=: 删除构建ID,使可执行文件在运行时不会打印构建ID。
# -trimpath:去掉所有包含 go path 的路径
# -o:指定构建后输出的文件名
```

- Windows
- amd64
```shell
go build -o buildinfo/buildinfo.exe buildinfo/buildinfo.go
GOOS=windows GOARCH=amd64 go build -v -ldflags "-s -w -buildid= -X main.BuildDate=$(buildinfo/buildinfo.exe now) -X main.Compiler= -X main.GitCommitBranch=$(buildinfo/buildinfo.exe commitBranch) -X main.GitCommitSha=$(buildinfo/buildinfo.exe commitSha) -X main.GitCommitShortSha=$(buildinfo/buildinfo.exe commitShortSha) -X main.GitCommitTag=$(buildinfo/buildinfo.exe commitTag) -X main.GitCommitTimestamp=$(buildinfo/buildinfo.exe commitTimestamp) -X main.GitTreeState=$(buildinfo/buildinfo.exe git-tree-state) -X main.GitVersion=$(buildinfo/buildinfo.exe commitTag) -X main.GoVersion=$(buildinfo/buildinfo.exe goShortVersion) -X main.Major= -X main.Minor= -X main.Revision= -X main.Platform=windows/amd64 -X main.CiPipelineId= -X main.CiJobId=" -trimpath -o ct-oos-go-windows-amd64.exe .
```
- arm64
```shell
go build -o buildinfo/buildinfo.exe buildinfo/buildinfo.go
GOOS=windows GOARCH=arm64 go build -v -ldflags "-s -w -buildid= -X main.BuildDate=$(buildinfo/buildinfo.exe now) -X main.Compiler= -X main.GitCommitBranch=$(buildinfo/buildinfo.exe commitBranch) -X main.GitCommitSha=$(buildinfo/buildinfo.exe commitSha) -X main.GitCommitShortSha=$(buildinfo/buildinfo.exe commitShortSha) -X main.GitCommitTag=$(buildinfo/buildinfo.exe commitTag) -X main.GitCommitTimestamp=$(buildinfo/buildinfo.exe commitTimestamp) -X main.GitTreeState=$(buildinfo/buildinfo.exe git-tree-state) -X main.GitVersion=$(buildinfo/buildinfo.exe commitTag) -X main.GoVersion=$(buildinfo/buildinfo.exe goShortVersion) -X main.Major= -X main.Minor= -X main.Revision= -X main.Platform=windows/arm64 -X main.CiPipelineId= -X main.CiJobId=" -trimpath -o ct-oos-go-windows-arm64.exe .
```

- Linux
- amd64
```shell
go build -o buildinfo/buildinfo buildinfo/buildinfo.go
GOOS=linux GOARCH=amd64 go build -v -ldflags "-s -w -buildid= -X main.BuildDate=$(buildinfo/buildinfo now) -X main.Compiler= -X main.GitCommitBranch=$(buildinfo/buildinfo commitBranch) -X main.GitCommitSha=$(buildinfo/buildinfo commitSha) -X main.GitCommitShortSha=$(buildinfo/buildinfo commitShortSha) -X main.GitCommitTag=$(buildinfo/buildinfo commitTag) -X main.GitCommitTimestamp=$(buildinfo/buildinfo commitTimestamp) -X main.GitTreeState=$(buildinfo/buildinfo git-tree-state) -X main.GitVersion=$(buildinfo/buildinfo commitTag) -X main.GoVersion=$(buildinfo/buildinfo goShortVersion) -X main.Major= -X main.Minor= -X main.Revision= -X main.Platform=linux/amd64 -X main.CiPipelineId= -X main.CiJobId=" -trimpath -o ct-oos-go-linux-amd64 .
```
- arm64
```shell
go build -o buildinfo/buildinfo buildinfo/buildinfo.go
GOOS=linux GOARCH=arm64 go build -v -ldflags "-s -w -buildid= -X main.BuildDate=$(buildinfo/buildinfo now) -X main.Compiler= -X main.GitCommitBranch=$(buildinfo/buildinfo commitBranch) -X main.GitCommitSha=$(buildinfo/buildinfo commitSha) -X main.GitCommitShortSha=$(buildinfo/buildinfo commitShortSha) -X main.GitCommitTag=$(buildinfo/buildinfo commitTag) -X main.GitCommitTimestamp=$(buildinfo/buildinfo commitTimestamp) -X main.GitTreeState=$(buildinfo/buildinfo git-tree-state) -X main.GitVersion=$(buildinfo/buildinfo commitTag) -X main.GoVersion=$(buildinfo/buildinfo goShortVersion) -X main.Major= -X main.Minor= -X main.Revision= -X main.Platform=linux/arm64 -X main.CiPipelineId= -X main.CiJobId=" -trimpath -o ct-oos-go-linux-arm64 .
```

- Darwin
- amd64
```shell
go build -o buildinfo/buildinfo buildinfo/buildinfo.go
GOOS=darwin GOARCH=amd64 go build -v -ldflags "-s -w -buildid= -X main.BuildDate=$(buildinfo/buildinfo now) -X main.Compiler= -X main.GitCommitBranch=$(buildinfo/buildinfo commitBranch) -X main.GitCommitSha=$(buildinfo/buildinfo commitSha) -X main.GitCommitShortSha=$(buildinfo/buildinfo commitShortSha) -X main.GitCommitTag=$(buildinfo/buildinfo commitTag) -X main.GitCommitTimestamp=$(buildinfo/buildinfo commitTimestamp) -X main.GitTreeState=$(buildinfo/buildinfo git-tree-state) -X main.GitVersion=$(buildinfo/buildinfo commitTag) -X main.GoVersion=$(buildinfo/buildinfo goShortVersion) -X main.Major= -X main.Minor= -X main.Revision= -X main.Platform=darwin/amd64 -X main.CiPipelineId= -X main.CiJobId=" -trimpath -o ct-oos-go-darwin-amd64 .
```
- arm64
```shell
go build -o buildinfo/buildinfo buildinfo/buildinfo.go
GOOS=darwin GOARCH=arm64 go build -v -ldflags "-s -w -buildid= -X main.BuildDate=$(buildinfo/buildinfo now) -X main.Compiler= -X main.GitCommitBranch=$(buildinfo/buildinfo commitBranch) -X main.GitCommitSha=$(buildinfo/buildinfo commitSha) -X main.GitCommitShortSha=$(buildinfo/buildinfo commitShortSha) -X main.GitCommitTag=$(buildinfo/buildinfo commitTag) -X main.GitCommitTimestamp=$(buildinfo/buildinfo commitTimestamp) -X main.GitTreeState=$(buildinfo/buildinfo git-tree-state) -X main.GitVersion=$(buildinfo/buildinfo commitTag) -X main.GoVersion=$(buildinfo/buildinfo goShortVersion) -X main.Major= -X main.Minor= -X main.Revision= -X main.Platform=darwin/arm64 -X main.CiPipelineId= -X main.CiJobId=" -trimpath -o ct-oos-go-darwin-arm64 .
```

## 文档

1. [对象存储(经典版)I型 -> 文档下载 -> SDK及开发指南](https://www.ctyun.cn/document/10026693/10026825)
1. Go SDK 6.0
1. [OOS Go SDK 开发者指南-V6.pdf](https://oos-cn.ctyunapi.cn/docs/oos/sdk/Go/OOS%20Go%20SDK%20%E5%BC%80%E5%8F%91%E8%80%85%E6%8C%87%E5%8D%97-V6.pdf)
2. [ios-sdk-6.2.2.zip](https://oos-cn.ctyunapi.cn/sdk/oos/ios/ios-sdk-6.2.2.zip)
3. [oos-go-sdk-6.2.0.md5](https://oos-cn.ctyunapi.cn/sdk/oos/Go/oos-go-sdk-6.2.0.md5)