Comments (4)
This is behaving as intended. Since Task now supports any scalar variable type, if you give it a number, it will be interpreted as one (rather than the previous behaviour which automatically converted it to a string). Since the number you used far exceeds the maximum signed and unsigned 64 bit integer size, it is converted to a float approximation instead and when printed it will be displayed using scientific notation.
If you want your variable to be a string then you should always wrap it with quotes and it will be interpreted as expected:
long-number:
desc: Print a long number variable
vars:
LONG_NUMBER: "123456789012345678901234567890"
cmds:
- echo "{{.LONG_NUMBER}}"
from task.
I figured this might be the intended behavior and included the bit about the quotes after the example I provided. For future reference, should I assume minor version bumps could introduce breaking changes?
from task.
We don't (intentionally) make breaking changes in minor/patch versions. We follow SemVer rules for our CLI binary (Though it's worth remembering that the Golang package API does not share this compatibility guarantee). This is one of the reasons why we have experiment flags (for testing breaking changes to be made in future major releases).
I understand that this release made some Taskfiles behave differently. However, I would argue that this is still not considered to be a breaking change since it only changes the behaviour of incorrectly formatted YAML files. If anything, I would consider the previous behaviour to be buggy and we should have been erroring if we detected non-string variables.
The fact that in prior versions, you could define a YAML boolean and then not use {{if .BOOL_VAR}}
when templating was not intuitive at all. Likewise, defining a YAML number without quotes implies that you should be able to do {{index (list 1 2 3) .NUM_VAR}}
. However, this would have errored with cannot index slice/array with type string
. In 3.37.0+ both these scenarios work as expected.
Sidenote: One of my least favourite things about YAML is that it lets you define strings without using quotes. It leads to a lot of problems/misunderstandings. Especially given that y
, n
, yes
, no
, on
, off
, true
and false
are all parsed as bools depending on the parser and YAML version you're using. It's just messy and should be avoided at all costs. There is plenty of discussion on this topic on StackOverflow.
One thing is for sure though. If you want a string containing numeric-only characters - you need to quote it.
from task.
I understand what you mean about the previous behavior being considered a bug. I guess whether this is considered a "breaking change" is open to interpretation, but I can definitely see your point. Thanks for the explanation! 👍🏻
from task.
Related Issues (20)
- Wildcards and fingerprinting: consider to automatically concat the wildcard parameter on the cache key
- New PowerShell recommended profile does not seem to work on Linux
- Dependency Dashboard
- potential bug: Variables in included files override ones in parent file HOT 1
- Distribute as Docker Image
- Strange env var override behavior
- [v3.39.0] defer no longer evaluates variables HOT 10
- Unexpected logging of experiments usage HOT 5
- [3.39.0] Environment variable seen as command HOT 3
- [3.39.0] Autocomplete throws error HOT 4
- The warning prompt occurs after the dependencies have been executed.
- Flaky TestForDeps/loop-matrix test HOT 5
- Cannot use splitArgs and splitLines in for-loops
- vars no longer run `sh` HOT 3
- EXIT_CODE is empty when ignore_error:true
- TASK_X_ENV_PRECEDENCE is broken HOT 2
- With multiple remote Taskfile, the confirmation prompt is not blocking
- Certain preconditions broken in >= 3.39.x
- ignore_error is not working with task and preconditions HOT 1
- dir in task is buggy when using variables HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from task.