Skip to content

Commit

Permalink
perf(url): add if s != ""
Browse files Browse the repository at this point in the history
  • Loading branch information
nukc committed Jan 22, 2024
1 parent 99a8c8e commit 89f8498
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tagsugar.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func changeField(v reflect.Value, field reflect.Value, options tagOptions) error
if url == "http" {
if field.CanSet() {
var s = field.String()
if !strings.HasPrefix(s, "http") {
if s != "" && !strings.HasPrefix(s, "http") {
field.Set(reflect.ValueOf(Http + s))
}
}
Expand All @@ -128,7 +128,7 @@ func changeField(v reflect.Value, field reflect.Value, options tagOptions) error
if field.CanSet() {
s := field.String()
value := hostMap[host]
if value != "" {
if s != "" && value != "" {
field.Set(reflect.ValueOf(value + s))
}
}
Expand Down

0 comments on commit 89f8498

Please sign in to comment.