aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-06-02 00:44:21 +0300
committerTulir Asokan <tulir@maunium.net>2018-06-02 00:44:21 +0300
commitb9079e22d201e92e54275480fb6007d7d9900141 (patch)
tree4a60221bcde5c8226788e501ab3df16c533185db
parent134604edce935a0017b50c16687429e0b25248e6 (diff)
Gofmt
-rw-r--r--config/config.go2
-rw-r--r--matrix/matrix.go4
-rw-r--r--ui/command-processor.go6
-rw-r--r--ui/commands.go2
-rw-r--r--ui/message-view.go2
-rw-r--r--ui/messages/base.go4
-rw-r--r--ui/messages/expandedtextmessage.go4
-rw-r--r--ui/messages/imagemessage.go4
-rw-r--r--ui/messages/message.go2
-rw-r--r--ui/messages/parser/htmlparser.go4
-rw-r--r--ui/messages/parser/parser.go2
-rw-r--r--ui/messages/textbase.go8
-rw-r--r--ui/messages/textmessage.go4
-rw-r--r--ui/messages/tstring/string.go2
-rw-r--r--ui/room-view.go4
-rw-r--r--ui/view-main.go2
16 files changed, 28 insertions, 28 deletions
diff --git a/config/config.go b/config/config.go
index 616b134..09e7f0d 100644
--- a/config/config.go
+++ b/config/config.go
@@ -21,13 +21,13 @@ import (
"os"
"path/filepath"
+ "encoding/json"
"gopkg.in/yaml.v2"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/matrix/pushrules"
"maunium.net/go/gomuks/matrix/rooms"
"strings"
- "encoding/json"
)
type AuthCache struct {
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 556df4e..654f081 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -30,6 +30,8 @@ import (
"strings"
"time"
+ "crypto/tls"
+ "encoding/json"
"gopkg.in/russross/blackfriday.v2"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/config"
@@ -38,8 +40,6 @@ import (
"maunium.net/go/gomuks/lib/bfhtml"
"maunium.net/go/gomuks/matrix/pushrules"
"maunium.net/go/gomuks/matrix/rooms"
- "crypto/tls"
- "encoding/json"
)
// Container is a wrapper for a gomatrix Client and some other stuff.
diff --git a/ui/command-processor.go b/ui/command-processor.go
index 04ade4d..2fe47bf 100644
--- a/ui/command-processor.go
+++ b/ui/command-processor.go
@@ -17,11 +17,11 @@
package ui
import (
- "maunium.net/go/gomuks/interface"
- "strings"
+ "fmt"
"maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/debug"
- "fmt"
+ "maunium.net/go/gomuks/interface"
+ "strings"
)
type gomuksPointerContainer struct {
diff --git a/ui/commands.go b/ui/commands.go
index 5c0e90b..510fc5d 100644
--- a/ui/commands.go
+++ b/ui/commands.go
@@ -17,9 +17,9 @@
package ui
import (
+ "encoding/json"
"maunium.net/go/gomuks/debug"
"strings"
- "encoding/json"
)
func cmdMe(cmd *Command) {
diff --git a/ui/message-view.go b/ui/message-view.go
index c3f5a8a..2dffa57 100644
--- a/ui/message-view.go
+++ b/ui/message-view.go
@@ -24,13 +24,13 @@ import (
"strings"
"github.com/mattn/go-runewidth"
+ "maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/lib/open"
"maunium.net/go/gomuks/ui/messages"
"maunium.net/go/gomuks/ui/messages/tstring"
"maunium.net/go/gomuks/ui/widget"
- "maunium.net/go/gomuks/config"
"maunium.net/go/tcell"
"maunium.net/go/tview"
)
diff --git a/ui/messages/base.go b/ui/messages/base.go
index 02bbddb..6049ae3 100644
--- a/ui/messages/base.go
+++ b/ui/messages/base.go
@@ -20,11 +20,11 @@ import (
"encoding/gob"
"time"
+ "maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/ui/messages/tstring"
"maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tcell"
- "maunium.net/go/gomuks/config"
)
func init() {
@@ -44,7 +44,7 @@ type BaseMessage struct {
buffer []tstring.TString
plainBuffer []tstring.TString
prevBufferWidth int
- prevPrefs config.UserPreferences
+ prevPrefs config.UserPreferences
}
func newBaseMessage(id, sender, displayname, msgtype string, timestamp time.Time) BaseMessage {
diff --git a/ui/messages/expandedtextmessage.go b/ui/messages/expandedtextmessage.go
index 33e5514..c69f3dc 100644
--- a/ui/messages/expandedtextmessage.go
+++ b/ui/messages/expandedtextmessage.go
@@ -20,8 +20,8 @@ import (
"encoding/gob"
"time"
- "maunium.net/go/gomuks/ui/messages/tstring"
"maunium.net/go/gomuks/config"
+ "maunium.net/go/gomuks/ui/messages/tstring"
)
func init() {
@@ -37,7 +37,7 @@ type ExpandedTextMessage struct {
func NewExpandedTextMessage(id, sender, displayname, msgtype string, text tstring.TString, timestamp time.Time) UIMessage {
return &ExpandedTextMessage{
BaseMessage: newBaseMessage(id, sender, displayname, msgtype, timestamp),
- MsgText: text,
+ MsgText: text,
}
}
diff --git a/ui/messages/imagemessage.go b/ui/messages/imagemessage.go
index 671148b..dcbe1c5 100644
--- a/ui/messages/imagemessage.go
+++ b/ui/messages/imagemessage.go
@@ -24,12 +24,12 @@ import (
"image/color"
+ "maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/lib/ansimage"
"maunium.net/go/gomuks/ui/messages/tstring"
"maunium.net/go/tcell"
- "maunium.net/go/gomuks/config"
)
func init() {
@@ -38,7 +38,7 @@ func init() {
type ImageMessage struct {
BaseMessage
- Body string
+ Body string
Homeserver string
FileID string
data []byte
diff --git a/ui/messages/message.go b/ui/messages/message.go
index 3f1e694..b5ef1b8 100644
--- a/ui/messages/message.go
+++ b/ui/messages/message.go
@@ -17,9 +17,9 @@
package messages
import (
+ "maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/ui/messages/tstring"
- "maunium.net/go/gomuks/config"
)
// UIMessage is a wrapper for the content and metadata of a Matrix message intended to be displayed.
diff --git a/ui/messages/parser/htmlparser.go b/ui/messages/parser/htmlparser.go
index 9999c94..98894fd 100644
--- a/ui/messages/parser/htmlparser.go
+++ b/ui/messages/parser/htmlparser.go
@@ -22,12 +22,12 @@ import (
"regexp"
"strings"
+ "golang.org/x/net/html"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/matrix/rooms"
"maunium.net/go/gomuks/ui/messages/tstring"
"maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tcell"
- "golang.org/x/net/html"
"strconv"
)
@@ -68,7 +68,7 @@ func (parser *htmlParser) getAttribute(node *html.Node, attribute string) string
}
func digits(num int) int {
- return int(math.Floor(math.Log10(float64(num)))+1)
+ return int(math.Floor(math.Log10(float64(num))) + 1)
}
func (parser *htmlParser) listToTString(node *html.Node, stripLinebreak bool) tstring.TString {
diff --git a/ui/messages/parser/parser.go b/ui/messages/parser/parser.go
index d06223a..c84a7f4 100644
--- a/ui/messages/parser/parser.go
+++ b/ui/messages/parser/parser.go
@@ -147,7 +147,7 @@ func getMembershipEventContent(room *rooms.Room, evt *gomatrix.Event) (sender st
text = tstring.NewColorTString(fmt.Sprintf("%s changed their display name to %s.", prevDisplayname, displayname), tcell.ColorGreen)
color := widget.GetHashColor(*evt.StateKey)
text.Colorize(0, len(prevDisplayname), color)
- text.Colorize(len(prevDisplayname) + len(" changed their display name to "), len(displayname), color)
+ text.Colorize(len(prevDisplayname)+len(" changed their display name to "), len(displayname), color)
}
return
}
diff --git a/ui/messages/textbase.go b/ui/messages/textbase.go
index e00ebc4..4b242b4 100644
--- a/ui/messages/textbase.go
+++ b/ui/messages/textbase.go
@@ -17,19 +17,19 @@
package messages
import (
- "regexp"
- "maunium.net/go/gomuks/ui/messages/tstring"
"fmt"
"maunium.net/go/gomuks/config"
+ "maunium.net/go/gomuks/ui/messages/tstring"
+ "regexp"
)
// Regular expressions used to split lines when calculating the buffer.
//
// From tview/textview.go
var (
- boundaryPattern = regexp.MustCompile(`([[:punct:]]\s*|\s+)`)
+ boundaryPattern = regexp.MustCompile(`([[:punct:]]\s*|\s+)`)
bareBoundaryPattern = regexp.MustCompile(`(\s+)`)
- spacePattern = regexp.MustCompile(`\s+`)
+ spacePattern = regexp.MustCompile(`\s+`)
)
func matchBoundaryPattern(bare bool, extract tstring.TString) tstring.TString {
diff --git a/ui/messages/textmessage.go b/ui/messages/textmessage.go
index add8588..d268688 100644
--- a/ui/messages/textmessage.go
+++ b/ui/messages/textmessage.go
@@ -21,9 +21,9 @@ import (
"fmt"
"time"
+ "maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/ui/messages/tstring"
- "maunium.net/go/gomuks/config"
)
func init() {
@@ -40,7 +40,7 @@ type TextMessage struct {
func NewTextMessage(id, sender, displayname, msgtype, text string, timestamp time.Time) UIMessage {
return &TextMessage{
BaseMessage: newBaseMessage(id, sender, displayname, msgtype, timestamp),
- MsgText: text,
+ MsgText: text,
}
}
diff --git a/ui/messages/tstring/string.go b/ui/messages/tstring/string.go
index 770b4fb..3de876f 100644
--- a/ui/messages/tstring/string.go
+++ b/ui/messages/tstring/string.go
@@ -108,7 +108,7 @@ func (str TString) TrimLeft(fn func(rune) bool) TString {
}
func (str TString) TrimRight(fn func(rune) bool) TString {
- for i := len(str)-1; i >= 0; i-- {
+ for i := len(str) - 1; i >= 0; i-- {
if !fn(str[i].Char) {
return append(NewBlankTString(), str[:i+1]...)
}
diff --git a/ui/room-view.go b/ui/room-view.go
index efd144d..bb8f5ec 100644
--- a/ui/room-view.go
+++ b/ui/room-view.go
@@ -25,6 +25,7 @@ import (
"time"
"github.com/mattn/go-runewidth"
+ "maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/lib/util"
"maunium.net/go/gomuks/matrix/rooms"
@@ -32,7 +33,6 @@ import (
"maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tcell"
"maunium.net/go/tview"
- "maunium.net/go/gomuks/config"
)
type RoomView struct {
@@ -154,7 +154,7 @@ func (view *RoomView) GetStatus() string {
var buf strings.Builder
if len(view.completions.list) > 0 {
- if view.completions.textCache != view.input.GetText() || view.completions.time.Add(10 * time.Second).Before(time.Now()) {
+ if view.completions.textCache != view.input.GetText() || view.completions.time.Add(10*time.Second).Before(time.Now()) {
view.completions.list = []string{}
} else {
buf.WriteString(strings.Join(view.completions.list, ", "))
diff --git a/ui/view-main.go b/ui/view-main.go
index b83187e..fe2db76 100644
--- a/ui/view-main.go
+++ b/ui/view-main.go
@@ -21,6 +21,7 @@ import (
"time"
"unicode"
+ "bufio"
"maunium.net/go/gomatrix"
"maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/debug"
@@ -32,7 +33,6 @@ import (
"maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tcell"
"maunium.net/go/tview"
- "bufio"
"os"
)