I am using aws-sdk-go-v2 trying to specify a custom aws.Retryer. However the go compiler cannot resolve aws.Retryer from "github.com/aws/aws-sdk-go-v2/aws/retry".
I am using go version go1.21.6 darwin/arm64 running in Visual Studio Code on macOS Monterey Version 12.6
here is a code snippet:
package main
import (
"context"
"net/http"
"github.com/{company}/{repo}/internal/aws"
"github.com/aws/aws-sdk-go-v2/aws/ratelimit"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/config"
...
awsContext := context.Background()
ns := retry.NewStandard(func(so *retry.StandardOptions) {
so.RateLimiter = ratelimit.NewTokenRateLimit(1000000)
})
cwr := config.WithRetryer(func() aws.Retryer {
return ns
})
cfg, _ := config.LoadDefaultConfig(awsContext, cwr)
Here's my go.mod file:
module github.com/{company}/{repo}
go 1.21.6
require (
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.6
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.17
github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression v1.6.17
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.27.1
github.com/bshuster-repo/logrus-logstash-hook v1.1.0
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.6.0
github.com/magefile/mage v1.15.0
github.com/modern-go/reflect2 v1.0.2
github.com/newrelic/go-agent/v3 v3.29.1
github.com/newrelic/go-agent/v3/integrations/nrawssdk-v2 v1.2.2
github.com/newrelic/go-agent/v3/integrations/nrgin v1.2.1
github.com/newrelic/go-agent/v3/integrations/nrlogrus v1.0.1
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
)
require (
github.com/aws/aws-sdk-go-v2/credentials v1.16.16 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 // indirect
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.18.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.11 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.18.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect
github.com/aws/smithy-go v1.19.0 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.17.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/leodido/go-urn v1.3.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
output of go env:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/markbarrett/Library/Caches/go-build'
GOENV='/Users/markbarrett/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/markbarrett/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/markbarrett/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.6/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.6/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/markbarrett/go/src/github.com/{company}/{repo}/go.mod'
GOWORK='/Users/markbarrett/go/src/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/1b/50gy45l57_j5hg850wr72jlw0000gn/T/go-build299215293=/tmp/go-build -gno-record-gcc-switches -fno-common'
Any idea why it can't find aws.Retryer?
cmd/ns/main.go:58:39: undefined: aws.Retryer
I am trying to get my go program to build but it can't find aws.Retryer