Go: Managing Multiple Error Handling


Go — , Go. , Go , . , , .





,

, , , . , :





CSV- . , . , :





  • go-multierror HashiCorp, :





:





  • multierr Uber:





, :





- .





, , :





name                    time/op         alloc/op        allocs/op
HashiCorpMultiErrors-4  6.01µs ± 1%     6.78kB ± 0%     77.0 ± 0%
UberMultiErrors-4       9.26µs ± 1%     10.3kB ± 0%      126 ± 0%
      
      



Uber . , . , , . :





name                    time/op         alloc/op        allocs/op
HashiCorpMultiErrors-4  6.01µs ± 1%     6.78kB ± 0%     77.0 ± 0%
UberMultiErrors-4       6.02µs ± 1%     7.06kB ± 0%     77.0 ± 0%
      
      



Go error



Error() string



.





,

, .





, ; :





, . :





, , , :





go run .  0.30s user 0.19s system 14% cpu 3.274 total
      
      



, . , , , , , :





, errgroup; . , errgroup:





, :





go run .  0.30s user 0.19s system 38% cpu 1.269 total
      
      



, . , , .






"Golang Developer. Professional".





« ». demo- :

- quoted-printable base64;

- JSON, XML YAML;

- ;

- : gob, msgpack protobuf.

. !








All Articles