mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
src/pkg/[a-m]*: gofix -r error -force=error
R=golang-dev, iant CC=golang-dev https://golang.org/cl/5322051
This commit is contained in:
parent
68050ac76b
commit
c2049d2dfe
283 changed files with 2323 additions and 2464 deletions
|
|
@ -7,7 +7,7 @@ package x509
|
|||
import (
|
||||
"crypto/x509/pkix"
|
||||
"encoding/pem"
|
||||
"os"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
|
@ -19,7 +19,7 @@ type verifyTest struct {
|
|||
currentTime int64
|
||||
dnsName string
|
||||
|
||||
errorCallback func(*testing.T, int, os.Error) bool
|
||||
errorCallback func(*testing.T, int, error) bool
|
||||
expectedChains [][]string
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ var verifyTests = []verifyTest{
|
|||
},
|
||||
}
|
||||
|
||||
func expectHostnameError(t *testing.T, i int, err os.Error) (ok bool) {
|
||||
func expectHostnameError(t *testing.T, i int, err error) (ok bool) {
|
||||
if _, ok := err.(HostnameError); !ok {
|
||||
t.Errorf("#%d: error was not a HostnameError: %s", i, err)
|
||||
return false
|
||||
|
|
@ -103,7 +103,7 @@ func expectHostnameError(t *testing.T, i int, err os.Error) (ok bool) {
|
|||
return true
|
||||
}
|
||||
|
||||
func expectExpired(t *testing.T, i int, err os.Error) (ok bool) {
|
||||
func expectExpired(t *testing.T, i int, err error) (ok bool) {
|
||||
if inval, ok := err.(CertificateInvalidError); !ok || inval.Reason != Expired {
|
||||
t.Errorf("#%d: error was not Expired: %s", i, err)
|
||||
return false
|
||||
|
|
@ -111,7 +111,7 @@ func expectExpired(t *testing.T, i int, err os.Error) (ok bool) {
|
|||
return true
|
||||
}
|
||||
|
||||
func expectAuthorityUnknown(t *testing.T, i int, err os.Error) (ok bool) {
|
||||
func expectAuthorityUnknown(t *testing.T, i int, err error) (ok bool) {
|
||||
if _, ok := err.(UnknownAuthorityError); !ok {
|
||||
t.Errorf("#%d: error was not UnknownAuthorityError: %s", i, err)
|
||||
return false
|
||||
|
|
@ -119,10 +119,10 @@ func expectAuthorityUnknown(t *testing.T, i int, err os.Error) (ok bool) {
|
|||
return true
|
||||
}
|
||||
|
||||
func certificateFromPEM(pemBytes string) (*Certificate, os.Error) {
|
||||
func certificateFromPEM(pemBytes string) (*Certificate, error) {
|
||||
block, _ := pem.Decode([]byte(pemBytes))
|
||||
if block == nil {
|
||||
return nil, os.NewError("failed to decode PEM")
|
||||
return nil, errors.New("failed to decode PEM")
|
||||
}
|
||||
return ParseCertificate(block.Bytes)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue