Skip to content

aws-sdk-go's PutItem() never returns a nil pointer #34

@danny-cheung

Description

@danny-cheung

I am testing that we gracefully handle conditional write errors.

In my particular case, write an item, but don't overwrite it if already exists.

  • Operation = PutItemWithContext()
  • Condition = attribute_not_exist(id)

If an object with the same id exists, aws-sdk-go will return an error and a pointer to a blank PutItemOutput object. https://github.com/aws/aws-sdk-go/blob/v1.36.19/service/dynamodb/api.go#L4382

Simulating an error in Dynamock, a nil PutItemOutput pointer is returned. https://github.com/gusaul/go-dynamock/blob/master/put_item.go#L69

This becomes a problem when wrapper libraries relies/assumes AWS's behaviour. e.g. https://github.com/guregu/dynamo/blob/master/put.go#L97-L101

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions