v2: Change MachineID, sequence, and AmazonEC2MachineID to int; update all usage and tests for type consistency

This commit is contained in:
Yoshiyuki Mineo committed 2025-05-04 16:48:11 +09:00
1 parent 585f877536
commit fd450d1c8e
5 files changed
+42 -43

No files matched your search

+2 -2
View File
@@ -34,13 +34,13 @@ func amazonEC2PrivateIPv4() (net.IP, error) {
// AmazonEC2MachineID retrieves the private IP address of the Amazon EC2 instance
// and returns its lower 16 bits.
// It works correctly on Docker as well.
func AmazonEC2MachineID() (int64, error) {
func AmazonEC2MachineID() (int, error) {
ip, err := amazonEC2PrivateIPv4()
if err != nil {
return 0, err
}
return int64(uint16(ip[2])<<8 + uint16(ip[3])), nil
return int(ip[2])<<8 + int(ip[3]), nil
}
// TimeDifference returns the time difference between the localhost and the given NTP server.