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"
isatty "github.com/mattn/go-isatty"
"github.com/micro-editor/tcell/v2"
lua "github.com/yuin/gopher-lua"
"github.com/zyedidia/micro/v2/internal/action"
"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/shell"
"github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
)
var (

View File

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

View File

@ -11,6 +11,7 @@ import (
"time"
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/clipboard"
"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/shell"
"github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
)
// ScrollUp is not an action

View File

@ -1,4 +1,4 @@
// +build plan9 nacl windows
//go:build plan9 || nacl || windows
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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,13 +3,13 @@ package action
import (
luar "layeh.com/gopher-luar"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/config"
"github.com/zyedidia/micro/v2/internal/display"
ulua "github.com/zyedidia/micro/v2/internal/lua"
"github.com/zyedidia/micro/v2/internal/screen"
"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
@ -211,7 +211,7 @@ func InitTabs(bufs []*buffer.Buffer) {
for _, b := range bufs[1:] {
if multiopen == "vsplit" {
MainTab().CurPane().VSplitBuf(b)
} else { // default hsplit
} else { // default hsplit
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

View File

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

View File

@ -4,13 +4,13 @@ import (
"errors"
"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/config"
"github.com/zyedidia/micro/v2/internal/display"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/shell"
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
)
type TermKeyAction func(*TermPane)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,11 +4,11 @@ import (
"strconv"
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/config"
"github.com/zyedidia/micro/v2/internal/screen"
"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.

View File

@ -2,12 +2,12 @@ package display
import (
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/config"
"github.com/zyedidia/micro/v2/internal/info"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
)
type InfoWindow struct {

View File

@ -291,7 +291,7 @@ func (w *BufWindow) diff(s1, s2 SLoc) int {
// within the buffer boundaries.
func (w *BufWindow) Scroll(s SLoc, n int) SLoc {
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 w.scroll(s, n)

View File

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

View File

@ -1,13 +1,13 @@
package display
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/config"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/zyedidia/micro/v2/internal/shell"
"github.com/zyedidia/micro/v2/internal/util"
"github.com/micro-editor/tcell/v2"
"github.com/micro-editor/terminal"
)
type TermWindow struct {

View File

@ -6,9 +6,9 @@ import (
"os"
"sync"
"github.com/micro-editor/tcell/v2"
"github.com/zyedidia/micro/v2/internal/config"
"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

View File

@ -5,9 +5,9 @@ import (
"os/exec"
"strconv"
"github.com/micro-editor/terminal"
"github.com/zyedidia/micro/v2/internal/buffer"
"github.com/zyedidia/micro/v2/internal/screen"
"github.com/micro-editor/terminal"
)
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 {
matches := findAllIndex(p.regex, line)
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++ {
fullHighlights[i] = p.group
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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