Fixed golint warnings

This commit is contained in:
Aliaksandr Valialkin
2016-01-19 12:43:23 +02:00
parent a208149ac4
commit 52ddf98cfd
8 changed files with 19 additions and 18 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ func ParseUfloat(buf []byte) (float64, error) {
}
b := buf
var v uint64
var offset float64 = 1.0
var offset = 1.0
var pointFound bool
for i, c := range b {
if c < '0' || c > '9' {
+1 -1
View File
@@ -397,7 +397,7 @@ type readErrorConn struct {
}
func (r *readErrorConn) Read(p []byte) (int, error) {
return 0, fmt.Errorf("error!!!")
return 0, fmt.Errorf("error")
}
func (r *readErrorConn) Write(p []byte) (int, error) {
+2 -2
View File
@@ -123,7 +123,7 @@ func AppendGzipBytesLevel(dst, src []byte, level int) []byte {
return w.b
}
// WriteGzip writes gzipped p to w using the given compression level
// WriteGzipLevel writes gzipped p to w using the given compression level
// and returns the number of compressed bytes written to w.
//
// Supported compression levels are:
@@ -139,7 +139,7 @@ func WriteGzipLevel(w io.Writer, p []byte, level int) (int, error) {
return n, err
}
// WriteGzipLevel writes gzipped p to w and returns the number of compressed
// WriteGzip writes gzipped p to w and returns the number of compressed
// bytes written to w.
func WriteGzip(w io.Writer, p []byte) (int, error) {
return WriteGzipLevel(w, p, CompressDefaultCompression)
+1 -1
View File
@@ -73,7 +73,7 @@ func (c *Cookie) SetDomain(domain string) {
c.domain = append(c.domain[:0], domain...)
}
// SetDomain
// SetDomainBytes sets cookie domain.
func (c *Cookie) SetDomainBytes(domain []byte) {
c.domain = append(c.domain[:0], domain...)
}
+4 -4
View File
@@ -454,7 +454,7 @@ func (h *RequestHeader) SetMethod(method string) {
h.method = append(h.method, method...)
}
// SetMethod sets HTTP request method.
// SetMethodBytes sets HTTP request method.
func (h *RequestHeader) SetMethodBytes(method []byte) {
h.method = append(h.method[:0], method...)
}
@@ -475,7 +475,7 @@ func (h *RequestHeader) SetRequestURI(requestURI string) {
h.requestURI = append(h.requestURI[:0], requestURI...)
}
// SetRequestURI sets RequestURI for the first HTTP request line.
// SetRequestURIBytes sets RequestURI for the first HTTP request line.
// RequestURI must be properly encoded.
// Use URI.RequestURI for constructing proper RequestURI if unsure.
func (h *RequestHeader) SetRequestURIBytes(requestURI []byte) {
@@ -1347,7 +1347,7 @@ func (h *RequestHeader) parseFirstLine(buf []byte) (int, error) {
h.noHTTP11 = true
n = len(b)
} else if n == 0 {
return 0, fmt.Errorf("RequestURI cannot be empty in %q", buf)
return 0, fmt.Errorf("requestURI cannot be empty in %q", buf)
} else if !bytes.Equal(b[n+1:], strHTTP11) {
h.noHTTP11 = true
}
@@ -1574,7 +1574,7 @@ func parseContentLength(b []byte) (int, error) {
return -1, err
}
if n != len(b) {
return -1, fmt.Errorf("Non-numeric chars at the end of Content-Length")
return -1, fmt.Errorf("non-numeric chars at the end of Content-Length")
}
return v, nil
}
+2 -2
View File
@@ -688,7 +688,7 @@ func (resp *Response) mustSkipBody() bool {
return resp.SkipBody || resp.Header.mustSkipContentLength()
}
var errRequestHostRequired = errors.New("Missing required Host header in request")
var errRequestHostRequired = errors.New("missing required Host header in request")
// Write writes request to w.
//
@@ -724,7 +724,7 @@ func (req *Request) Write(w *bufio.Writer) error {
if hasBody {
_, err = w.Write(body)
} else if len(body) > 0 {
return fmt.Errorf("Non-zero body for non-POST request. body=%q", body)
return fmt.Errorf("non-zero body for non-POST request. body=%q", body)
}
return err
}
+4 -3
View File
@@ -231,7 +231,7 @@ func TimeoutHandler(h RequestHandler, timeout time.Duration, msg string) Request
}
}
// CompressHandlerLevel returns RequestHandler that transparently compresses
// CompressHandler returns RequestHandler that transparently compresses
// response body generated by h if the request contains 'gzip' or 'deflate'
// 'Accept-Encoding' header.
func CompressHandler(h RequestHandler) RequestHandler {
@@ -756,7 +756,8 @@ func (ctx *RequestCtx) Redirect(uri string, statusCode int) {
ctx.redirect(u.FullURI(), statusCode)
}
// Redirect sets 'Location: uri' response header and sets the given statusCode.
// RedirectBytes sets 'Location: uri' response header and sets
// the given statusCode.
//
// statusCode must have one of the following values:
//
@@ -1145,7 +1146,7 @@ var (
// ErrKeepaliveTimeout is returned from ServeConn
// if the connection lifetime exceeds MaxKeepaliveDuration.
ErrKeepaliveTimeout = errors.New("MaxKeepaliveDuration exceeded")
ErrKeepaliveTimeout = errors.New("exceeded MaxKeepaliveDuration")
)
// ServeConn serves HTTP requests from the given connection.
+4 -4
View File
@@ -132,7 +132,7 @@ func (x *URI) SetScheme(scheme string) {
lowercaseBytes(x.scheme)
}
// SetScheme sets URI scheme, i.e. http, https, ftp, etc.
// SetSchemeBytes sets URI scheme, i.e. http, https, ftp, etc.
func (x *URI) SetSchemeBytes(scheme []byte) {
x.scheme = append(x.scheme[:0], scheme...)
lowercaseBytes(x.scheme)
@@ -196,7 +196,7 @@ func (x *URI) parse(host, uri []byte, h *RequestHeader) {
x.Reset()
x.h = h
scheme, host, uri := splitHostUri(host, uri)
scheme, host, uri := splitHostURI(host, uri)
x.scheme = append(x.scheme, scheme...)
lowercaseBytes(x.scheme)
x.host = append(x.host, host...)
@@ -419,7 +419,7 @@ func (x *URI) String() string {
return string(x.FullURI())
}
func splitHostUri(host, uri []byte) ([]byte, []byte, []byte) {
func splitHostURI(host, uri []byte) ([]byte, []byte, []byte) {
n := bytes.Index(uri, strColonSlashSlash)
if n < 0 {
return strHTTP, host, uri
@@ -437,7 +437,7 @@ func splitHostUri(host, uri []byte) ([]byte, []byte, []byte) {
return scheme, uri[:n], uri[n:]
}
// Returns query args.
// QueryArgs returns query args.
func (x *URI) QueryArgs() *Args {
x.parseQueryArgs()
return &x.queryArgs