fix unreachable code & missing stringer-generated code

This commit is contained in:
Christian Schwarz
2017-09-30 16:31:55 +02:00
parent 6199595602
commit 0cbee78b40
12 changed files with 53 additions and 24 deletions
+2 -1
View File
@@ -26,6 +26,7 @@ const (
FrameTypeRST FrameType = 0xff
)
//go:generate stringer -type=Status
type Status uint64
const (
@@ -154,7 +155,7 @@ func (w *frameBridgingWriter) writeUntilFrameFull(b []byte) (n int, err error) {
return
}
if w.bytesLeftToLimit == 0 {
err = errors.Errorf("exceeded limit of total %v bytes for this message")
err = errors.Errorf("message exceeds max number of allowed bytes")
return
}
maxwrite := len(b)
+27
View File
@@ -0,0 +1,27 @@
// Code generated by "stringer -type=FrameType"; DO NOT EDIT.
package rpc
import "fmt"
const (
_FrameType_name_0 = "FrameTypeHeaderFrameTypeDataFrameTypeTrailer"
_FrameType_name_1 = "FrameTypeRST"
)
var (
_FrameType_index_0 = [...]uint8{0, 15, 28, 44}
_FrameType_index_1 = [...]uint8{0, 12}
)
func (i FrameType) String() string {
switch {
case 1 <= i && i <= 3:
i -= 1
return _FrameType_name_0[_FrameType_index_0[i]:_FrameType_index_0[i+1]]
case i == 255:
return _FrameType_name_1
default:
return fmt.Sprintf("FrameType(%d)", i)
}
}
-1
View File
@@ -28,7 +28,6 @@ func (s *LocalRPC) RegisterEndpoint(name string, handler interface{}) (err error
func (s *LocalRPC) Serve() (err error) {
panic("local cannot serve")
return nil
}
func (c *LocalRPC) Call(endpoint string, in, out interface{}) (err error) {
-1
View File
@@ -160,7 +160,6 @@ func (s *Server) ServeRequest() (err error) {
r := NewErrorHeader(StatusRequestError, "unregistered control endpoint %s", h.Endpoint)
return s.writeResponse(r)
}
panic("implementation error")
}
ep, ok := s.endpoints[h.Endpoint]
+17
View File
@@ -0,0 +1,17 @@
// Code generated by "stringer -type=Status"; DO NOT EDIT.
package rpc
import "fmt"
const _Status_name = "StatusOKStatusRequestErrorStatusServerErrorStatusError"
var _Status_index = [...]uint8{0, 8, 26, 43, 54}
func (i Status) String() string {
i -= 1
if i >= Status(len(_Status_index)-1) {
return fmt.Sprintf("Status(%d)", i+1)
}
return _Status_name[_Status_index[i]:_Status_index[i+1]]
}