num: replace bytes.Buffer with strings.Builder for format construction
MODIFY
num/dual/dual.go
num/dual/dual.go
package dual
import (
- "bytes"
"fmt"
"math"
+ "strings"
)
// Number is a float64 precision dual number.
@@ -52,9 +52,7 @@ func (d Number) Format(fs fmt.State, c rune) {
// This is horrible, but it's what we have.
func fmtString(fs fmt.State, c rune, prec, width int, wantPlus bool) string {
- // TODO(kortschak) Replace this with strings.Builder
- // when go1.9 support is dropped from Gonum.
- var b bytes.Buffer
+ var b strings.Builder
b.WriteByte('%')
for _, f := range "0+- " {
if fs.Flag(int(f)) || (f == '+' && wantPlus) {

MODIFY
num/dualquat/dual.go
num/dualquat/dual.go
package dualquat
import (
- "bytes"
"fmt"
+ "strings"
"gonum.org/v1/gonum/num/dual"
"gonum.org/v1/gonum/num/quat"
@@ -59,9 +59,7 @@ func (d Number) Format(fs fmt.State, c rune) {
// This is horrible, but it's what we have.
func fmtString(fs fmt.State, c rune, prec, width int, wantPlus bool) string {
- // TODO(kortschak) Replace this with strings.Builder
- // when go1.9 support is dropped from Gonum.
- var b bytes.Buffer
+ var b strings.Builder
b.WriteByte('%')
for _, f := range "0+- " {
if fs.Flag(int(f)) || (f == '+' && wantPlus) {

MODIFY
num/hyperdual/hyperdual.go
num/hyperdual/hyperdual.go
package hyperdual
import (
- "bytes"
"fmt"
"math"
+ "strings"
)
// Number is a float64 precision hyperdual number.
@@ -55,9 +55,7 @@ func (d Number) Format(fs fmt.State, c rune) {
// This is horrible, but it's what we have.
func fmtString(fs fmt.State, c rune, prec, width int, wantPlus bool) string {
- // TODO(kortschak) Replace this with strings.Builder
- // when go1.9 support is dropped from Gonum.
- var b bytes.Buffer
+ var b strings.Builder
b.WriteByte('%')
for _, f := range "0+- " {
if fs.Flag(int(f)) || (f == '+' && wantPlus) {

MODIFY
num/quat/quat.go
num/quat/quat.go
package quat
import (
- "bytes"
"fmt"
"strconv"
"strings"
@@ -53,9 +52,7 @@ func (q Number) Format(fs fmt.State, c rune) {
// This is horrible, but it's what we have.
func fmtString(fs fmt.State, c rune, prec, width int, wantPlus bool) string {
- // TODO(kortschak) Replace this with strings.Builder
- // when go1.9 support is dropped from Gonum.
- var b bytes.Buffer
+ var b strings.Builder
b.WriteByte('%')
for _, f := range "0+- " {
if fs.Flag(int(f)) || (f == '+' && wantPlus) {

num: replace bytes.Buffer with strings.Builder for format construction