Skip to content
Permalink
Browse files

separate gofumpt code into an importable package

To allow offering a drop-in replacement for goimports.
  • Loading branch information...
mvdan committed Apr 9, 2019
1 parent bdb9bda commit 9ef2c07e44c4ff0518420055ab05ceaac52d0934
Showing with 5 additions and 3 deletions.
  1. +3 −1 gofmt.go
  2. +2 −2 { → internal}/gofumpt.go
@@ -21,6 +21,8 @@ import (
"runtime"
"runtime/pprof"
"strings"

"mvdan.cc/gofumpt/internal"
)

var (
@@ -116,7 +118,7 @@ func processFile(filename string, in io.Reader, out io.Writer, stdin bool) error

// This is the only gofumpt change on gofmt's codebase, besides changing
// the name in the usage text.
gofumpt(fileSet, file)
internal.Gofumpt(fileSet, file)

res, err := format(fileSet, file, sourceAdj, indentAdj, src, printer.Config{Mode: printerMode, Tabwidth: tabWidth})
if err != nil {
@@ -1,7 +1,7 @@
// Copyright (c) 2019, Daniel Martí <mvdan@mvdan.cc>
// See LICENSE for licensing information

package main
package internal

import (
"fmt"
@@ -14,7 +14,7 @@ import (
"unicode/utf8"
)

func gofumpt(fset *token.FileSet, file *ast.File) {
func Gofumpt(fset *token.FileSet, file *ast.File) {
f := &fumpter{
fset: fset,
file: fset.File(file.Pos()),

0 comments on commit 9ef2c07

Please sign in to comment.
You can’t perform that action at this time.