From b868519ad5e70e7b66b3ef4753590fa752996c99 Mon Sep 17 00:00:00 2001 From: Tony Abboud Date: Thu, 16 Jul 2020 17:12:43 -0400 Subject: [PATCH] `aws`: clarify Config.Endpoint behavior on empty strings (#3423) The following PR changed the Endpoint behavior to include falling back to the default generated endpoint if an empty string is set. https://github.com/aws/aws-sdk-go/pull/3349 It's not very clear that this is the intended behavior when reading the docs. Adding this clarification promotes using the following code rather than have to conditionally check if it's set or not. For example: ```go // ideal behavior sess, err := session.NewSession(&aws.Config{ Endpoint: aws.String(s3Cfg.Endpoint), Region: aws.String(s3Cfg.Region), }) // required check given docs assumption var endpoint *string if s3Cfg.Endpoint != "" { endpoint = aws.String(s3Cfg.Endpoint) } sess, err := session.NewSession(&aws.Config{ Endpoint: endpoint, Region: aws.String(s3Cfg.Region), }) ``` --- aws/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/config.go b/aws/config.go index 2c002e152af..9bd40e47039 100644 --- a/aws/config.go +++ b/aws/config.go @@ -43,7 +43,7 @@ type Config struct { // An optional endpoint URL (hostname only or fully qualified URI) // that overrides the default generated endpoint for a client. Set this - // to `nil` to use the default generated endpoint. + // to `nil` or the value to `""` to use the default generated endpoint. // // Note: You must still provide a `Region` value when specifying an // endpoint for a client.