系统平台 | 运行命令 |
Linux / MacOS | export GOPROXY=https://mirrors.tencent.com/go/ |
Windows | set GOPROXY=https://mirrors.tencent.com/go/ |
GO111MODULE=auto
或者 GO111MODULE=on
,并且在您的项目中执行了 go mod init xxx
。如果您使用 GOPATH,请参考全部安装方式。安装方式 | 安装说明 | 运行命令 |
按需安装(推荐) | 安装公共基础包 | go get -v -u github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common |
| 安装对应的产品包(如 CVM) | go get -v -u github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm |
全部安装 | 一次性下载腾讯云所有产品的包 | go get -v -u github.com/tencentcloud/tencentcloud-sdk-go |
v3.0.*
和 3.0.*
的 tag,如需追溯以前的 tag,请参见项目根目录下的 commit2tag
文件。package mainimport ("fmt""github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common""github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors""github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"ims "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ims/v20201229") func main() {credential: = common.NewCredential("SecretId", "SecretKey", ) cpf: = profile.NewClientProfile() cpf.HttpProfile.Endpoint = "ims.tencentcloudapi.com"client,_: = ims.NewClient(credential, "ap-guangzhou", cpf) request: = ims.NewImageModerationRequest() response,err: = client.ImageModeration(request) if _,ok: = err.( * errors.TencentCloudSDKError);ok {fmt.Printf("An API error has returned: %s", err) return}if err != nil {panic(err)}fmt.Printf("%s", response.ToJsonString())}
本页内容是否解决了您的问题?