Commit 9170b910 authored by JessonChan's avatar JessonChan

go style format (remove the blank after comments)

parent 5d01afe3
...@@ -46,20 +46,17 @@ var ( ...@@ -46,20 +46,17 @@ var (
) )
// WriteFile reads from file and writes to writer by the specific encoding(gzip/deflate) // WriteFile reads from file and writes to writer by the specific encoding(gzip/deflate)
func WriteFile(encoding string, writer io.Writer, file *os.File) (bool, string, error) { func WriteFile(encoding string, writer io.Writer, file *os.File) (bool, string, error) {
return writeLevel(encoding, writer, file, flate.BestCompression) return writeLevel(encoding, writer, file, flate.BestCompression)
} }
// WriteBody reads writes content to writer by the specific encoding(gzip/deflate) // WriteBody reads writes content to writer by the specific encoding(gzip/deflate)
func WriteBody(encoding string, writer io.Writer, content []byte) (bool, string, error) { func WriteBody(encoding string, writer io.Writer, content []byte) (bool, string, error) {
return writeLevel(encoding, writer, bytes.NewReader(content), flate.BestSpeed) return writeLevel(encoding, writer, bytes.NewReader(content), flate.BestSpeed)
} }
// writeLevel reads from reader,writes to writer by specific encoding and compress level // writeLevel reads from reader,writes to writer by specific encoding and compress level
// the compress level is defined by deflate package // the compress level is defined by deflate package
func writeLevel(encoding string, writer io.Writer, reader io.Reader, level int) (bool, string, error) { func writeLevel(encoding string, writer io.Writer, reader io.Reader, level int) (bool, string, error) {
var outputWriter io.Writer var outputWriter io.Writer
var err error var err error
...@@ -90,7 +87,6 @@ func writeLevel(encoding string, writer io.Writer, reader io.Reader, level int) ...@@ -90,7 +87,6 @@ func writeLevel(encoding string, writer io.Writer, reader io.Reader, level int)
// ParseEncoding will extract the right encoding for response // ParseEncoding will extract the right encoding for response
// the Accept-Encoding's sec is here: // the Accept-Encoding's sec is here:
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3
func ParseEncoding(r *http.Request) string { func ParseEncoding(r *http.Request) string {
if r == nil { if r == nil {
return "" return ""
......
...@@ -132,7 +132,6 @@ func isOk(s *serveContentHolder, fi os.FileInfo) bool { ...@@ -132,7 +132,6 @@ func isOk(s *serveContentHolder, fi os.FileInfo) bool {
} }
// isStaticCompress detect static files // isStaticCompress detect static files
func isStaticCompress(filePath string) bool { func isStaticCompress(filePath string) bool {
for _, statExtension := range StaticExtensionsToGzip { for _, statExtension := range StaticExtensionsToGzip {
if strings.HasSuffix(strings.ToLower(filePath), strings.ToLower(statExtension)) { if strings.HasSuffix(strings.ToLower(filePath), strings.ToLower(statExtension)) {
...@@ -182,7 +181,6 @@ func searchFile(ctx *context.Context) (string, os.FileInfo, error) { ...@@ -182,7 +181,6 @@ func searchFile(ctx *context.Context) (string, os.FileInfo, error) {
// lookupFile find the file to serve // lookupFile find the file to serve
// if the file is dir ,search the index.html as default file( MUST NOT A DIR also) // if the file is dir ,search the index.html as default file( MUST NOT A DIR also)
// if the index.html not exist or is a dir, give a forbidden response depending on DirectoryIndex // if the index.html not exist or is a dir, give a forbidden response depending on DirectoryIndex
func lookupFile(ctx *context.Context) (bool, string, os.FileInfo, error) { func lookupFile(ctx *context.Context) (bool, string, os.FileInfo, error) {
fp, fi, err := searchFile(ctx) fp, fi, err := searchFile(ctx)
if fp == "" || fi == nil { if fp == "" || fi == nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment