添加文件: sdk_LinkedMall/example_test.go
This commit is contained in:
parent
4cfca2640c
commit
97b206457f
|
|
@ -0,0 +1,22 @@
|
||||||
|
package sdk_LinkedMall
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ExampleNewClient 演示如何创建客户端
|
||||||
|
func ExampleNewClient() {
|
||||||
|
// 从环境变量获取AK,禁止硬编码
|
||||||
|
accessKeyId := os.Getenv("LINKEDMALL_AK_ID")
|
||||||
|
accessKeySecret := os.Getenv("LINKEDMALL_AK_SECRET")
|
||||||
|
|
||||||
|
cli, err := NewClient(accessKeyId, accessKeySecret)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("failed to create client: %v", err)
|
||||||
|
}
|
||||||
|
_ = cli
|
||||||
|
fmt.Println("client created successfully")
|
||||||
|
// Output: client created successfully
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue