The most popular Go dependency is…
https://blog.thibaut-rousseau.com/blog/the-most-popular-go-dependency-is/
| GitHub | https://github.com/Thiht |
| Blog | https://blog.thibaut-rousseau.com |
The most popular Go dependency is…
https://blog.thibaut-rousseau.com/blog/the-most-popular-go-dependency-is/
After an immense amount of discussion, there’s a full proposal and implementation for a v2 JSON Go library: https://github.com/golang/go/issues/71497
I’m delighted that it stays within the bounds of I-JSON (RFC 7493) and defaults to strict RFC 3339 (i.e. ISO8601) compliance for time/date. I’m sad that there are so very many options and worried that some might combine in unpleasantly surprising ways. Kudos to the people who put the work in.
Also, faster in most cases.
@[email protected] @[email protected] I think I would settle for `foo := fn() ? err`, with "err" being mandatory and user defined. The long form would be:
```go
foo := fn() ? err {
// do stuff
return fmt.Errorf("fn: %w")
}
```
This way at least the variable name is explicit, and I find the short form `? err` more readable and visual than just a bare `?`
It doesn't solve my coverage issue, but I guess it can be solved with tooling
@[email protected] @[email protected] There are valid reasons for not liking this proposal.
For example, think in terms of test coverage:
```go
foo, err := fn()
if err != nil {
return err
}
fmt.Println(foo)
```
This code requires 2 tests to get 100% coverage, which is GOOD. It makes it easy to see if you forgot to test some paths.
```go
foo := fn() ?
fmt.Println(foo)
```
With this, if you only test the happy path, you get 100% coverage.
Less lines of code is not always an improvement, explicitness has value.