gofrs / uuid

A UUID package for Go
MIT License
1.58k stars 111 forks source link

improve codec error strings #78

Closed coder543 closed 5 years ago

coder543 commented 5 years ago

Right now, the invalid format error strings are confusing for attempts to parse empty strings, since they just end in a length:. It really looks like it should be printing the invalid length.

Furthermore, some of the errors use colons, and some of them don't, so even for the exact same error, the strings are inconsistent.

I propose to add single quotes around any %s verbs to make error messages more readable, as well as printing the erroneous length value and making colon usage consistent within codec.go

codecov-io commented 5 years ago

Codecov Report

Merging #78 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #78   +/-   ##
=======================================
  Coverage   99.05%   99.05%           
=======================================
  Files           4        4           
  Lines         318      318           
=======================================
  Hits          315      315           
  Misses          2        2           
  Partials        1        1
Impacted Files Coverage Δ
codec.go 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2593f3d...21c27ff. Read the comment docs.

acln0 commented 5 years ago

LGTM now! In the interest of clean git history, can you please squash these down into one commit, and then force-push?

coder543 commented 5 years ago

done!

adamdecaf commented 5 years ago

I'm assuming anyone who cares about this specific error is matching on uuid: incorrect UUID length (perhaps without the uuid: prefix).

acln0 commented 5 years ago

Thanks again. Merging.