Update deps and stop using github.com/pkg/errors
This commit is contained in:
parent
c6185780f4
commit
d103d005a3
17
go.mod
17
go.mod
@ -3,27 +3,26 @@ module maunium.net/go/gomuks
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/alecthomas/chroma v0.8.0
|
||||
github.com/alecthomas/chroma v0.8.1
|
||||
github.com/disintegration/imaging v1.6.2
|
||||
github.com/gabriel-vasile/mimetype v1.1.1
|
||||
github.com/kyokomi/emoji v2.2.2+incompatible
|
||||
github.com/lithammer/fuzzysearch v1.1.0
|
||||
github.com/kyokomi/emoji/v2 v2.2.5
|
||||
github.com/lithammer/fuzzysearch v1.1.1
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3
|
||||
github.com/mattn/go-runewidth v0.0.9
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
|
||||
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rivo/uniseg v0.1.0
|
||||
github.com/russross/blackfriday/v2 v2.0.1
|
||||
github.com/sasha-s/go-deadlock v0.2.0
|
||||
github.com/zyedidia/clipboard v0.0.0-20200421031010-7c45b8673834
|
||||
go.etcd.io/bbolt v1.3.4
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202
|
||||
github.com/zyedidia/clipboard v1.0.3
|
||||
go.etcd.io/bbolt v1.3.5
|
||||
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5
|
||||
golang.org/x/net v0.0.0-20201022231255-08b38378de70
|
||||
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
|
||||
gopkg.in/vansante/go-ffprobe.v2 v2.0.2
|
||||
gopkg.in/yaml.v2 v2.3.0
|
||||
maunium.net/go/mautrix v0.7.6
|
||||
maunium.net/go/mautrix v0.7.13
|
||||
maunium.net/go/mauview v0.1.2
|
||||
maunium.net/go/tcell v0.2.0
|
||||
)
|
||||
|
20
go.sum
20
go.sum
@ -3,6 +3,8 @@ github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm
|
||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
|
||||
github.com/alecthomas/chroma v0.8.0 h1:HS+HE97sgcqjQGu5uVr8jIE55Mmh5UeQ7kckAhHg2pY=
|
||||
github.com/alecthomas/chroma v0.8.0/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
|
||||
github.com/alecthomas/chroma v0.8.1 h1:ym20sbvyC6RXz45u4qDglcgr8E313oPROshcuCHqiEE=
|
||||
github.com/alecthomas/chroma v0.8.1/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
|
||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
|
||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
|
||||
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
|
||||
@ -25,10 +27,14 @@ github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo
|
||||
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/kyokomi/emoji v2.2.2+incompatible h1:gaQFbK2+uSxOR4iGZprJAbpmtqTrHhSdgOyIMD6Oidc=
|
||||
github.com/kyokomi/emoji v2.2.2+incompatible/go.mod h1:mZ6aGCD7yk8j6QY6KICwnZ2pxoszVseX1DNoGtU2tBA=
|
||||
github.com/kyokomi/emoji/v2 v2.2.5 h1:sxOmQKMB3ICTDWiJbtMHUnKn1HFHjGk9av0+IYWVovI=
|
||||
github.com/kyokomi/emoji/v2 v2.2.5/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE=
|
||||
github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY=
|
||||
github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/lithammer/fuzzysearch v1.1.0 h1:go9v8tLCrNTTlH42OAaq4eHFe81TDHEnlrMEb6R4f+A=
|
||||
github.com/lithammer/fuzzysearch v1.1.0/go.mod h1:Bqx4wo8lTOFcJr3ckpY6HA9lEIOO0H5HrkJ5CsN56HQ=
|
||||
github.com/lithammer/fuzzysearch v1.1.1 h1:8F9OAV2xPuYblToVohjanztdnPjbtA0MLgMvDKQ0Z08=
|
||||
github.com/lithammer/fuzzysearch v1.1.1/go.mod h1:H2bng+w5gsR7NlfIJM8ElGZI0sX6C/9uzGqicVXGU6c=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
@ -74,10 +80,14 @@ github.com/tidwall/sjson v1.1.1 h1:7h1vk049Jnd5EH9NyzNiEuwYW4b5qgreBbqRC19AS3U=
|
||||
github.com/tidwall/sjson v1.1.1/go.mod h1:yvVuSnpEQv5cYIrO+AT6kw4QVfd5SDZoGIS7/5+fZFs=
|
||||
github.com/zyedidia/clipboard v0.0.0-20200421031010-7c45b8673834 h1:0nOfq3JwYRiY3+nwfWVQYEaXDmGCQgj3RKoqTifLzP4=
|
||||
github.com/zyedidia/clipboard v0.0.0-20200421031010-7c45b8673834/go.mod h1:zykFnZUXX0ErxqvYLUFEq7QDJKId8rmh2FgD0/Y8cjA=
|
||||
github.com/zyedidia/clipboard v1.0.3 h1:F/nCDVYMdbDWTmY8s8cJl0tnwX32q96IF09JHM14bUI=
|
||||
github.com/zyedidia/clipboard v1.0.3/go.mod h1:zykFnZUXX0ErxqvYLUFEq7QDJKId8rmh2FgD0/Y8cjA=
|
||||
github.com/zyedidia/poller v1.0.1 h1:Tt9S3AxAjXwWGNiC2TUdRJkQDZSzCBNVQ4xXiQ7440s=
|
||||
github.com/zyedidia/poller v1.0.1/go.mod h1:vZXJOHGDcuK08GXhF6IAY0ZFd2WcgOR5DOTp84Uk5eE=
|
||||
go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
|
||||
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
|
||||
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
@ -85,6 +95,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 h1:QelT11PB4FXiDEXucrfNckHoFxwt8USGY1ajP1ZF5lM=
|
||||
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
@ -93,6 +105,8 @@ golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYc
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201022231255-08b38378de70 h1:Z6x4N9mAi4oF0TbHweCsH618MO6OI6UFgV0FP5n0wBY=
|
||||
golang.org/x/net v0.0.0-20201022231255-08b38378de70/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -102,9 +116,13 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 h1:5B6i6EAiSYyejWfvc5Rc9BbI3rzIsrrXfAQBWnYfn+w=
|
||||
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@ -119,6 +137,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
maunium.net/go/maulogger/v2 v2.1.1/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
|
||||
maunium.net/go/mautrix v0.7.6 h1:jB9oCimPq0mVyolwQBC/9N1fu21AU+Ryq837cLf4gOo=
|
||||
maunium.net/go/mautrix v0.7.6/go.mod h1:Va/74MijqaS0DQ3aUqxmFO54/PMfr1LVsCOcGRHbYmo=
|
||||
maunium.net/go/mautrix v0.7.13 h1:qfnvLxvQafvLgHbdZF/+9qs9gyArYf8fUnzfQbjgQaU=
|
||||
maunium.net/go/mautrix v0.7.13/go.mod h1:Jn0ijwXwMFvJFIN9IljirIVKpZQbZP/Dk7pdX2qDmXk=
|
||||
maunium.net/go/mauview v0.1.1 h1:wfTXyPx3LGAGpTskh+UbBv/QItUWnEpaneHmywoYnfY=
|
||||
maunium.net/go/mauview v0.1.1/go.mod h1:3QBUiuLct9moP1LgDhCGIg0Ovxn38Bd2sGndnUOuj4o=
|
||||
maunium.net/go/mauview v0.1.2 h1:6Y3GpyckIlzCNkry6k025YhWg8oh5XJFj3RAMf4VwWo=
|
||||
|
@ -19,10 +19,9 @@
|
||||
package matrix
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"maunium.net/go/mautrix/crypto"
|
||||
|
||||
"maunium.net/go/gomuks/debug"
|
||||
@ -53,14 +52,14 @@ func isBadEncryptError(err error) bool {
|
||||
func (c *Container) initCrypto() error {
|
||||
cryptoStore, err := crypto.NewGobStore(filepath.Join(c.config.DataDir, "crypto.gob"))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to open crypto store")
|
||||
return fmt.Errorf("failed to open crypto store: %w", err)
|
||||
}
|
||||
crypt := crypto.NewOlmMachine(c.client, cryptoLogger{}, cryptoStore, c.config.Rooms)
|
||||
crypt.AllowUnverifiedDevices = !c.config.SendToVerifiedOnly
|
||||
c.crypto = crypt
|
||||
err = c.crypto.Load()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to create olm machine")
|
||||
return fmt.Errorf("failed to create olm machine: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ import (
|
||||
"runtime"
|
||||
dbg "runtime/debug"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"errors"
|
||||
|
||||
"maunium.net/go/mautrix"
|
||||
"maunium.net/go/mautrix/crypto/attachment"
|
||||
@ -115,7 +114,7 @@ func (c *Container) InitClient() error {
|
||||
var err error
|
||||
c.client, err = mautrix.NewClient(c.config.HS, mxid, accessToken)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to create mautrix client")
|
||||
return fmt.Errorf("failed to create mautrix client: %w", err)
|
||||
}
|
||||
c.client.UserAgent = fmt.Sprintf("gomuks %s (with mautrix-go %s)", c.gmx.Version(), mautrix.Version)
|
||||
c.client.Logger = mxLogger{}
|
||||
@ -123,13 +122,13 @@ func (c *Container) InitClient() error {
|
||||
|
||||
err = c.initCrypto()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to initialize crypto")
|
||||
return fmt.Errorf("failed to initialize crypto: %w", err)
|
||||
}
|
||||
|
||||
if c.history == nil {
|
||||
c.history, err = NewHistoryManager(c.config.HistoryPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to initialize history")
|
||||
return fmt.Errorf("failed to initialize history: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,8 +429,9 @@ func (c *Container) Start() {
|
||||
return
|
||||
default:
|
||||
if err := c.client.Sync(); err != nil {
|
||||
if httpErr, ok := err.(mautrix.HTTPError); ok && httpErr.Code == http.StatusUnauthorized {
|
||||
if errors.Is(err, mautrix.MUnknownToken) {
|
||||
debug.Print("Sync() errored with ", err, " -> logging out")
|
||||
// TODO support soft logout
|
||||
c.Logout()
|
||||
} else {
|
||||
debug.Print("Sync() errored", err)
|
||||
@ -944,7 +944,7 @@ func (c *Container) UploadMedia(path string, encrypt bool) (*ifc.UploadedMediaIn
|
||||
var err error
|
||||
path, err = filepath.Abs(path)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get absolute path")
|
||||
return nil, fmt.Errorf("failed to get absolute path: %w", err)
|
||||
}
|
||||
|
||||
msgtype, info, err := getMediaInfo(path)
|
||||
@ -954,12 +954,12 @@ func (c *Container) UploadMedia(path string, encrypt bool) (*ifc.UploadedMediaIn
|
||||
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to open file")
|
||||
return nil, fmt.Errorf("failed to open file: %w", err)
|
||||
}
|
||||
|
||||
stat, err := file.Stat()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get file info")
|
||||
return nil, fmt.Errorf("failed to get file info: %w", err)
|
||||
}
|
||||
|
||||
uploadFileName := stat.Name()
|
||||
|
@ -25,22 +25,22 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/pkg/errors"
|
||||
"gopkg.in/vansante/go-ffprobe.v2"
|
||||
|
||||
"maunium.net/go/gomuks/debug"
|
||||
"maunium.net/go/mautrix/event"
|
||||
|
||||
"maunium.net/go/gomuks/debug"
|
||||
)
|
||||
|
||||
func getImageInfo(path string) (event.FileInfo, error) {
|
||||
var info event.FileInfo
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return info, errors.Wrap(err, "failed to open image to get info")
|
||||
return info, fmt.Errorf("failed to open image to get info: %w", err)
|
||||
}
|
||||
cfg, _, err := image.DecodeConfig(file)
|
||||
if err != nil {
|
||||
return info, errors.Wrap(err, "failed to get image info")
|
||||
return info, fmt.Errorf("failed to get image info: %w", err)
|
||||
}
|
||||
info.Width = cfg.Width
|
||||
info.Height = cfg.Height
|
||||
@ -53,7 +53,7 @@ func getFFProbeInfo(mimeClass, path string) (msgtype event.MessageType, info eve
|
||||
var probedInfo *ffprobe.ProbeData
|
||||
probedInfo, err = ffprobe.ProbeURL(ctx, path)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("failed to get %s info with ffprobe", mimeClass))
|
||||
err = fmt.Errorf("failed to get %s info with ffprobe: %w", mimeClass, err)
|
||||
return
|
||||
}
|
||||
if mimeClass == "audio" {
|
||||
@ -78,7 +78,7 @@ func getMediaInfo(path string) (msgtype event.MessageType, info event.FileInfo,
|
||||
var mime *mimetype.MIME
|
||||
mime, err = mimetype.DetectFile(path)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "failed to get content type")
|
||||
err = fmt.Errorf("failed to get content type: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -19,16 +19,17 @@ package rooms
|
||||
import (
|
||||
"compress/gzip"
|
||||
"encoding/gob"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
sync "github.com/sasha-s/go-deadlock"
|
||||
|
||||
"maunium.net/go/gomuks/debug"
|
||||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/id"
|
||||
|
||||
"maunium.net/go/gomuks/debug"
|
||||
)
|
||||
|
||||
// RoomCache contains room state info in a hashmap and linked list.
|
||||
@ -114,14 +115,14 @@ func (cache *RoomCache) LoadList() error {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(err, "failed to open room list file for reading")
|
||||
return fmt.Errorf("failed to open room list file for reading: %w", err)
|
||||
}
|
||||
defer debugPrintError(file.Close, "Failed to close room list file after reading")
|
||||
|
||||
// Open gzip reader for room list file
|
||||
cmpReader, err := gzip.NewReader(file)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to read gzip room list")
|
||||
return fmt.Errorf("failed to read gzip room list: %w", err)
|
||||
}
|
||||
defer debugPrintError(cmpReader.Close, "Failed to close room list gzip reader")
|
||||
|
||||
@ -131,7 +132,7 @@ func (cache *RoomCache) LoadList() error {
|
||||
var size int
|
||||
err = dec.Decode(&size)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to read size of room list")
|
||||
return fmt.Errorf("failed to read size of room list: %w", err)
|
||||
}
|
||||
|
||||
// Read list
|
||||
@ -167,7 +168,7 @@ func (cache *RoomCache) SaveList() error {
|
||||
// Open room list file
|
||||
file, err := os.OpenFile(cache.listPath, os.O_WRONLY|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to open room list file for writing")
|
||||
return fmt.Errorf("failed to open room list file for writing: %w", err)
|
||||
}
|
||||
defer debugPrintError(file.Close, "Failed to close room list file after writing")
|
||||
|
||||
@ -180,7 +181,7 @@ func (cache *RoomCache) SaveList() error {
|
||||
// Write number of items in list
|
||||
err = enc.Encode(len(cache.Map))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to write size of room list")
|
||||
return fmt.Errorf("failed to write size of room list: %w", err)
|
||||
}
|
||||
|
||||
// Write list
|
||||
|
@ -18,6 +18,7 @@ package ui
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
@ -34,7 +35,6 @@ import (
|
||||
"unicode"
|
||||
|
||||
"github.com/lucasb-eyer/go-colorful"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/russross/blackfriday/v2"
|
||||
|
||||
"maunium.net/go/mautrix"
|
||||
@ -225,7 +225,7 @@ func readRoomAlias(cmd *Command) (alias id.RoomAlias, err error) {
|
||||
param := strings.Join(cmd.Args[1:], " ")
|
||||
if strings.ContainsRune(param, ':') {
|
||||
if param[0] != '#' {
|
||||
return "", errors.New("Full aliases must start with #")
|
||||
return "", errors.New("full aliases must start with #")
|
||||
}
|
||||
|
||||
alias = id.RoomAlias(param)
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/kyokomi/emoji"
|
||||
"github.com/kyokomi/emoji/v2"
|
||||
"github.com/mattn/go-runewidth"
|
||||
"github.com/zyedidia/clipboard"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user