Sourcery
Sourcery copied to clipboard
Large numbers in arguments are printed in scientific notation
When running Sourcery with a large number as one of its arguments, using the argument in a stencil will instead give the number's scientific notation.
As simple example, you can execute the following commands in your terminal;
mkdir scientificFooBar
cd scientificFooBar
echo "\"{{ argument.foobar }}\"" > FooBar.stencil
echo "enum FooBar {}" > FooBar.swift
FOOBAR=123456789
sourcery \
--quiet \
--templates FooBar.stencil \
--output FooBar.generated \
--args foobar=$FOOBAR \
--sources .
cat FooBar.generated
The expected result here is the output "123456789"
, but instead you get "1.234568e+08"
.
Tested on Sourcery 1.8.1.
I believe if you wrap the value in double quotes and single quotes, it should work fine
FOOBAR="'123456789'"
I believe if you wrap the value in double quotes and single quotes, it should work fine
FOOBAR="'123456789'"
Fair enough, hopefully that will end up helping someone else that encounters this before it is fixed. Thanks for commenting 😄