Only in #GoLang… 🐀
```
func main() {
key := "key"
var obj map[string]any
obj["key"] = "value"
}
```
There's a pretty obvious problem in the above code. Which one do you think it is.. according to the #golang compiler?
And that is why languages should leave linting to linters.
tags: #cplusplus #csharp #golang #java #javascript #kotlin #perl #php #programming #python #rustlang #swift
I think the thing I find most frustrating about programming languages is that there is no standard way to refer to the length of an array.
Python, go: len(array)
Java, JavaScript: array.length
Rust: array.len()
C++: array.size()
C#: array.Length
PHP: count($array)
Perl: scalar(@array) (lmao)
Swift: array.count
Kotlin: array.size
Like, seriously? Can't we agree on just this one thing???
JSON has strings, numbers and booleans; yet some APIs use strings for all types, i.e. {"age":"26","is_active":"true"}
You most probably need more code to support parsing such data, at least in typed languages like Go. And quotes = more traffic.
So why would you do that?