lucasb-eyer / go-colorful

A library for playing with colors in go (golang).
MIT License
1.16k stars 59 forks source link

Correct syntax example for multiple color types. #9

Closed verygoodsoftwarenotvirus closed 9 years ago

verygoodsoftwarenotvirus commented 9 years ago

I noticed that when I copied the Hex example from the README, go gave me a multiple-value colorful.Hex() in single-value context error, and the source reveals that colorful.Hex() will return an error if the string provided is invalid. Also present if you were to copy paste that whole chunk of code are multiple no new variables on left side of := errors, so I adjusted that as well.

pftbest commented 9 years ago

log.Fatal will call os.Exit(1) for you, so you don't need to call it second time.

verygoodsoftwarenotvirus commented 9 years ago

@pftbest good catch, I didn't know that, but have revised.

lucasb-eyer commented 9 years ago

Nice, thank you!

lucasb-eyer commented 9 years ago

Actually the very next example will also have no new variables on left side of := errors, e.g. because of x, y, l and h, but that one isn't meant to be run as-is so I think it's clearer not to change that one.