dealt with internal type fitting interface in another way (other than a unit test)

master
Charles Iliya Krempeaux 2023-08-14 05:50:41 -07:00
parent 34675d3edc
commit 7277a32d08
42 changed files with 58 additions and 86 deletions

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalBadGateway{} var _ Error = internalBadGateway{}
var _ BadGateway = internalBadGateway{} var _ ServerError = internalBadGateway{}
var _ BadGateway = internalBadGateway{}
var ErrBadGateway error = BadGatewayWrap(nil) var ErrBadGateway error = BadGatewayWrap(nil)

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalBadRequest{} var _ Error = internalBadRequest{}
var _ BadRequest = internalBadRequest{} var _ ClientError = internalBadRequest{}
var _ BadRequest = internalBadRequest{}
var ErrBadRequest = BadRequestWrap(nil) var ErrBadRequest = BadRequestWrap(nil)

View File

@ -1,42 +0,0 @@
package errhttp
import (
"testing"
)
func TestClientError(t *testing.T) {
var x ClientError
x = internalBadRequest{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalUnauthorized{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalPaymentRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalForbidden{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalNotFound{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalMethodNotAllowed{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalNotAcceptable{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalProxyAuthRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalRequestTimeout{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalConflict{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalGone{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalLengthRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalPreconditionFailed{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalRequestEntityTooLarge{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalRequestURITooLong{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalUnsupportedMediaType{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalRequestedRangeNotSatisfiable{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalExpectationFailed{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalTeapot{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalUnprocessableEntity{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalLocked{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalFailedDependency{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalUpgradeRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalPreconditionRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalTooManyRequests{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalRequestHeaderFieldsTooLarge{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalUnavailableForLegalReasons{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
if nil == x {
t.Errorf("This should never happen.")
}
}

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalConflict{} var _ Error = internalConflict{}
var _ Conflict = internalConflict{} var _ ClientError = internalConflict{}
var _ Conflict = internalConflict{}
var ErrConflict = ConflictWrap(nil) var ErrConflict = ConflictWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalExpectationFailed{} var _ Error = internalExpectationFailed{}
var _ ClientError = internalExpectationFailed{}
var _ ExpectationFailed = internalExpectationFailed{} var _ ExpectationFailed = internalExpectationFailed{}
var ErrExpectationFailed error = ExpectationFailedWrap(nil) var ErrExpectationFailed error = ExpectationFailedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalFailedDependency{} var _ Error = internalFailedDependency{}
var _ ClientError = internalFailedDependency{}
var _ FailedDependency = internalFailedDependency{} var _ FailedDependency = internalFailedDependency{}
var ErrFailedDependency error = FailedDependencyWrap(nil) var ErrFailedDependency error = FailedDependencyWrap(nil)

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalForbidden{} var _ Error = internalForbidden{}
var _ Forbidden = internalForbidden{} var _ ClientError = internalForbidden{}
var _ Forbidden = internalForbidden{}
var ErrForbidden error = ForbiddenWrap(nil) var ErrForbidden error = ForbiddenWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalGatewayTimeout{} var _ Error = internalGatewayTimeout{}
var _ ServerError = internalGatewayTimeout{}
var _ GatewayTimeout = internalGatewayTimeout{} var _ GatewayTimeout = internalGatewayTimeout{}
var ErrGatewayTimeout error = GatewayTimeoutWrap(nil) var ErrGatewayTimeout error = GatewayTimeoutWrap(nil)

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalGone{} var _ Error = internalGone{}
var _ Gone = internalGone{} var _ ClientError = internalGone{}
var _ Gone = internalGone{}
var ErrGone error = GoneWrap(nil) var ErrGone error = GoneWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalHTTPVersionNotSupported{} var _ Error = internalHTTPVersionNotSupported{}
var _ ServerError = internalHTTPVersionNotSupported{}
var _ HTTPVersionNotSupported = internalHTTPVersionNotSupported{} var _ HTTPVersionNotSupported = internalHTTPVersionNotSupported{}
var ErrHTTPVersionNotSupported error = HTTPVersionNotSupportedWrap(nil) var ErrHTTPVersionNotSupported error = HTTPVersionNotSupportedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalInsufficientStorage{} var _ Error = internalInsufficientStorage{}
var _ ServerError = internalInsufficientStorage{}
var _ InsufficientStorage = internalInsufficientStorage{} var _ InsufficientStorage = internalInsufficientStorage{}
var ErrInsufficientStorage error = InsufficientStorageWrap(nil) var ErrInsufficientStorage error = InsufficientStorageWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalInternalServerError{} var _ Error = internalInternalServerError{}
var _ ServerError = internalInternalServerError{}
var _ InternalServerError = internalInternalServerError{} var _ InternalServerError = internalInternalServerError{}
var ErrInternalServerError error = InternalServerErrorWrap(nil) var ErrInternalServerError error = InternalServerErrorWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalLengthRequired{} var _ Error = internalLengthRequired{}
var _ ClientError = internalLengthRequired{}
var _ LengthRequired = internalLengthRequired{} var _ LengthRequired = internalLengthRequired{}
var ErrLengthRequired error = LengthRequiredWrap(nil) var ErrLengthRequired error = LengthRequiredWrap(nil)

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalLocked{} var _ Error = internalLocked{}
var _ Locked = internalLocked{} var _ ClientError = internalLocked{}
var _ Locked = internalLocked{}
var ErrLocked error = LockedWrap(nil) var ErrLocked error = LockedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalLoopDetected{} var _ Error = internalLoopDetected{}
var _ ServerError = internalLoopDetected{}
var _ LoopDetected = internalLoopDetected{} var _ LoopDetected = internalLoopDetected{}
var ErrLoopDetected error = LoopDetectedWrap(nil) var ErrLoopDetected error = LoopDetectedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalMethodNotAllowed{} var _ Error = internalMethodNotAllowed{}
var _ ClientError = internalMethodNotAllowed{}
var _ MethodNotAllowed = internalMethodNotAllowed{} var _ MethodNotAllowed = internalMethodNotAllowed{}
var ErrMethodNotAllowed error = MethodNotAllowedWrap(nil) var ErrMethodNotAllowed error = MethodNotAllowedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalNetworkAuthenticationRequired{} var _ Error = internalNetworkAuthenticationRequired{}
var _ ServerError = internalNetworkAuthenticationRequired{}
var _ NetworkAuthenticationRequired = internalNetworkAuthenticationRequired{} var _ NetworkAuthenticationRequired = internalNetworkAuthenticationRequired{}
var ErrNetworkAuthenticationRequired error = NetworkAuthenticationRequiredWrap(nil) var ErrNetworkAuthenticationRequired error = NetworkAuthenticationRequiredWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalNotAcceptable{} var _ Error = internalNotAcceptable{}
var _ ClientError = internalNotAcceptable{}
var _ NotAcceptable = internalNotAcceptable{} var _ NotAcceptable = internalNotAcceptable{}
var ErrNotAcceptable error = NotAcceptableWrap(nil) var ErrNotAcceptable error = NotAcceptableWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalNotExtended{} var _ Error = internalNotExtended{}
var _ ServerError = internalNotExtended{}
var _ NotExtended = internalNotExtended{} var _ NotExtended = internalNotExtended{}
var ErrNotExtended error = NotExtendedWrap(nil) var ErrNotExtended error = NotExtendedWrap(nil)

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalNotFound{} var _ Error = internalNotFound{}
var _ NotFound = internalNotFound{} var _ ClientError = internalNotFound{}
var _ NotFound = internalNotFound{}
var ErrNotFound error = NotFoundWrap(nil) var ErrNotFound error = NotFoundWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalNotImplemented{} var _ Error = internalNotImplemented{}
var _ ServerError = internalNotImplemented{}
var _ NotImplemented = internalNotImplemented{} var _ NotImplemented = internalNotImplemented{}
var ErrNotImplemented error = NotImplementedWrap(nil) var ErrNotImplemented error = NotImplementedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalPayloadTooLarge{} var _ Error = internalPayloadTooLarge{}
var _ ClientError = internalPayloadTooLarge{}
var _ PayloadTooLarge = internalPayloadTooLarge{} var _ PayloadTooLarge = internalPayloadTooLarge{}
var ErrPayloadTooLarge error = PayloadTooLargeWrap(nil) var ErrPayloadTooLarge error = PayloadTooLargeWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalPaymentRequired{} var _ Error = internalPaymentRequired{}
var _ ClientError = internalPaymentRequired{}
var _ PaymentRequired = internalPaymentRequired{} var _ PaymentRequired = internalPaymentRequired{}
var ErrPaymentRequired error = PaymentRequiredWrap(nil) var ErrPaymentRequired error = PaymentRequiredWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalPreconditionFailed{} var _ Error = internalPreconditionFailed{}
var _ ClientError = internalPreconditionFailed{}
var _ PreconditionFailed = internalPreconditionFailed{} var _ PreconditionFailed = internalPreconditionFailed{}
var ErrPreconditionFailed error = PreconditionFailedWrap(nil) var ErrPreconditionFailed error = PreconditionFailedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalPreconditionRequired{} var _ Error = internalPreconditionRequired{}
var _ ClientError = internalPreconditionRequired{}
var _ PreconditionRequired = internalPreconditionRequired{} var _ PreconditionRequired = internalPreconditionRequired{}
var ErrPreconditionRequired error = PreconditionRequiredWrap(nil) var ErrPreconditionRequired error = PreconditionRequiredWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalProxyAuthRequired{} var _ Error = internalProxyAuthRequired{}
var _ ClientError = internalProxyAuthRequired{}
var _ ProxyAuthRequired = internalProxyAuthRequired{} var _ ProxyAuthRequired = internalProxyAuthRequired{}
var ErrProxyAuthRequired error = ProxyAuthRequiredWrap(nil) var ErrProxyAuthRequired error = ProxyAuthRequiredWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalRequestedRangeNotSatisfiable{} var _ Error = internalRequestedRangeNotSatisfiable{}
var _ ClientError = internalRequestedRangeNotSatisfiable{}
var _ RequestedRangeNotSatisfiable = internalRequestedRangeNotSatisfiable{} var _ RequestedRangeNotSatisfiable = internalRequestedRangeNotSatisfiable{}
var ErrRequestedRangeNotSatisfiable error = RequestedRangeNotSatisfiableWrap(nil) var ErrRequestedRangeNotSatisfiable error = RequestedRangeNotSatisfiableWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalRequestEntityTooLarge{} var _ Error = internalRequestEntityTooLarge{}
var _ ClientError = internalRequestEntityTooLarge{}
var _ RequestEntityTooLarge = internalRequestEntityTooLarge{} var _ RequestEntityTooLarge = internalRequestEntityTooLarge{}
var ErrRequestEntityTooLarge error = RequestEntityTooLargeWrap(nil) var ErrRequestEntityTooLarge error = RequestEntityTooLargeWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalRequestHeaderFieldsTooLarge{} var _ Error = internalRequestHeaderFieldsTooLarge{}
var _ ClientError = internalRequestHeaderFieldsTooLarge{}
var _ RequestHeaderFieldsTooLarge = internalRequestHeaderFieldsTooLarge{} var _ RequestHeaderFieldsTooLarge = internalRequestHeaderFieldsTooLarge{}
var ErrRequestHeaderFieldsTooLarge error = RequestHeaderFieldsTooLargeWrap(nil) var ErrRequestHeaderFieldsTooLarge error = RequestHeaderFieldsTooLargeWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalRequestTimeout{} var _ Error = internalRequestTimeout{}
var _ ClientError = internalRequestTimeout{}
var _ RequestTimeout = internalRequestTimeout{} var _ RequestTimeout = internalRequestTimeout{}
var ErrRequestTimeout error = RequestTimeoutWrap(nil) var ErrRequestTimeout error = RequestTimeoutWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalRequestURITooLong{} var _ Error = internalRequestURITooLong{}
var _ ClientError = internalRequestURITooLong{}
var _ RequestURITooLong = internalRequestURITooLong{} var _ RequestURITooLong = internalRequestURITooLong{}
var ErrRequestURITooLong error = RequestURITooLongWrap(nil) var ErrRequestURITooLong error = RequestURITooLongWrap(nil)

View File

@ -1,26 +0,0 @@
package errhttp
import (
"testing"
)
func TestServerError(t *testing.T) {
var x ServerError
x = internalInternalServerError{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalNotImplemented{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalBadGateway{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalServiceUnavailable{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalGatewayTimeout{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalHTTPVersionNotSupported{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalVariantAlsoNegotiates{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalInsufficientStorage{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalLoopDetected{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalNotExtended{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
x = internalNetworkAuthenticationRequired{} // THESE ARE THE LINE THAT ACTUALLY MATTERS IN THIS TEST.
if nil == x {
t.Errorf("This should never happen.")
}
}

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalServiceUnavailable{} var _ Error = internalServiceUnavailable{}
var _ ServerError = internalServiceUnavailable{}
var _ ServiceUnavailable = internalServiceUnavailable{} var _ ServiceUnavailable = internalServiceUnavailable{}
var ErrServiceUnavailable error = ServiceUnavailableWrap(nil) var ErrServiceUnavailable error = ServiceUnavailableWrap(nil)

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalTeapot{} var _ Error = internalTeapot{}
var _ Teapot = internalTeapot{} var _ ClientError = internalTeapot{}
var _ Teapot = internalTeapot{}
var ErrTeapot error = TeapotWrap(nil) var ErrTeapot error = TeapotWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalTooManyRequests{} var _ Error = internalTooManyRequests{}
var _ ClientError = internalTooManyRequests{}
var _ TooManyRequests = internalTooManyRequests{} var _ TooManyRequests = internalTooManyRequests{}
var ErrTooManyRequests error = TooManyRequestsWrap(nil) var ErrTooManyRequests error = TooManyRequestsWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalUnauthorized{} var _ Error = internalUnauthorized{}
var _ ClientError = internalUnauthorized{}
var _ Unauthorized = internalUnauthorized{} var _ Unauthorized = internalUnauthorized{}
var ErrUnauthorized error = UnauthorizedWrap(nil) var ErrUnauthorized error = UnauthorizedWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalUnavailableForLegalReasons{} var _ Error = internalUnavailableForLegalReasons{}
var _ ClientError = internalUnavailableForLegalReasons{}
var _ UnavailableForLegalReasons = internalUnavailableForLegalReasons{} var _ UnavailableForLegalReasons = internalUnavailableForLegalReasons{}
var ErrUnavailableForLegalReasons error = UnavailableForLegalReasonsWrap(nil) var ErrUnavailableForLegalReasons error = UnavailableForLegalReasonsWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalUnprocessableEntity{} var _ Error = internalUnprocessableEntity{}
var _ ClientError = internalUnprocessableEntity{}
var _ UnprocessableEntity = internalUnprocessableEntity{} var _ UnprocessableEntity = internalUnprocessableEntity{}
var ErrUnprocessableEntity error = UnprocessableEntityWrap(nil) var ErrUnprocessableEntity error = UnprocessableEntityWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalUnsupportedMediaType{} var _ Error = internalUnsupportedMediaType{}
var _ ClientError = internalUnsupportedMediaType{}
var _ UnsupportedMediaType = internalUnsupportedMediaType{} var _ UnsupportedMediaType = internalUnsupportedMediaType{}
var ErrUnsupportedMediaType error = UnsupportedMediaTypeWrap(nil) var ErrUnsupportedMediaType error = UnsupportedMediaTypeWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalUpgradeRequired{} var _ Error = internalUpgradeRequired{}
var _ ClientError = internalUpgradeRequired{}
var _ UpgradeRequired = internalUpgradeRequired{} var _ UpgradeRequired = internalUpgradeRequired{}
var ErrUpgradeRequired error = UpgradeRequiredWrap(nil) var ErrUpgradeRequired error = UpgradeRequiredWrap(nil)

View File

@ -1,7 +1,8 @@
package errhttp package errhttp
var _ Error = internalURITooLong{} var _ Error = internalURITooLong{}
var _ URITooLong = internalURITooLong{} var _ ClientError = internalURITooLong{}
var _ URITooLong = internalURITooLong{}
var ErrURITooLong error = URITooLongWrap(nil) var ErrURITooLong error = URITooLongWrap(nil)

View File

@ -1,6 +1,7 @@
package errhttp package errhttp
var _ Error = internalVariantAlsoNegotiates{} var _ Error = internalVariantAlsoNegotiates{}
var _ ServerError = internalVariantAlsoNegotiates{}
var _ VariantAlsoNegotiates = internalVariantAlsoNegotiates{} var _ VariantAlsoNegotiates = internalVariantAlsoNegotiates{}
var ErrVariantAlsoNegotiates error = VariantAlsoNegotiatesWrap(nil) var ErrVariantAlsoNegotiates error = VariantAlsoNegotiatesWrap(nil)