From 7e155245dba8b6d3f2c3874d25423b53fb5937fa Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Mon, 28 Nov 2022 00:37:04 +0700 Subject: [PATCH] feat: remove sort imports use gofumpt or gofmt --- internal/imports/formatter.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/internal/imports/formatter.go b/internal/imports/formatter.go index f227a82..9a90d4d 100644 --- a/internal/imports/formatter.go +++ b/internal/imports/formatter.go @@ -248,20 +248,6 @@ func (ft *Formatter) formatImports( return nil, err } - // Post process to sort imports using default Go - // TODO: find a way to use ast.SortImports without parse ast again - formattedASTFile, err := parser.ParseFile(fset, path, formattedBuffer.Bytes(), parserMode) - if err != nil { - return nil, fmt.Errorf("parser: failed to parse file [%s]: %w", path, err) - } - - ast.SortImports(fset, formattedASTFile) - - formattedBuffer.Reset() - if err := printer.Fprint(formattedBuffer, fset, astFile); err != nil { - return nil, err - } - return formattedBuffer.Bytes(), nil }