Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.

Conversation

nishitaniyuki
Copy link
Contributor

  • fix a bug in logWriter.Write
  • add test for Logger.Writer

@ymmt2005
Copy link
Member

ymmt2005 commented Sep 7, 2017

@nishitaniyuki
Thank you. Next time please choose appropriate reviewers and labels.
I'll take a look.

logger_test.go Outdated
type testFormat struct {
}

func (f *testFormat) String() string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空 struct の場合ポインタ受けする必要もないので、
func (f testFormat) String() string で良いです。下も。

logger_test.go Outdated
l := NewLogger()
output := new(bytes.Buffer)
l.SetOutput(output)
l.SetFormatter(&testFormat{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l.SetFormatter(testFormat{})

logger_test.go Outdated
t.Fatal(err)
}
actual := output.Bytes()
if bytes.Compare(actual, tc.Expected) != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ストレートに bytes.Equal があります。
https://golang.org/pkg/bytes/#Equal

logger_test.go Outdated
}
actual := output.Bytes()
if bytes.Compare(actual, tc.Expected) != 0 {
t.Errorf("actual: %s, expected: %s\n", string(actual), string(tc.Expected))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n いるかな?不要な気が。

@ymmt2005 ymmt2005 merged commit 3afa47d into master Sep 7, 2017
@ymmt2005
Copy link
Member

ymmt2005 commented Sep 7, 2017

LTGM. Thank you!

@ymmt2005 ymmt2005 deleted the fix_log_writer branch September 7, 2017 07:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants