From 174d6e8ca3b1d32eff2641d86f5a37cf859b8061 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Fri, 16 May 2014 13:06:08 -0400 Subject: [PATCH] go.tools/container/intsets: use " " not ", " as (*Sparse).String() separator. This is both easier to read and 25% shorter (helpful when using String() as a map key for interning sets). LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/96370045 --- container/intsets/sparse.go | 2 +- container/intsets/sparse_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/container/intsets/sparse.go b/container/intsets/sparse.go index be4c5a66cf..be14d0559c 100644 --- a/container/intsets/sparse.go +++ b/container/intsets/sparse.go @@ -690,7 +690,7 @@ func (s *Sparse) String() string { buf.WriteByte('{') s.forEach(func(x int) { if buf.Len() > 1 { - buf.WriteString(", ") + buf.WriteByte(' ') } fmt.Fprintf(&buf, "%d", x) }) diff --git a/container/intsets/sparse_test.go b/container/intsets/sparse_test.go index 94d2e462fe..cd814c7aa0 100644 --- a/container/intsets/sparse_test.go +++ b/container/intsets/sparse_test.go @@ -43,8 +43,8 @@ func TestBasics(t *testing.T) { if !s.Insert(435) { t.Errorf("Insert(435): got false, want true") } - if s := s.String(); s != "{3, 435}" { - t.Errorf("String({3, 435}): got %q, want \"{3, 435}\"", s) + if s := s.String(); s != "{3 435}" { + t.Errorf("String({3 435}): got %q, want \"{3 435}\"", s) } if max := s.Max(); max != 435 { t.Errorf("Max: got %d, want 435", max)