aws / aws-xray-sdk-go

AWS X-Ray SDK for the Go programming language.
Apache License 2.0
276 stars 117 forks source link

Convert to 16 byte representation of localhost in Unit Test if not already #397

Closed jj22ee closed 1 year ago

jj22ee commented 1 year ago

Issue #, if available: Unit tests starting failing in Go v1.20 https://github.com/aws/aws-xray-sdk-go/actions/runs/4198915049/jobs/7283153601

This is due to the Assertion of the TestGetDaemonEndpointsForHostname1 test, which ends up checking if the following equates:

resolveUDPAddr("localhost:2000") == resolveUDPAddr("127.0.0.1:2000")

In Go v1.19 and before, resolveUDPAddr("localhost:2000") returns an IP with a a 16-byte representation of the 4 byte localhost, which is 0x7f, 0x0, 0x0, 0x1 (127.0.0.1) AND prepended with ::FFFF:

0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x1

However in Go v1.20 this will return the 4 byte representation WITHOUT being prepended with ::FFFF:

0x7f, 0x0, 0x0, 0x1

Description of changes: Convert the 4 byte representation of localhost to 16 byte if not already. Update Readme to state that the SDK is compatible with Go 1.16 and above.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.