Hello,
I am working on code that formats strings. I have an issue with formatting the alternate form with zero padding of signed hexadecimals.
I have a format string like this: "%#07x", I would expect the zero padding to make sure the total width is 7. However, when I format the string using fmt.Sprintf I get the following results: 0x000002a which has the length of 9 characters instead of the expected result: 0x0002a with the width of 7 characters.
Example code: x := fmt.Sprintf("%#07x", 42)
x will be equal to: 0x000002a
Example of python code that works as I would expect: result = "{:#07x}".format(42)
results will be equal to: 0x0002a
I am suspicious that this might be a bug where the 0x is not accounted in the width but maybe I am doing something wrong.
Thanks for any help :)