From 7e946a07035caae6fd1622d588abc7872a3a8158 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 22 Apr 2018 20:13:57 +0300 Subject: Fix golint warnings --- config/config.go | 5 ++--- ui/messages/message.go | 2 +- ui/messages/parser/htmltagarray.go | 4 ++-- ui/room-view.go | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index 55601df..e11b17a 100644 --- a/config/config.go +++ b/config/config.go @@ -66,10 +66,9 @@ func (config *Config) Load() { os.MkdirAll(config.HistoryDir, 0700) os.MkdirAll(config.MediaDir, 0700) return - } else { - fmt.Println("Failed to read config from", configPath) - panic(err) } + fmt.Println("Failed to read config from", configPath) + panic(err) } err = yaml.Unmarshal(data, &config) diff --git a/ui/messages/message.go b/ui/messages/message.go index d3f2db4..637e8eb 100644 --- a/ui/messages/message.go +++ b/ui/messages/message.go @@ -21,7 +21,7 @@ import ( "maunium.net/go/gomuks/ui/messages/tstring" ) -// Message is a wrapper for the content and metadata of a Matrix message intended to be displayed. +// UIMessage is a wrapper for the content and metadata of a Matrix message intended to be displayed. type UIMessage interface { ifc.Message diff --git a/ui/messages/parser/htmltagarray.go b/ui/messages/parser/htmltagarray.go index d66d7d9..464caa9 100644 --- a/ui/messages/parser/htmltagarray.go +++ b/ui/messages/parser/htmltagarray.go @@ -35,7 +35,7 @@ func (ta *TagArray) Push(tag string) { ta.PushMeta(&TagWithMeta{Tag: tag}) } -// Push adds the given tag to the array. +// PushMeta adds the given tag to the array. func (ta *TagArray) PushMeta(tag *TagWithMeta) { *ta = append(*ta, BlankTag) copy((*ta)[1:], *ta) @@ -78,7 +78,7 @@ func (ta *TagArray) Get(tag string) *TagWithMeta { return ta.GetAfter(tag, -1) } -// IndexAfter returns the first occurrence of the given tag, or nil if the given +// GetAfter returns the first occurrence of the given tag, or nil if the given // tag is not on the list after the given index. func (ta *TagArray) GetAfter(tag string, after int) *TagWithMeta { for i := after + 1; i < len(*ta); i++ { diff --git a/ui/room-view.go b/ui/room-view.go index a66b0ee..bfcb547 100644 --- a/ui/room-view.go +++ b/ui/room-view.go @@ -241,7 +241,7 @@ type completion struct { id string } -func (view *RoomView) AutocompleteUser(existingText string) (completions []completion) { +func (view *RoomView) autocompleteUser(existingText string) (completions []completion) { textWithoutPrefix := strings.TrimPrefix(existingText, "@") for _, user := range view.Room.GetMembers() { if user.DisplayName == textWithoutPrefix || user.UserID == existingText { @@ -256,7 +256,7 @@ func (view *RoomView) AutocompleteUser(existingText string) (completions []compl return } -func (view *RoomView) AutocompleteRoom(existingText string) (completions []completion) { +func (view *RoomView) autocompleteRoom(existingText string) (completions []completion) { // TODO - This was harder than I expected. return []completion{} @@ -270,8 +270,8 @@ func (view *RoomView) InputTabComplete(text string, cursorOffset int) { var strCompletions []string var strCompletion string - completions := view.AutocompleteUser(word) - completions = append(completions, view.AutocompleteRoom(word)...) + completions := view.autocompleteUser(word) + completions = append(completions, view.autocompleteRoom(word)...) if len(completions) == 1 { completion := completions[0] -- cgit v1.2.3