Skip to content

Commit

Permalink
统一代码风格
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Apr 6, 2021
1 parent 0411c63 commit d69e165
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions carbon.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ type Carbon struct {
Error error
}

// String 实现 String 接口
// String 实现 Stringer 接口
func (c Carbon) String() string {
if c.IsZero() {
return ""
Expand Down Expand Up @@ -167,7 +167,7 @@ func Now() Carbon {

// Tomorrow 明天
func (c Carbon) Tomorrow() Carbon {
if c.Time.IsZero() {
if c.IsZero() {
c.Time = time.Now().AddDate(0, 0, 1)
} else {
c.Time = c.Time.AddDate(0, 0, 1)
Expand Down
1 change: 0 additions & 1 deletion comparer.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func (c Carbon) Compare(operator string, t Carbon) bool {
case "<=":
return c.Lte(t)
}

return false
}

Expand Down
3 changes: 0 additions & 3 deletions difference.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ func (c Carbon) DiffForHumans(arg ...Carbon) string {
diff = 0
return c.Lang.translate(unit, diff)
}

translation := c.Lang.translate(unit, diff)

if c.Lt(end) && len(arg) == 0 {
return strings.Replace(c.Lang.resources["ago"], "%s", translation, 1)
}
Expand All @@ -198,6 +196,5 @@ func (c Carbon) DiffForHumans(arg ...Carbon) string {
if c.Gt(end) && len(arg) > 0 {
return strings.Replace(c.Lang.resources["after"], "%s", translation, 1)
}

return translation
}
1 change: 0 additions & 1 deletion language.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (lang *Language) SetResources(resources map[string]string) {
lang.resources = resources
return
}

for k, v := range resources {
if _, ok := lang.resources[k]; ok {
lang.resources[k] = v
Expand Down

0 comments on commit d69e165

Please sign in to comment.