From 6028ff27fa8eb65ffc0770386cbf6a9ac9f50a48 Mon Sep 17 00:00:00 2001 From: WeidiDeng Date: Fri, 15 Nov 2024 11:49:42 +0800 Subject: chore: make FastAbs comment more easy to understand (#6692) --- filepath.go | 2 ++ filepath_windows.go | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/filepath.go b/filepath.go index ae9d54051..aad907799 100644 --- a/filepath.go +++ b/filepath.go @@ -24,6 +24,8 @@ import ( // FastAbs is an optimized version of filepath.Abs for Unix systems, // since we don't expect the working directory to ever change once // Caddy is running. Avoid the os.Getwd() syscall overhead. +// It's overall the same as stdlib's implementation, the difference +// being cached working directory. func FastAbs(path string) (string, error) { if filepath.IsAbs(path) { return filepath.Clean(path), nil diff --git a/filepath_windows.go b/filepath_windows.go index 4e46b0445..aa70955e9 100644 --- a/filepath_windows.go +++ b/filepath_windows.go @@ -18,8 +18,10 @@ import ( "path/filepath" ) -// FastAbs can't be optimized on Windows because the -// syscall.FullPath function takes an input. +// FastAbs can't be optimized on Windows because there +// are special file paths that require the use of syscall.FullPath +// to handle correctly. +// Just call stdlib's implementation which uses that function. func FastAbs(path string) (string, error) { return filepath.Abs(path) } -- cgit v1.2.3