From a658947af4fd4ae51b5867e975af1cefee704327 Mon Sep 17 00:00:00 2001 From: allencloud Date: Tue, 3 May 2016 23:12:38 +0800 Subject: [PATCH] fix typos Signed-off-by: allencloud --- archive/archive.go | 4 ++-- authorization/plugin.go | 8 ++++---- authorization/response.go | 11 ++++++----- fileutils/fileutils.go | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/archive/archive.go b/archive/archive.go index 5f8cd09..1603a23 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -146,7 +146,7 @@ func xzDecompress(archive io.Reader) (io.ReadCloser, <-chan struct{}, error) { return cmdStream(exec.Command(args[0], args[1:]...), archive) } -// DecompressStream decompress the archive and returns a ReaderCloser with the decompressed archive. +// DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive. func DecompressStream(archive io.Reader) (io.ReadCloser, error) { p := pools.BufioReader32KPool buf := p.Get(archive) @@ -192,7 +192,7 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) { } } -// CompressStream compresses the dest with specified compression algorithm. +// CompressStream compresseses the dest with specified compression algorithm. func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) { p := pools.BufioWriter32KPool buf := p.Get(dest) diff --git a/authorization/plugin.go b/authorization/plugin.go index 1b65ac0..a67c83f 100644 --- a/authorization/plugin.go +++ b/authorization/plugin.go @@ -8,14 +8,14 @@ type Plugin interface { // Name returns the registered plugin name Name() string - // AuthZRequest authorize the request from the client to the daemon + // AuthZRequest authorizes the request from the client to the daemon AuthZRequest(*Request) (*Response, error) - // AuthZResponse authorize the response from the daemon to the client + // AuthZResponse authorizes the response from the daemon to the client AuthZResponse(*Request) (*Response, error) } -// NewPlugins constructs and initialize the authorization plugins based on plugin names +// NewPlugins constructs and initializes the authorization plugins based on plugin names func NewPlugins(names []string) []Plugin { plugins := []Plugin{} pluginsMap := make(map[string]struct{}) @@ -69,7 +69,7 @@ func (a *authorizationPlugin) AuthZResponse(authReq *Request) (*Response, error) return authRes, nil } -// initPlugin initialize the authorization plugin if needed +// initPlugin initializes the authorization plugin if needed func (a *authorizationPlugin) initPlugin() error { // Lazy loading of plugins if a.plugin == nil { diff --git a/authorization/response.go b/authorization/response.go index e64fc81..f48f071 100644 --- a/authorization/response.go +++ b/authorization/response.go @@ -26,10 +26,10 @@ type ResponseModifier interface { // StatusCode returns the current status code StatusCode() int - // OverrideBody replace the body of the HTTP reply + // OverrideBody replaces the body of the HTTP reply OverrideBody(b []byte) - // OverrideHeader replace the headers of the HTTP reply + // OverrideHeader replaces the headers of the HTTP reply OverrideHeader(b []byte) error // OverrideStatusCode replaces the status code of the HTTP reply @@ -89,21 +89,22 @@ func (rm *responseModifier) Header() http.Header { return rm.header } -// Header returns the internal http header +// StatusCode returns the http status code func (rm *responseModifier) StatusCode() int { return rm.statusCode } -// Override replace the body of the HTTP reply +// OverrideBody replaces the body of the HTTP response func (rm *responseModifier) OverrideBody(b []byte) { rm.body = b } +// OverrideStatusCode replaces the status code of the HTTP response func (rm *responseModifier) OverrideStatusCode(statusCode int) { rm.statusCode = statusCode } -// Override replace the headers of the HTTP reply +// OverrideHeader replaces the headers of the HTTP response func (rm *responseModifier) OverrideHeader(b []byte) error { header := http.Header{} if err := json.Unmarshal(b, &header); err != nil { diff --git a/fileutils/fileutils.go b/fileutils/fileutils.go index c1e309f..763d8d2 100644 --- a/fileutils/fileutils.go +++ b/fileutils/fileutils.go @@ -13,12 +13,12 @@ import ( "github.com/Sirupsen/logrus" ) -// exclusion return true if the specified pattern is an exclusion +// exclusion returns true if the specified pattern is an exclusion func exclusion(pattern string) bool { return pattern[0] == '!' } -// empty return true if the specified pattern is empty +// empty returns true if the specified pattern is empty func empty(pattern string) bool { return pattern == "" } @@ -217,7 +217,7 @@ func regexpMatch(pattern, path string) (bool, error) { } // CopyFile copies from src to dst until either EOF is reached -// on src or an error occurs. It verifies src exists and remove +// on src or an error occurs. It verifies src exists and removes // the dst if it exists. func CopyFile(src, dst string) (int64, error) { cleanSrc := filepath.Clean(src)