@marcel91200 / caddy Mirror · read-only / commits / 6028ff27
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 05:45 UTC

chore: make FastAbs comment more easy to understand (#6692)

WeidiDeng committed Nov 15, 2024 at 11:49 UTC 6028ff27fa8eb65ffc0770386cbf6a9ac9f50a48
2 files changed +6 -2
filepath.go
+2
@@ -24,6 +24,8 @@ import (
24 // FastAbs is an optimized version of filepath.Abs for Unix systems,
25 // since we don't expect the working directory to ever change once
26 // Caddy is running. Avoid the os.Getwd() syscall overhead.
27 +// It's overall the same as stdlib's implementation, the difference
28 +// being cached working directory.
29 func FastAbs(path string) (string, error) {
30 if filepath.IsAbs(path) {
31 return filepath.Clean(path), nil
filepath_windows.go
+4 -2
@@ -18,8 +18,10 @@ import (
18 "path/filepath"
19 )
20
21 -// FastAbs can't be optimized on Windows because the
22 -// syscall.FullPath function takes an input.
21 +// FastAbs can't be optimized on Windows because there
22 +// are special file paths that require the use of syscall.FullPath
23 +// to handle correctly.
24 +// Just call stdlib's implementation which uses that function.
25 func FastAbs(path string) (string, error) {
26 return filepath.Abs(path)
27 }