mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 05:33:49 +03:00
chore: make FastAbs comment more easy to understand (#6692)
This commit is contained in:
parent
37f0c4bfae
commit
6028ff27fa
2 changed files with 6 additions and 2 deletions
|
@ -24,6 +24,8 @@ import (
|
||||||
// FastAbs is an optimized version of filepath.Abs for Unix systems,
|
// FastAbs is an optimized version of filepath.Abs for Unix systems,
|
||||||
// since we don't expect the working directory to ever change once
|
// since we don't expect the working directory to ever change once
|
||||||
// Caddy is running. Avoid the os.Getwd() syscall overhead.
|
// 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) {
|
func FastAbs(path string) (string, error) {
|
||||||
if filepath.IsAbs(path) {
|
if filepath.IsAbs(path) {
|
||||||
return filepath.Clean(path), nil
|
return filepath.Clean(path), nil
|
||||||
|
|
|
@ -18,8 +18,10 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FastAbs can't be optimized on Windows because the
|
// FastAbs can't be optimized on Windows because there
|
||||||
// syscall.FullPath function takes an input.
|
// 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) {
|
func FastAbs(path string) (string, error) {
|
||||||
return filepath.Abs(path)
|
return filepath.Abs(path)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue