Merge pull request #3704 from dmaluka/gofmt-cleanup
Some checks failed
Build and Test / test (1.19.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.19.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.19.x, windows-latest) (push) Has been cancelled
Build and Test / test (1.23.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.23.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.23.x, windows-latest) (push) Has been cancelled

gofmt cleanup
This commit is contained in:
Jöran Karl 2025-03-25 20:19:52 +01:00 committed by GitHub
commit f4d62a498b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 40 additions and 41 deletions

View File

@ -18,6 +18,7 @@ import (
"github.com/go-errors/errors" "github.com/go-errors/errors"
isatty "github.com/mattn/go-isatty" isatty "github.com/mattn/go-isatty"
"github.com/micro-editor/tcell/v2"
lua "github.com/yuin/gopher-lua" lua "github.com/yuin/gopher-lua"
"github.com/zyedidia/micro/v2/internal/action" "github.com/zyedidia/micro/v2/internal/action"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
@ -26,7 +27,6 @@ import (
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/shell" "github.com/zyedidia/micro/v2/internal/shell"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
var ( var (

View File

@ -7,12 +7,12 @@ import (
"testing" "testing"
"github.com/go-errors/errors" "github.com/go-errors/errors"
"github.com/micro-editor/tcell/v2"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/zyedidia/micro/v2/internal/action" "github.com/zyedidia/micro/v2/internal/action"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/micro-editor/tcell/v2"
) )
var tempDir string var tempDir string

View File

@ -11,6 +11,7 @@ import (
"time" "time"
shellquote "github.com/kballard/go-shellquote" shellquote "github.com/kballard/go-shellquote"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/clipboard" "github.com/zyedidia/micro/v2/internal/clipboard"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
@ -18,7 +19,6 @@ import (
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/shell" "github.com/zyedidia/micro/v2/internal/shell"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
// ScrollUp is not an action // ScrollUp is not an action

View File

@ -1,4 +1,4 @@
// +build plan9 nacl windows //go:build plan9 || nacl || windows
package action package action

View File

@ -1,4 +1,4 @@
// +build linux darwin dragonfly solaris openbsd netbsd freebsd //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
package action package action

View File

@ -12,10 +12,10 @@ import (
"unicode" "unicode"
"github.com/micro-editor/json5" "github.com/micro-editor/json5"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
var Binder = map[string]func(e Event, action string){ var Binder = map[string]func(e Event, action string){

View File

@ -6,6 +6,7 @@ import (
luar "layeh.com/gopher-luar" luar "layeh.com/gopher-luar"
"github.com/micro-editor/tcell/v2"
lua "github.com/yuin/gopher-lua" lua "github.com/yuin/gopher-lua"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
@ -13,7 +14,6 @@ import (
ulua "github.com/zyedidia/micro/v2/internal/lua" ulua "github.com/zyedidia/micro/v2/internal/lua"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
type BufAction interface{} type BufAction interface{}

View File

@ -3,12 +3,12 @@ package action
import ( import (
"bytes" "bytes"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/micro/v2/internal/display"
"github.com/zyedidia/micro/v2/internal/info" "github.com/zyedidia/micro/v2/internal/info"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
type InfoKeyAction func(*InfoPane) type InfoKeyAction func(*InfoPane)

View File

@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/micro/v2/internal/display"
"github.com/micro-editor/tcell/v2"
) )
type RawPane struct { type RawPane struct {

View File

@ -3,13 +3,13 @@ package action
import ( import (
luar "layeh.com/gopher-luar" luar "layeh.com/gopher-luar"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/micro/v2/internal/display"
ulua "github.com/zyedidia/micro/v2/internal/lua" ulua "github.com/zyedidia/micro/v2/internal/lua"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/views" "github.com/zyedidia/micro/v2/internal/views"
"github.com/micro-editor/tcell/v2"
) )
// The TabList is a list of tabs and a window to display the tab bar // The TabList is a list of tabs and a window to display the tab bar
@ -211,7 +211,7 @@ func InitTabs(bufs []*buffer.Buffer) {
for _, b := range bufs[1:] { for _, b := range bufs[1:] {
if multiopen == "vsplit" { if multiopen == "vsplit" {
MainTab().CurPane().VSplitBuf(b) MainTab().CurPane().VSplitBuf(b)
} else { // default hsplit } else { // default hsplit
MainTab().CurPane().HSplitBuf(b) MainTab().CurPane().HSplitBuf(b)
} }
} }

View File

@ -1,4 +1,4 @@
// +build linux darwin dragonfly openbsd_amd64 freebsd //go:build linux || darwin || dragonfly || openbsd_amd64 || freebsd
package action package action

View File

@ -1,4 +1,4 @@
// +build !linux,!darwin,!freebsd,!dragonfly,!openbsd_amd64 //go:build !linux && !darwin && !freebsd && !dragonfly && !openbsd_amd64
package action package action

View File

@ -4,13 +4,13 @@ import (
"errors" "errors"
"runtime" "runtime"
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
"github.com/zyedidia/micro/v2/internal/clipboard" "github.com/zyedidia/micro/v2/internal/clipboard"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/micro/v2/internal/display"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/shell" "github.com/zyedidia/micro/v2/internal/shell"
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
) )
type TermKeyAction func(*TermPane) type TermKeyAction func(*TermPane)

View File

@ -1,8 +1,8 @@
package buffer package buffer
import ( import (
"github.com/zyedidia/micro/v2/internal/config"
"github.com/micro-editor/tcell/v2" "github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/config"
) )
type MsgType int type MsgType int

View File

@ -4,8 +4,8 @@ import (
"errors" "errors"
"time" "time"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/micro-editor/tcell/v2" "github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/screen"
) )
type terminalClipboard struct{} type terminalClipboard struct{}

View File

@ -3,8 +3,8 @@ package config
import ( import (
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/micro-editor/tcell/v2" "github.com/micro-editor/tcell/v2"
"github.com/stretchr/testify/assert"
) )
func TestSimpleStringToStyle(t *testing.T) { func TestSimpleStringToStyle(t *testing.T) {

View File

@ -71,7 +71,7 @@ type Plugin struct {
Info *PluginInfo // json file containing info Info *PluginInfo // json file containing info
Srcs []RuntimeFile // lua files Srcs []RuntimeFile // lua files
Loaded bool Loaded bool
Default bool // pre-installed plugin Default bool // pre-installed plugin
} }
// IsLoaded returns if a plugin is enabled // IsLoaded returns if a plugin is enabled

View File

@ -13,8 +13,8 @@ import (
"sync" "sync"
"github.com/blang/semver" "github.com/blang/semver"
lua "github.com/yuin/gopher-lua"
"github.com/micro-editor/json5" "github.com/micro-editor/json5"
lua "github.com/yuin/gopher-lua"
ulua "github.com/zyedidia/micro/v2/internal/lua" ulua "github.com/zyedidia/micro/v2/internal/lua"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
) )

View File

@ -11,8 +11,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/zyedidia/glob"
"github.com/micro-editor/json5" "github.com/micro-editor/json5"
"github.com/zyedidia/glob"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"golang.org/x/text/encoding/htmlindex" "golang.org/x/text/encoding/htmlindex"
) )

View File

@ -4,11 +4,11 @@ import (
"strconv" "strconv"
runewidth "github.com/mattn/go-runewidth" runewidth "github.com/mattn/go-runewidth"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
// The BufWindow provides a way of displaying a certain section of a buffer. // The BufWindow provides a way of displaying a certain section of a buffer.

View File

@ -2,12 +2,12 @@ package display
import ( import (
runewidth "github.com/mattn/go-runewidth" runewidth "github.com/mattn/go-runewidth"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/info" "github.com/zyedidia/micro/v2/internal/info"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
type InfoWindow struct { type InfoWindow struct {

View File

@ -291,7 +291,7 @@ func (w *BufWindow) diff(s1, s2 SLoc) int {
// within the buffer boundaries. // within the buffer boundaries.
func (w *BufWindow) Scroll(s SLoc, n int) SLoc { func (w *BufWindow) Scroll(s SLoc, n int) SLoc {
if !w.Buf.Settings["softwrap"].(bool) { if !w.Buf.Settings["softwrap"].(bool) {
s.Line = util.Clamp(s.Line + n, 0, w.Buf.LinesNum()-1) s.Line = util.Clamp(s.Line+n, 0, w.Buf.LinesNum()-1)
return s return s
} }
return w.scroll(s, n) return w.scroll(s, n)

View File

@ -112,10 +112,10 @@ func (w *TabWindow) Display() {
} }
return tabBarStyle, tabBarActiveStyle return tabBarStyle, tabBarActiveStyle
} }
draw := func(r rune, n int, active bool, reversed bool) { draw := func(r rune, n int, active bool, reversed bool) {
tabBarStyle, tabBarActiveStyle := reverseStyles(reversed) tabBarStyle, tabBarActiveStyle := reverseStyles(reversed)
style := tabBarStyle style := tabBarStyle
if active { if active {
style = tabBarActiveStyle style = tabBarActiveStyle
@ -147,15 +147,15 @@ func (w *TabWindow) Display() {
} else { } else {
draw(' ', 1, false, tabCharHighlight) draw(' ', 1, false, tabCharHighlight)
} }
for _, c := range n { for _, c := range n {
draw(c, 1, i == w.active, tabCharHighlight) draw(c, 1, i == w.active, tabCharHighlight)
} }
if i == len(w.Names)-1 { if i == len(w.Names)-1 {
done = true done = true
} }
if i == w.active { if i == w.active {
draw(']', 1, true, tabCharHighlight) draw(']', 1, true, tabCharHighlight)
draw(' ', 2, true, globalTabReverse) draw(' ', 2, true, globalTabReverse)
@ -163,7 +163,7 @@ func (w *TabWindow) Display() {
draw(' ', 1, false, tabCharHighlight) draw(' ', 1, false, tabCharHighlight)
draw(' ', 2, false, globalTabReverse) draw(' ', 2, false, globalTabReverse)
} }
if x >= w.Width { if x >= w.Width {
break break
} }

View File

@ -1,13 +1,13 @@
package display package display
import ( import (
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/shell" "github.com/zyedidia/micro/v2/internal/shell"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
) )
type TermWindow struct { type TermWindow struct {

View File

@ -6,9 +6,9 @@ import (
"os" "os"
"sync" "sync"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
) )
// Screen is the tcell screen we use to draw to the terminal // Screen is the tcell screen we use to draw to the terminal

View File

@ -5,9 +5,9 @@ import (
"os/exec" "os/exec"
"strconv" "strconv"
"github.com/micro-editor/terminal"
"github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/screen"
"github.com/micro-editor/terminal"
) )
type TermType int type TermType int

View File

@ -162,7 +162,7 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
if curRegion.group == curRegion.limitGroup || p.group == curRegion.limitGroup { if curRegion.group == curRegion.limitGroup || p.group == curRegion.limitGroup {
matches := findAllIndex(p.regex, line) matches := findAllIndex(p.regex, line)
for _, m := range matches { for _, m := range matches {
if ((endLoc == nil) || (m[0] < endLoc[0])) { if (endLoc == nil) || (m[0] < endLoc[0]) {
for i := m[0]; i < m[1]; i++ { for i := m[0]; i < m[1]; i++ {
fullHighlights[i] = p.group fullHighlights[i] = p.group
} }

View File

@ -1,4 +1,4 @@
//+build ignore //go:build ignore
package main package main

View File

@ -1,4 +1,4 @@
//+build ignore //go:build ignore
package main package main

View File

@ -1,4 +1,4 @@
//+build ignore //go:build ignore
package main package main

View File

@ -1,5 +1,4 @@
//go:build ignore //go:build ignore
// +build ignore
package main package main

View File

@ -1,4 +1,4 @@
//+build ignore //go:build ignore
package main package main

View File

@ -1,4 +1,4 @@
//+build ignore //go:build ignore
package main package main