Lots of various golint fixes

Changes some names to match go conventions
Comments all exported methods
Removes dot imports
This commit is contained in:
Brian Bland 2014-11-17 15:44:07 -08:00
parent b5cf681458
commit 88795e0a14
19 changed files with 417 additions and 257 deletions

View file

@ -9,10 +9,10 @@ import (
"github.com/docker/libchan"
)
// IPCStorageDriver is the interface which IPC storage drivers must implement. As external storage
// StorageDriver is the interface which IPC storage drivers must implement. As external storage
// drivers may be defined to use a different version of the storagedriver.StorageDriver interface,
// we use an additional version check to determine compatiblity.
type IPCStorageDriver interface {
type StorageDriver interface {
// Version returns the storagedriver.StorageDriver interface version which this storage driver
// implements, which is used to determine driver compatibility
Version() (storagedriver.Version, error)
@ -36,23 +36,25 @@ type Request struct {
ResponseChannel libchan.Sender
}
type responseError struct {
// ResponseError is a serializable error type.
type ResponseError struct {
Type string
Message string
}
// ResponseError wraps an error in a serializable struct containing the error's type and message
func ResponseError(err error) *responseError {
// WrapError wraps an error in a serializable struct containing the error's type
// and message.
func WrapError(err error) *ResponseError {
if err == nil {
return nil
}
return &responseError{
return &ResponseError{
Type: reflect.TypeOf(err).String(),
Message: err.Error(),
}
}
func (err *responseError) Error() string {
func (err *ResponseError) Error() string {
return fmt.Sprintf("%s: %s", err.Type, err.Message)
}
@ -61,38 +63,38 @@ func (err *responseError) Error() string {
// VersionResponse is a response for a Version request
type VersionResponse struct {
Version storagedriver.Version
Error *responseError
Error *ResponseError
}
// ReadStreamResponse is a response for a ReadStream request
type ReadStreamResponse struct {
Reader io.ReadCloser
Error *responseError
Error *ResponseError
}
// WriteStreamResponse is a response for a WriteStream request
type WriteStreamResponse struct {
Error *responseError
Error *ResponseError
}
// CurrentSizeResponse is a response for a CurrentSize request
type CurrentSizeResponse struct {
Position uint64
Error *responseError
Error *ResponseError
}
// ListResponse is a response for a List request
type ListResponse struct {
Keys []string
Error *responseError
Error *ResponseError
}
// MoveResponse is a response for a Move request
type MoveResponse struct {
Error *responseError
Error *ResponseError
}
// DeleteResponse is a response for a Delete request
type DeleteResponse struct {
Error *responseError
Error *ResponseError
}