Skip to content

Commit

Permalink
Use go/format instead of gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Dec 18, 2019
1 parent 7a41df2 commit 8825d44
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions internal/extract-helps/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"errors"
"flag"
"fmt"
"go/format"
"io"
"io/ioutil"
"os"
"os/exec"
"strings"
"text/tabwriter"
"text/template"
Expand Down Expand Up @@ -408,10 +408,13 @@ func run() error {
return err
}

cmd := exec.Command("gofmt", "-s")
cmd.Stdin = buf
cmd.Stdout = w
return cmd.Run()
output, err := format.Source(buf.Bytes())
if err != nil {
return err
}

_, err = w.Write(output)
return err
}

func main() {
Expand Down

0 comments on commit 8825d44

Please sign in to comment.