Commits

Miki Tebeka committed d216eb1 Merge

Merge pull request #1 from darkliquid/master

Fixed typos

  • Participants
  • Parent commits 31bf3f2, c52c090

Comments (0)

Files changed (2)

 	marshaler = m
 }
 
-// FormatMashaler uses time.Time format strings
-type FormatMashaler struct {
+// FormatMarshaler uses time.Time format strings
+type FormatMarshaler struct {
 	Format string
 }
 
 // Marshal will marshal to JSON string in Format
-func (fm *FormatMashaler) Marshal(t Time) ([]byte, error) {
+func (fm *FormatMarshaler) Marshal(t Time) ([]byte, error) {
 	return []byte(`"` + t.Format(fm.Format) + `"`), nil
 }
 
 // Unmarshal from JSON string in Format
-func (fm *FormatMashaler) Unmarshal(data []byte) (Time, error) {
+func (fm *FormatMarshaler) Unmarshal(data []byte) (Time, error) {
 	if len(data) < 2 {
 		return Time{}, fmt.Errorf("data too short - %v", data)
 	}
 // MarshalJSON implements the json.Marshaler interface.
 func (t Time) MarshalJSON() ([]byte, error) {
 	if !validJSONTime(t) {
-		return nil, fmt.Errorf("vtime.Time.MarshalJson: year outside of range [0,9999]")
+		return nil, fmt.Errorf("jtime.Time.MarshalJson: year outside of range [0,9999]")
 	}
 	return marshaler.Marshal(t)
 }
 
 func init() {
 	// Default behaviour
-	SetMarshaler(&FormatMashaler{time.RFC3339Nano})
+	SetMarshaler(&FormatMarshaler{time.RFC3339Nano})
 }

File jtime_test.go

 
 func TestFormatMarshaller(t *testing.T) {
 	tm := testTime()
-	fm := &FormatMashaler{"2006"}
+	fm := &FormatMarshaler{"2006"}
 	data, err := fm.Marshal(tm)
 	if err != nil {
 		t.Fatalf("can't marshal: %s", err)
 }
 
 func TestJSON(t *testing.T) {
-	SetMarshaler(&FormatMashaler{"2006"})
+	SetMarshaler(&FormatMarshaler{"2006"})
 
 	ts := TestStruct{testTime()}
 	data, err := json.Marshal(ts)