在 URL 中,权限应该是可选的,这意味着诸如此类的 URLmailto:John.Doe@example.com是有效的。
在 Golang 1.15.2 中,如果使用net/url该类创建上述 URL,则似乎不允许在没有权限的情况下创建 URL。
例如
package main
import (
"fmt"
"net/url"
)
func main() {
var theURL = url.URL{}
theURL.Scheme = "mailto"
theURL.Path = "John.Doe@example.com"
fmt.Println(theURL.String()) // should be mailto:John.Doe@example.com, but is mailto://John.Doe@example.com
}
Run Code Online (Sandbox Code Playgroud)
我在这里遗漏了什么还是这在技术上是一个错误?
go ×1