Skip to content

Commit

Permalink
aws: clarify Config.Endpoint behavior on empty strings (#3423)
Browse files Browse the repository at this point in the history
The following PR changed the Endpoint behavior to include falling back to the default generated endpoint if an empty string is set.

#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),
})
```
  • Loading branch information
tabboud authored Jul 16, 2020
1 parent 50ec954 commit b868519
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b868519

Please sign in to comment.