Codebase list golang-github-vbauerster-mpb / b36c28b
parenthesis are not necessary Vladimir Bauer 7 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
9797 // FormatMsg formats final message according to WC.W and WC.C.
9898 // Should be called by any Decorator implementation.
9999 func (wc WC) FormatMsg(msg string, widthAccumulator chan<- int, widthDistributor <-chan int) string {
100 if (wc.C & DSyncWidth) != 0 {
100 if wc.C&DSyncWidth != 0 {
101101 widthAccumulator <- utf8.RuneCountInString(msg)
102102 max := <-widthDistributor
103103 if max == 0 {
104104 max = wc.W
105105 }
106 if (wc.C & DextraSpace) != 0 {
106 if wc.C&DextraSpace != 0 {
107107 max++
108108 }
109109 return fmt.Sprintf(fmt.Sprintf(wc.format, max), msg)
114114 // BuildFormat builds initial format according to WC.C
115115 func (wc *WC) BuildFormat() {
116116 wc.format = "%%"
117 if (wc.C & DidentRight) != 0 {
117 if wc.C&DidentRight != 0 {
118118 wc.format += "-"
119119 }
120120 wc.format += "%ds"