Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk: Remove deprecated go versions #393

Merged
merged 8 commits into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ os:
- linux
- osx
go:
- 1.9.x
- 1.10.x
- 1.11.x
- 1.12.x
- tip
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ Deprecations
---
* `aws`: Removes plugin credential provider ([#391](https://github.com/aws/aws-sdk-go-v2/pull/391))
* Removing plugin credential provider from the v2 SDK developer preview. This feature may be made available as a separate module.
* Removes support for deprecated Go versions ([#393](https://github.com/aws/aws-sdk-go-v2/pull/393))
* Removes support for Go version specific files from the SDK. Also removes irrelevant build tags, and updates the README.md file.
skotambkar marked this conversation as resolved.
Show resolved Hide resolved

SDK Features
---

SDK Enhancements
---
* `aws/request` : Retryer is now a named field on Request. ([#393](https://github.com/aws/aws-sdk-go-v2/pull/393))

SDK Bugs
---
* `private/model/api`: Fixes broken test for code generation. ([#393](https://github.com/aws/aws-sdk-go-v2/pull/393))
17 changes: 2 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,7 @@ cleanup-integ-buckets:
###################
# Sandbox Testing #
###################
sandbox-tests: sandbox-test-go1.9 sandbox-test-go1.10 sandbox-test-go1.11 sandbox-test-go1.12 sandbox-test-gotip

sandbox-build-go1.9:
docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.9 -t "aws-sdk-go-1.9" .
sandbox-go1.9: sandbox-build-go1.9
docker run -i -t aws-sdk-go-1.9 bash
sandbox-test-go1.9: sandbox-build-go1.9
docker run -t aws-sdk-go-1.9

sandbox-build-go1.10:
docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.10 -t "aws-sdk-go-1.10" .
sandbox-go1.10: sandbox-build-go1.10
docker run -i -t aws-sdk-go-1.10 bash
sandbox-test-go1.10: sandbox-build-go1.10
docker run -t aws-sdk-go-1.10
sandbox-tests: sandbox-test-go1.11 sandbox-test-go1.12 sandbox-test-gotip

sandbox-build-go1.11:
docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.11 -t "aws-sdk-go-1.11" .
Expand Down Expand Up @@ -169,6 +155,7 @@ get-deps: get-deps-tests get-deps-x-tests get-deps-codegen get-deps-verify
get-deps-tests:
@echo "go get SDK testing dependencies"
go get golang.org/x/net/html
go get github.com/google/go-cmp

get-deps-x-tests:
@echo "go get SDK testing golang.org/x dependencies"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

`aws-sdk-go-v2` is the **Developer Preview** for the v2 AWS SDK for the Go programming language. While in Developer Preview (aka **beta**) the SDK may release minor version changes that break backwards compatability. The release notes for the breaking change will include information about the breaking change, and how you can migrate to the latest version.

Check out the [Issues] and [Projects] for design and updates being made to the SDK. The v2 SDK requires a minimum version of Go 1.9.
Check out the [Issues] and [Projects] for design and updates being made to the SDK. The v2 SDK requires a minimum version of `Go 1.11`.

We'll be expanding out the [Issues] and [Projects] sections with additional changes to the SDK based on your feedback, and SDK's core's improvements. Check the the SDK's [CHANGE_LOG] for information about the latest updates to the SDK.

Expand Down
2 changes: 0 additions & 2 deletions aws/arn/arn_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build go1.7

package arn

import (
Expand Down
15 changes: 5 additions & 10 deletions aws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,16 @@ type Metadata struct {
// A Client implements the base client request and response handling
// used by all service clients.
type Client struct {
Metadata Metadata

Config Config

Metadata Metadata
Config Config
Region string
Credentials CredentialsProvider
EndpointResolver EndpointResolver
Handlers Handlers
Retryer Retryer

// TODO replace with value not pointer
LogLevel LogLevel
Logger Logger

HTTPClient HTTPClient
LogLevel LogLevel
Logger Logger
HTTPClient HTTPClient
}

// NewClient will return a pointer to a new initialized service client.
Expand Down
5 changes: 4 additions & 1 deletion aws/client_logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ func TestLogRequest(t *testing.T) {
struct{}{}, nil,
)
req.SetReaderBody(c.Body)
req.Build()
err := req.Build()
if err != nil {
t.Fatalf("failed to build request, %d", err)
}

logRequest(req)

Expand Down
9 changes: 0 additions & 9 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@ type Config struct {
// standard out.
Logger Logger

// EnforceShouldRetryCheck is used in the AfterRetryHandler to always call
// ShouldRetry regardless of whether or not if request.Retryable is set.
// This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck
// is not set, then ShouldRetry will only be called if request.Retryable is nil.
// Proper handling of the request.Retryable field is important when setting this field.
//
// TODO this config field is depercated and needs removed.
EnforceShouldRetryCheck bool

// DisableRestProtocolURICleaning will not clean the URL path when making
// rest protocol requests. Will default to false. This would only be used
// for empty directory names in s3 requests.
Expand Down
4 changes: 2 additions & 2 deletions aws/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ type SafeCredentialsProvider struct {

// Retrieve returns the credentials. If the credentials have already been
// retrieved, and not expired the cached credentials will be returned. If the
// credentails have not been retrieved yet, or expired RetrieveFn will be called.
// credentials have not been retrieved yet, or expired RetrieveFn will be called.
//
// Retruns and error if RetrieveFn returns an error.
// Returns and error if RetrieveFn returns an error.
func (p *SafeCredentialsProvider) Retrieve() (Credentials, error) {
if creds := p.getCreds(); creds != nil {
return *creds, nil
Expand Down
1 change: 0 additions & 1 deletion aws/defaults/defaults_test.go

This file was deleted.

9 changes: 3 additions & 6 deletions aws/defaults/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,11 @@ var ValidateResponseHandler = aws.NamedHandler{Name: "core.ValidateResponseHandl
var AfterRetryHandler = aws.NamedHandler{
Name: "core.AfterRetryHandler",
Fn: func(r *aws.Request) {
// If one of the other handlers already set the retry state
// we don't want to override it based on the service's state
if r.Retryable == nil || r.Config.EnforceShouldRetryCheck {
r.Retryable = aws.Bool(r.ShouldRetry(r))
}
// set retry state based on the service's state
r.Retryable = aws.Bool(r.Retryer.ShouldRetry(r))

if r.WillRetry() {
r.RetryDelay = r.RetryRules(r)
r.RetryDelay = r.Retryer.RetryRules(r)

if err := sdk.SleepWithContext(r.Context(), r.RetryDelay); err != nil {
r.Error = awserr.New(aws.ErrCodeRequestCanceled,
Expand Down
4 changes: 1 addition & 3 deletions aws/external/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"net"
"net/url"

"github.com/aws/aws-sdk-go-v2/aws"
)

var lookupHostFn = net.LookupHost
Expand Down Expand Up @@ -40,7 +38,7 @@ func validateLocalURL(v string) error {
return err
}

host := aws.URLHostname(u)
host := u.Hostname()
if len(host) == 0 {
return fmt.Errorf("unable to parse host from local HTTP cred provider URL")
} else if isLoopback, err := isLoopbackHost(host); err != nil {
Expand Down
16 changes: 0 additions & 16 deletions aws/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@ type BuildableHTTPClient struct {
client *http.Client
}

//type withTransportOptions interface {
// WithTransportOptions(...func(*http.Transport)) HTTPClient
//}
//
//type getTransport interface {
// GetTransport() *http.Transport
//}
//
//type withDialerOptions interface {
// WithDialerOptions(...func(*net.Dialer)) HTTPClient
//}
//
//type getDialer interface {
// GetDialer() *net.Dialer
//}

// NewBuildableHTTPClient returns an initialized client for invoking HTTP
// requests.
func NewBuildableHTTPClient() *BuildableHTTPClient {
Expand Down
22 changes: 8 additions & 14 deletions aws/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ const (

// A Request is the service request to be made.
type Request struct {
Config Config
Metadata Metadata
Handlers Handlers

Retryer
Config Config
Metadata Metadata
Handlers Handlers
Retryer Retryer
AttemptTime time.Time
Time time.Time
ExpireTime time.Duration
Expand Down Expand Up @@ -220,11 +219,6 @@ func (r *Request) Context() context.Context {
// Request. It is not safe to use use a single Request value for multiple
// requests. A new Request should be created for each API operation request.
//
// Go 1.6 and below:
// The http.Request's Cancel field will be set to the Done() value of
// the context. This will overwrite the Cancel field's value.
//
// Go 1.7 and above:
// The http.Request.WithContext will be used to set the context on the underlying
// http.Request. This will create a shallow copy of the http.Request. The SDK
// may create sub contexts in the future for nested requests such as retries.
Expand All @@ -240,7 +234,7 @@ func (r *Request) WillRetry() bool {
if !IsReaderSeekable(r.Body) && r.HTTPRequest.Body != http.NoBody {
return false
}
return r.Error != nil && BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries()
return r.Error != nil && BoolValue(r.Retryable) && r.RetryCount < r.Retryer.MaxRetries()
}

// fmtAttemptCount returns a formatted string with attempt count
Expand Down Expand Up @@ -522,7 +516,7 @@ func (r *Request) sendRequest() (sendErr error) {
r.Handlers.Send.Run(r)
if r.Error != nil {
debugLogReqError(r, "Send Request",
fmtAttemptCount(r.RetryCount, r.MaxRetries()),
fmtAttemptCount(r.RetryCount, r.Retryer.MaxRetries()),
r.Error)
return r.Error
}
Expand All @@ -532,15 +526,15 @@ func (r *Request) sendRequest() (sendErr error) {
if r.Error != nil {
r.Handlers.UnmarshalError.Run(r)
debugLogReqError(r, "Validate Response",
fmtAttemptCount(r.RetryCount, r.MaxRetries()),
fmtAttemptCount(r.RetryCount, r.Retryer.MaxRetries()),
r.Error)
return r.Error
}

r.Handlers.Unmarshal.Run(r)
if r.Error != nil {
debugLogReqError(r, "Unmarshal Response",
fmtAttemptCount(r.RetryCount, r.MaxRetries()),
fmtAttemptCount(r.RetryCount, r.Retryer.MaxRetries()),
r.Error)
return r.Error
}
Expand Down
4 changes: 1 addition & 3 deletions aws/request_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ func TestRequest_SetContext(t *testing.T) {
t.Fatalf("expected error, got none")
}

// Only check against canceled because go 1.6 will not use the context's
// Err().
if e, a := "canceled", err.Error(); !strings.Contains(a, e) {
if e, a := ctx.Error.Error(), err.Error(); !strings.Contains(a, e) {
t.Errorf("expect %q to be in %q, but was not", e, a)
}
}
Expand Down
2 changes: 1 addition & 1 deletion aws/request_pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (r *Request) nextPageTokens() []interface{} {
}
}

tokens := []interface{}{}
var tokens []interface{}
tokenAdded := false
for _, outToken := range r.Operation.OutputTokens {
vs, _ := awsutil.ValuesAtPath(r.Data, outToken)
Expand Down
1 change: 0 additions & 1 deletion aws/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,6 @@ func TestEnforceShouldRetryCheck(t *testing.T) {
cfg.EndpointResolver = aws.ResolveWithEndpointURL(server.URL)
cfg.Retryer = retryer
cfg.HTTPClient = client
cfg.EnforceShouldRetryCheck = true

s := awstesting.NewClient(cfg)

Expand Down
6 changes: 2 additions & 4 deletions aws/retryer.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func shouldRetryError(origErr error) bool {
}
// *url.Error only implements Temporary after golang 1.6 but since
// url.Error only wraps the error:
// Todo: Investigate use case for this error case for +Go1.11
skotambkar marked this conversation as resolved.
Show resolved Hide resolved
return shouldRetryError(err.Err)

case temporary:
Expand All @@ -169,10 +170,7 @@ func shouldRetryError(origErr error) bool {
return true

default:
switch err.Error() {
case "net/http: request canceled",
"net/http: request canceled while waiting for connection":
// known 1.5 error case when an http request is cancelled
if strings.Contains(err.Error(), "canceled") {
return false
}
// here we don't know the error; so we allow a retry.
Expand Down
86 changes: 0 additions & 86 deletions aws/signer/v4/functional_1_5_test.go

This file was deleted.

Loading