-
-
Notifications
You must be signed in to change notification settings - Fork 210
Open
Description
I have a golang structure:
type AWSAccounts struct {
AccountID string `yaml:"accountid,omitempty"`
Nickname string `yaml:"nickname,omitempty"`
RoleARN string `yaml:"rolearn,omitempty"`
ExternalID string `yaml:"externalid,omitempty"`
}
And I have an element like this (not the real account number but shows the issue):
- accountid: 074763617300
nickname: 'xxx-xxx'
rolearn: arn:aws:iam::074763617300:role/IAM_ROLE
Even though accountid is a string, the value is being interpreted as an octal number. The workaround is to quote the value - however this deviates in behavior from gopkg.in/yaml.v3 which treats it as a string without the explicit quoting. The encoding/json package does not have the same issue because its quoting rules are more rigid. I don't know if this is a case of gopkg.in/yaml.v3 being too loose or goccy/go-yaml not being flexible enough, but it is completely reproducible. I did also note that if the number is large enough that it would overflow if interpreted as an integer, then it does get interpreted as a string.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels