File tree Expand file tree Collapse file tree 1 file changed +1
-27
lines changed
Expand file tree Collapse file tree 1 file changed +1
-27
lines changed Original file line number Diff line number Diff line change 44 "bytes"
55 "encoding/json"
66 "fmt"
7- "io"
87 "net/http"
98 "os"
109 "os/exec"
@@ -20,27 +19,6 @@ import (
2019 "github.com/spf13/viper"
2120)
2221
23- // emptyState implements a dummy fmt.State that passes through to a writer.
24- type emptyState struct {
25- writer io.Writer
26- }
27-
28- func (e * emptyState ) Write (b []byte ) (n int , err error ) {
29- return e .writer .Write (b )
30- }
31-
32- func (e * emptyState ) Width () (wid int , ok bool ) {
33- return 0 , true
34- }
35-
36- func (e * emptyState ) Precision () (prec int , ok bool ) {
37- return 0 , true
38- }
39-
40- func (e * emptyState ) Flag (c int ) bool {
41- return false
42- }
43-
4422func panicOnErr (err error ) {
4523 if err != nil {
4624 panic (err )
@@ -170,11 +148,7 @@ export EDITOR="vim"`)
170148 exitFunc (0 )
171149 return
172150 } else {
173- sb := & strings.Builder {}
174- s := & emptyState {writer : sb }
175- unified := gotextdiff .ToUnified ("original" , "modified" , string (orig ), edits )
176- unified .Format (s , ' ' )
177- diff := sb .String ()
151+ diff := fmt .Sprint (gotextdiff .ToUnified ("original" , "modified" , string (orig ), edits ))
178152 if tty {
179153 d , _ := Highlight ("diff" , []byte (diff ))
180154 diff = string (d )
You can’t perform that action at this time.
0 commit comments