You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a function errorMsg which prints to the stderr stream when there is an error. In production open must never print to stderr because it may conflict with other things present in the product, and can cause debugging to become very hard.
For example, the below code can be turned into:
// roundOffTitleColor rounds off 24 bit Color to the terminals maximum color capacity for Title.func (bBox) roundOffTitleColor(col color.RGBColor, titlestring) string {
switchdetectTerminalColor() {
caseterminfo.ColorLevelNone:
errorMsg("[warning]: terminal does not support colors, using no effects")
returntitlecaseterminfo.ColorLevelMillions:
returncol.Sprint(title)
default:
returncol.C256().Sprint(title)
}
}
// roundOffTitleColor rounds off 24 bit Color to the terminals maximum color capacity for Title.func (bBox) roundOffTitleColor(col color.RGBColor, titlestring) (string, err) {
switchdetectTerminalColor() {
caseterminfo.ColorLevelNone:
returntitle, errors.New("terminal does not support colors")
caseterminfo.ColorLevelMillions:
returncol.Sprint(title), nildefault:
returncol.C256().Sprint(title), nil
}
}
then, do the changes as per the need.
This is a very breaking change so this has to be some with cautious.
The text was updated successfully, but these errors were encountered:
There is a function
errorMsg
which prints to thestderr
stream when there is an error. In production open must never print tostderr
because it may conflict with other things present in the product, and can cause debugging to become very hard.For example, the below code can be turned into:
then, do the changes as per the need.
This is a very breaking change so this has to be some with cautious.
The text was updated successfully, but these errors were encountered: