Actually run all the golint tests

This commit is contained in:
Kegan Dougal 2017-01-06 15:33:33 +00:00
parent f3c8c9580d
commit bb7c146092
3 changed files with 3 additions and 3 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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" ]