From 5d5102de4cf7bfd577a95d5384254d9e4c68e50d Mon Sep 17 00:00:00 2001 From: V2Ray Date: Sun, 20 Sep 2015 13:08:05 +0200 Subject: [PATCH] code cleanup --- config/json/json_test.go | 2 +- testing/unit/bytessubject.go | 8 ++++---- testing/unit/bytesubject.go | 8 ++++---- testing/unit/errorsubject.go | 8 ++++---- testing/unit/intsubject.go | 8 ++++---- testing/unit/stringsubject.go | 8 ++++---- testing/unit/subject.go | 8 ++++---- testing/unit/uint16subject.go | 8 ++++---- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/config/json/json_test.go b/config/json/json_test.go index abafaa6e9..7408b2927 100644 --- a/config/json/json_test.go +++ b/config/json/json_test.go @@ -44,5 +44,5 @@ func TestServerSampleConfig(t *testing.T) { assert.Int(len(config.InboundConfig().Content())).GreaterThan(0) assert.String(config.OutboundConfig().Protocol()).Equals("freedom") - assert.Int(len(config.OutboundConfig().Content())).Equals(0) + assert.Int(len(config.OutboundConfig().Content())).Equals(0) } diff --git a/testing/unit/bytessubject.go b/testing/unit/bytessubject.go index e68e79e89..b20b928f8 100644 --- a/testing/unit/bytessubject.go +++ b/testing/unit/bytessubject.go @@ -11,10 +11,10 @@ type BytesSubject struct { } func NewBytesSubject(base *Subject, value []byte) *BytesSubject { - subject := new(BytesSubject) - subject.Subject = base - subject.value = value - return subject + return &BytesSubject{ + Subject: base, + value: value, + } } func (subject *BytesSubject) Named(name string) *BytesSubject { diff --git a/testing/unit/bytesubject.go b/testing/unit/bytesubject.go index 58277384a..be3a1e2d8 100644 --- a/testing/unit/bytesubject.go +++ b/testing/unit/bytesubject.go @@ -10,10 +10,10 @@ type ByteSubject struct { } func NewByteSubject(base *Subject, value byte) *ByteSubject { - subject := new(ByteSubject) - subject.Subject = base - subject.value = value - return subject + return &ByteSubject{ + Subject: base, + value: value, + } } func (subject *ByteSubject) Named(name string) *ByteSubject { diff --git a/testing/unit/errorsubject.go b/testing/unit/errorsubject.go index 18608319b..e4612a225 100644 --- a/testing/unit/errorsubject.go +++ b/testing/unit/errorsubject.go @@ -6,10 +6,10 @@ type ErrorSubject struct { } func NewErrorSubject(base *Subject, value error) *ErrorSubject { - subject := new(ErrorSubject) - subject.Subject = base - subject.value = value - return subject + return &ErrorSubject{ + Subject: base, + value: value, + } } func (subject *ErrorSubject) Named(name string) *ErrorSubject { diff --git a/testing/unit/intsubject.go b/testing/unit/intsubject.go index 5dec9a401..358bd22d3 100644 --- a/testing/unit/intsubject.go +++ b/testing/unit/intsubject.go @@ -10,10 +10,10 @@ type IntSubject struct { } func NewIntSubject(base *Subject, value int) *IntSubject { - subject := new(IntSubject) - subject.Subject = base - subject.value = value - return subject + return &IntSubject{ + Subject: base, + value: value, + } } func (subject *IntSubject) Named(name string) *IntSubject { diff --git a/testing/unit/stringsubject.go b/testing/unit/stringsubject.go index 50bef5072..8c24f741d 100644 --- a/testing/unit/stringsubject.go +++ b/testing/unit/stringsubject.go @@ -6,10 +6,10 @@ type StringSubject struct { } func NewStringSubject(base *Subject, value string) *StringSubject { - subject := new(StringSubject) - subject.Subject = base - subject.value = value - return subject + return &StringSubject{ + Subject: base, + value: value, + } } func (subject *StringSubject) Named(name string) *StringSubject { diff --git a/testing/unit/subject.go b/testing/unit/subject.go index c6d835143..f1db48323 100644 --- a/testing/unit/subject.go +++ b/testing/unit/subject.go @@ -6,10 +6,10 @@ type Subject struct { } func NewSubject(assert *Assertion) *Subject { - subject := new(Subject) - subject.assert = assert - subject.name = "" - return subject + return &Subject{ + assert: assert, + name: "", + } } func (subject *Subject) FailWithMessage(message string) { diff --git a/testing/unit/uint16subject.go b/testing/unit/uint16subject.go index 0d150c381..588fb0327 100644 --- a/testing/unit/uint16subject.go +++ b/testing/unit/uint16subject.go @@ -10,10 +10,10 @@ type Uint16Subject struct { } func NewUint16Subject(base *Subject, value uint16) *Uint16Subject { - subject := new(Uint16Subject) - subject.Subject = base - subject.value = value - return subject + return &Uint16Subject{ + Subject: base, + value: value, + } } func (subject *Uint16Subject) Named(name string) *Uint16Subject {