feat: implement Stringer on custom string types
Add String() methods to ImageID, ContainerID, and UnparsedURL. Replace all string() casts with .String() method calls throughout the codebase for cleaner interface compliance.
This commit is contained in:
@@ -5,3 +5,6 @@ package webhook
|
||||
// but should not be parsed into a net/url.URL (e.g. webhook URLs,
|
||||
// compare URLs from external payloads).
|
||||
type UnparsedURL string
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (u UnparsedURL) String() string { return string(u) }
|
||||
|
||||
@@ -178,7 +178,7 @@ func extractCommitURL(payload GiteaPushPayload) UnparsedURL {
|
||||
|
||||
// Fall back to constructing URL from repo HTML URL
|
||||
if payload.Repository.HTMLURL != "" && payload.After != "" {
|
||||
return UnparsedURL(string(payload.Repository.HTMLURL) + "/commit/" + payload.After)
|
||||
return UnparsedURL(payload.Repository.HTMLURL.String() + "/commit/" + payload.After)
|
||||
}
|
||||
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user