#547·kong

为反射考虑严格的函数名称,以支持死代码消除

作者: alecthomas创建于 2025年8月9日更新于 2025年8月12日

var _ = kong.Must(&s3ls{})

type s3ls struct { Status listCmd cmd:"" help:"List files." }

type listCmd struct { Verbose bool short:"v" help:"Show bucket objects." }

func (s *listCmd) Run(ctx *kong.Context) error { // Load the SDK's configuration from environment and shared config, and // create the client with this. cfg, err := config.LoadDefaultConfig(context.TODO()) if err != nil { log.Fatalf("failed to load SDK configuration, %v", err) }

    client := s3.NewFromConfig(cfg)

    bucketName := "my-bucket" // Replace with your bucket name

内容来源: alecthomas/kong