From 50001bf1727c8ec7fcfc3ae78ab66a125016d13e Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Mon, 17 Jul 2017 15:03:55 -0400 Subject: [PATCH] Travis: Check for gofmt issues. (#241) * Travis: Check for gofmt issues. This will help catch issues like https://github.com/shazow/ssh-chat/pull/240#discussion_r127626103 in CI. * chat: Fix gofmt issue. --- .travis.yml | 1 + chat/sanitize.go | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 78086b9..16c5cec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ install: - go get github.com/gordonklaus/ineffassign script: + - diff -u <(echo -n) <(gofmt -d .) - ineffassign . - go vet $(go list ./... | grep -v /vendor/) - go test -v $(go list ./... | grep -v /vendor/) diff --git a/chat/sanitize.go b/chat/sanitize.go index b567825..cb19bb0 100644 --- a/chat/sanitize.go +++ b/chat/sanitize.go @@ -3,6 +3,7 @@ package chat import "regexp" var reStripName = regexp.MustCompile("[^\\w.-]") + const maxLength = 16 // SanitizeName returns a name with only allowed characters and a reasonable length