github-vet / github-vet/rangeloop-pointer-findings

remijouannet/packer-osc-plugins: builder/osc/common/artifact.go; 24 LoC

Open
#17,060 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [remijouannet/packer-osc-plugins](https://www.github.com/remijouannet/packer-osc-plugins) at [builder/osc/common/artifact.go](https://github.com/remijouannet/packer-osc-plugins/blob/0fad828d170cdb9023df1f1beec86a09b2bbcbc0/builder/osc/common/artifact.go#L67-L90)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.

> reference to imageId was used in a composite literal at line 71

[Click here to see the code in its original context.](https://github.com/remijouannet/packer-osc-plugins/blob/0fad828d170cdb9023df1f1beec86a09b2bbcbc0/builder/osc/common/artifact.go#L67-L90)

Click here to show the 24 line(s) of Go which triggered the analyzer.

```go
for region, imageId := range a.Amis {
log.Printf("Deregistering image ID (%s) from region (%s)", imageId, region)

imageResp, err := a.Conn.DescribeImages(&ec2.DescribeImagesInput{
ImageIds: []*string{&imageId},
})
if err != nil {
errors = append(errors, err)
}
if len(imageResp.Images) == 0 {
err := fmt.Errorf("Error retrieving details for AMI (%s), no images found", imageId)
errors = append(errors, err)
}

// Deregister ami
input := &ec2.DeregisterImageInput{
ImageId: &imageId,
}
if _, err := a.Conn.DeregisterImage(input); err != nil {
errors = append(errors, err)
}

// TODO(hashicorp/packer/helper): Delete the snapshots associated with an AMI too
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 0fad828d170cdb9023df1f1beec86a09b2bbcbc0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.