Skip to content

Commit

Permalink
accounts/abi/bind: stop using goimports in the binding generator (eth…
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Dec 21, 2024
1 parent 08cd815 commit 650b5d7
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 42 deletions.
6 changes: 3 additions & 3 deletions accounts/abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ package bind
import (
"bytes"
"fmt"
"go/format"
"regexp"
"strings"
"text/template"
"unicode"

"github.com/XinFinOrg/XDPoSChain/accounts/abi"
"golang.org/x/tools/imports"
)

// Lang is a target programming language selector to generate bindings for.
Expand Down Expand Up @@ -143,9 +143,9 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
if err := tmpl.Execute(buffer, data); err != nil {
return "", err
}
// For Go bindings pass the code through goimports to clean it up and double check
// For Go bindings pass the code through gofmt to clean it up
if lang == LangGo {
code, err := imports.Process(".", buffer.Bytes(), nil)
code, err := format.Source(buffer.Bytes())
if err != nil {
return "", fmt.Errorf("%v\n%s", err, buffer)
}
Expand Down
Loading

0 comments on commit 650b5d7

Please sign in to comment.