returning a pointer is not necessary

This commit is contained in:
Ryan Cavicchioni 2020-03-28 18:03:49 -05:00
parent 4b6f159d03
commit bdcb20acb2
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -77,12 +77,13 @@ var (
} }
) )
func NewRGBColor(r, g, b uint8) (*RGBColor, error) { func NewRGBColor(r, g, b uint8) (RGBColor, error) {
var c RGBColor
if (r < 0 || r > 255) && (g < 0 || r > 255) && (b < 0 || b > 255) { if (r < 0 || r > 255) && (g < 0 || r > 255) && (b < 0 || b > 255) {
return nil, errors.New("values must be between 0-255") return c, errors.New("values must be between 0-255")
} }
return &RGBColor{R: r, G: g, B: b}, nil return RGBColor{R: r, G: g, B: b}, nil
} }
func NewHSColor(h, s float32) (HSBKColor, error) { func NewHSColor(h, s float32) (HSBKColor, error) {