From bdf92ee84efa6b623698450553cb5509f1cfb66d Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 15 Jul 2019 17:33:47 -0600 Subject: Minor tweaks --- caddy.go | 7 ++++--- modules/caddyhttp/encode/zstd/zstd.go | 2 +- modules/caddyhttp/fileserver/matcher.go | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/caddy.go b/caddy.go index 21f733c..5a5349e 100644 --- a/caddy.go +++ b/caddy.go @@ -208,8 +208,8 @@ func (d *Duration) UnmarshalJSON(b []byte) error { // If no version information is available, a non-nil // value will still be returned, but with an // unknown version. -func GoModule() *debug.Module { - mod := &debug.Module{Version: "unknown"} +func GoModule() debug.Module { + mod := debug.Module{Version: "unknown"} bi, ok := debug.ReadBuildInfo() if ok { mod.Path = bi.Main.Path @@ -219,9 +219,10 @@ func GoModule() *debug.Module { // once that issue is fixed, we should just be able to use bi.Main... hopefully. for _, dep := range bi.Deps { if dep.Path == mod.Path { - return dep + return *dep } } + return bi.Main } return mod } diff --git a/modules/caddyhttp/encode/zstd/zstd.go b/modules/caddyhttp/encode/zstd/zstd.go index 1470baf..acebff5 100644 --- a/modules/caddyhttp/encode/zstd/zstd.go +++ b/modules/caddyhttp/encode/zstd/zstd.go @@ -27,7 +27,7 @@ func init() { }) } -// Zstd can create zstd encoders. +// Zstd can create Zstandard encoders. type Zstd struct{} // AcceptEncoding returns the name of the encoding as diff --git a/modules/caddyhttp/fileserver/matcher.go b/modules/caddyhttp/fileserver/matcher.go index 85081ea..17d5c11 100644 --- a/modules/caddyhttp/fileserver/matcher.go +++ b/modules/caddyhttp/fileserver/matcher.go @@ -76,9 +76,8 @@ func (m MatchFile) Match(r *http.Request) bool { if matched { repl.Set("http.matchers.file.relative", rel) repl.Set("http.matchers.file.absolute", abs) - return true } - return false + return matched } // selectFile chooses a file according to m.TryPolicy by appending -- cgit v1.2.3