6
85
Fork
You've already forked dns
39

dnsutil.Trim: adjust to mimic strings.TrimPrefix again #910

Closed
opened 2026年07月03日 06:18:36 +02:00 by miekg · 0 comments
Owner
Copy link

from: #909

Issue 2: dnsutil.Trim() returns "" when z is longer than s

I was surprised to find that dnsutil.Trim() returns "" when z is longer than s.

strings.TrimPrefix() returns the original string in that situation and I expected it to be similar.

The "" result is ambiguous because it can also mean "s == z". Therefore instead of checking the result for "", I have to check > the inputs to make sure len(z) < len(s).

from: #909 > Issue 2: dnsutil.Trim() returns "" when z is longer than s > > I was surprised to find that dnsutil.Trim() returns "" when z is longer than s. > > strings.TrimPrefix() returns the original string in that situation and I expected it to be similar. > > The "" result is ambiguous because it can also mean "s == z". Therefore instead of checking the result for "", I have to check > the inputs to make sure len(z) < len(s).
miekg changed title from (削除) dnsutil.TrimPrefix: adjust to mimic strings.TrimPrefix again (削除ここまで) to dnsutil.Trim: adjust to mimic strings.TrimPrefix again 2026年07月07日 10:03:17 +02:00
Sign in to join this conversation.
No Branch/Tag specified
main
miek/26/jun24wo/14
miek/26/mrt24di/tls
miek/26/mrt09ma/17
miek/26/feb15zo/13
miek/zo-07-dec-25/gslb1
miek/2025-10-26@1431
miek/2025-10-18@2017
v0.6.83
v0.6.82
v0.6.81
v0.6.80
v0.6.79
v0.6.78
v0.6.77
v0.6.76
v0.6.75
v0.6.74
v0.6.73
v0.6.72
v0.6.71
v0.6.70
v0.6.69
v0.6.68
v0.6.67
v0.6.66
v0.6.65
v0.6.64
v0.6.63
v0.6.62
v0.6.61
v0.6.60
v0.6.59
v0.6.58
v0.6.57
v0.6.56
v0.6.55
v0.6.54
v0.6.53
v0.6.52
v0.6.51
v0.6.50
v0.6.49
v0.6.48
v0.6.47
v0.6.46
v0.6.45
v0.6.44
v0.6.43
v0.6.42
v0.6.41
v0.6.40
v0.6.39
v0.6.38
v0.6.37
v0.6.36
v0.6.35
v0.6.34
v0.6.33
v0.6.32
v0.6.31
v0.6.30
v0.6.29
v0.6.28
v0.6.27
v0.6.26
v0.6.25
v0.6.24
v0.6.23
v0.6.22
v0.6.21
v0.6.20
v0.6.19
v0.6.18
v0.6.17
v0.6.16
v0.6.15
v0.6.14
v0.6.13
v0.6.12
v0.6.11
v0.6.10
v0.6.9
v0.6.8
v0.6.7
v0.6.6
v0.6.5
v0.6.4
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.38
v0.5.37
v0.5.36
v0.5.35
v0.5.34
v0.5.33
v0.5.32
v0.5.31
v0.5.30
v0.5.29
v0.5.28
v0.5.27
v0.5.26
v0.5.25
v0.5.24
v0.5.23
v0.5.22
v0.5.21
v0.5.20
v0.5.19
v0.5.18
v0.5.17
v0.5.16
v0.5.15
v0.5.14
v0.5.13
v0.5.12
v0.5.11
v0.5.10
v0.5.9
v0.5.8
v0.5.7
v0.5.6
v0.5.5
v0.5.4
v0.5.3
v0.5.2
v0.5.1
v0.5.0
v0.1.12
v0.1.11
v0.1.10
v0.1.9
v0.1.8
v0.1.7
v0.1.6
v0.1.5
v0.1.4
v0.0.4
v0.0.3
v0.0.2
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
miekg/dns#910
Reference in a new issue
miekg/dns
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?