aws / aws-dax-go

AWS DAX SDK for the Go programming language. https://aws.amazon.com/dynamodb/dax
Apache License 2.0
47 stars 48 forks source link

Is this project alive? #31

Closed tbarbugli closed 3 years ago

tbarbugli commented 3 years ago

I dont see much activity plus my first attempt on a Go project using modules fails on import errors

# github.com/aws/aws-dax-go/dax
vendor/github.com/aws/aws-dax-go/dax/api.go:572:38: undefined: dynamodb.BatchExecuteStatementInput
vendor/github.com/aws/aws-dax-go/dax/api.go:572:77: undefined: dynamodb.BatchExecuteStatementOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:576:45: undefined: dynamodb.BatchExecuteStatementInput
vendor/github.com/aws/aws-dax-go/dax/api.go:576:102: undefined: dynamodb.BatchExecuteStatementOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:580:62: undefined: dynamodb.BatchExecuteStatementInput
vendor/github.com/aws/aws-dax-go/dax/api.go:580:120: undefined: dynamodb.BatchExecuteStatementOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:584:31: undefined: dynamodb.DescribeExportInput
vendor/github.com/aws/aws-dax-go/dax/api.go:584:63: undefined: dynamodb.DescribeExportOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:588:55: undefined: dynamodb.DescribeExportInput
vendor/github.com/aws/aws-dax-go/dax/api.go:588:106: undefined: dynamodb.DescribeExportOutput
vendor/github.com/aws/aws-dax-go/dax/api.go:588:106: too many errors

image

Is this the best way to use DAX with Golang?

ktseytlin commented 3 years ago

Yes, this package is still alive. As your IDE is showing you, you should not be importing the internal folder.

This might be a helpful stack overflow response: https://stackoverflow.com/questions/59342373/use-of-internal-package-not-allowed

The README shows an example of importing the aws-dax-go package to your project.

ktseytlin commented 3 years ago

If there is a different issue here and I misunderstood, please reopen the ticket.

kevinchristen commented 3 years ago

It looks like the version of aws-sdk-go that you are using is behind the version required by aws-dax-go. The types that are undefined were added in version 1.35.34 of aws-sdk-go. Try go get github.com/aws/aws-sdk-go.

For an example of how to use the client, see the code in github.com/aws-samples/aws-dax-go-sample. The comment above about not importing the internal packages of aws-dax-go is correct.

tbarbugli commented 3 years ago

@ktseytlin the screenshot is from the vendor/github.com/aws/aws-dax-go/dax/api.go file not from my project

@kevinchristen I will try to upgrade to latest of aws-sdk-go, I am using Go modules btw. The deps you have on the repo are also out of date:

[[constraint]]
  name = "github.com/aws/aws-sdk-go"
  version = "1.30.7"
tbarbugli commented 3 years ago

FTR I did not mean to sound provocative but I see so many issues with this lib that I was wondering if it was still alive and well, happy to help out with feedback if it gets answered :)

kevinchristen commented 3 years ago

We are happy for the feedback; don't worry about sounding provocative. Can you clarify if you have been able to get past the problems reported above by updating aws-sdk-go and not trying to import the internal packages of aws-dax-go? If not, what problems are you seeing now? Please share your code if you can (not just a screenshot). Thanks.

tbarbugli commented 3 years ago

I found out the issue, our project is using go modules and has aws-sdk to ~1.33. I am not 100% sure but I this might be related to the fact that this lib does not have a go.mod manifest.

Probably a good idea to make this into a go module (when you do be careful because the dep dependency file will be used by go mod init and that manifest is using 1.30.7 :))

One thing I noticed is that DAX and DynamoDB have slightly different methods to construct their clients (New / NewWithSession, Session vs *Session)

func GetDynamo() *dynamodb.DynamoDB {
    config := &aws.Config{}

    sess := session.Must(session.NewSession(config))
    svc := dynamodb.New(sess)
    return svc
}

func GetDAX() (*dax.Dax, error) {
    config := &aws.Config{}

    sess := session.Must(session.NewSession(config))
    client, err := dax.NewWithSession(*sess)
         return client, err
}
kevinchristen commented 3 years ago

We added support for go modules to this and the aws-dax-go-sample repository. Thanks for the advice; I hope that eliminates the problems with mismatched versions.