Let's say I make an arbitrary map with an int slice, make(map[decimal.Decimal][]int)
I can easily load the map and fetch the results.
When I make a key assignment the map does not find results, see testVal
Example:
testVal:= decimal.NewFromFloat(1500)
valFromMap := decimal.Decimal{}
// assigning 1500 from the map
for k := range gridMap {
if k.Equals(decimal.NewFromFloat(1500)) {
// assign the decimal value 1500 from the map
valFromMap = k
}
}
// make the same 1500 value from above
testVal := decimal.NewFromFloat(1500)
// results differ
fmt.Println("Test Val: gridMap[testVal] ", gridMap[testVal], "\nVal From Map: gridMap[valFromMap]", gridMap[valFromMap])
Output
Test Val: decimal.Decimal
Val From Map: decimal.Decimal
Test Val: 1500
Val From Map: 1500
Test Val: gridMap[testVal] []
Val From Map: gridMap[valFromMap] [0 0] --> this is what I am looking for
I was playing around with the package and ran into a bug when trying to access a decimal key out of a map.
See example: https://go.dev/play/p/0ja7R0O2JaK
Let's say I make an arbitrary map with an int slice, make(map[decimal.Decimal][]int)
I can easily load the map and fetch the results.
When I make a key assignment the map does not find results, see testVal
Example:
Output
Test Val: decimal.Decimal Val From Map: decimal.Decimal
Test Val: 1500 Val From Map: 1500
Test Val: gridMap[testVal] [] Val From Map: gridMap[valFromMap] [0 0] --> this is what I am looking for