mirror of https://github.com/matrix-org/gomatrix
Actually run all the golint tests
This commit is contained in:
parent
f3c8c9580d
commit
bb7c146092
|
@ -77,7 +77,7 @@ func ExampleClient_BuildBaseURL() {
|
||||||
// Retrieve the content of a m.room.name state event.
|
// Retrieve the content of a m.room.name state event.
|
||||||
func ExampleClient_StateEvent() {
|
func ExampleClient_StateEvent() {
|
||||||
content := struct {
|
content := struct {
|
||||||
name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}{}
|
}{}
|
||||||
cli, _ := NewClient("https://matrix.org", "@example:matrix.org", "abcdef123456")
|
cli, _ := NewClient("https://matrix.org", "@example:matrix.org", "abcdef123456")
|
||||||
if err := cli.StateEvent("!foo:bar", "m.room.name", "", &content); err != nil {
|
if err := cli.StateEvent("!foo:bar", "m.room.name", "", &content); err != nil {
|
||||||
|
|
|
@ -4,6 +4,6 @@ set -eu
|
||||||
|
|
||||||
golint
|
golint
|
||||||
go fmt
|
go fmt
|
||||||
go tool vet --shadow .
|
go tool vet --all --shadow .
|
||||||
gocyclo -over 12 .
|
gocyclo -over 12 .
|
||||||
go test -timeout 5s -test.v
|
go test -timeout 5s -test.v
|
||||||
|
|
|
@ -121,7 +121,7 @@ func DecodeUserLocalpart(str string) (string, error) {
|
||||||
// See http://matrix.org/docs/spec/intro.html#user-identifiers
|
// See http://matrix.org/docs/spec/intro.html#user-identifiers
|
||||||
func ExtractUserLocalpart(userID string) (string, error) {
|
func ExtractUserLocalpart(userID string) (string, error) {
|
||||||
if len(userID) == 0 || userID[0] != '@' {
|
if len(userID) == 0 || userID[0] != '@' {
|
||||||
return "", fmt.Errorf("%s is not a valid user id")
|
return "", fmt.Errorf("%s is not a valid user id", userID)
|
||||||
}
|
}
|
||||||
return strings.TrimPrefix(
|
return strings.TrimPrefix(
|
||||||
strings.SplitN(userID, ":", 2)[0], // @foo:bar:8448 => [ "@foo", "bar:8448" ]
|
strings.SplitN(userID, ":", 2)[0], // @foo:bar:8448 => [ "@foo", "bar:8448" ]
|
||||||
|
|
Loading…
Reference in New Issue