mirror of
https://github.com/XTLS/REALITY.git
synced 2026-09-27 17:38:00 +03:00
std: address ptrtoerror analyzer diagnostics
Gopls' new ptrtoerror analyzer (CL 798580) reports types E such that
both E and *E implement error and there is no clear intent as to
which one is preferred.
This CL cleans up nearly all such diagnostics in std by adding
explicit assertions such as 'var _ error = E{}'.
Two mistaken uses of scanner.Error (sans &) were fixed,
and several unnecessary embeddings of error in tests were
change to use a plain named field.
Change-Id: I1dbf4abd5750e69c34653a1cdd17fa04edfbc6e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/800560
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
This commit is contained in:
@@ -12,6 +12,8 @@ import "strconv"
|
||||
// which wraps AlertError rather than sending a TLS alert.
|
||||
type AlertError uint8
|
||||
|
||||
var _ error = AlertError(0)
|
||||
|
||||
func (e AlertError) Error() string {
|
||||
return alert(e).String()
|
||||
}
|
||||
|
||||
@@ -583,6 +583,8 @@ func Listen(network, laddr string, config *Config) (net.Listener, error) {
|
||||
|
||||
type timeoutError struct{}
|
||||
|
||||
var _ error = timeoutError{}
|
||||
|
||||
func (timeoutError) Error() string { return "tls: DialWithDialer timed out" }
|
||||
func (timeoutError) Timeout() bool { return true }
|
||||
func (timeoutError) Temporary() bool { return true }
|
||||
|
||||
Reference in New Issue
Block a user