mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-24 18:00:35 +00:00
Rename functions "util.Remove" (remove.go) to "util.RemoveWithRetry" (file_retry.go) and add comments to clarify their behaviors, also add tests. Refactor callers: when no concurrent access (cmd cli, migration, app init, test), use "os.Xxx" directly. More details are in `modules/util/file_retry.go` By the way, clean up OS (windows) detection, make FileURLToPath test always run
20 lines
451 B
Go
20 lines
451 B
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package util
|
|
|
|
import "runtime"
|
|
|
|
const isOSWindows = runtime.GOOS == "windows"
|
|
|
|
func CallerFuncName(optSkipParent ...int) string {
|
|
pc := make([]uintptr, 1)
|
|
skipParent := 0
|
|
if len(optSkipParent) > 0 {
|
|
skipParent = optSkipParent[0]
|
|
}
|
|
runtime.Callers(skipParent+1 /*this*/ +1 /*runtime*/, pc)
|
|
funcName := runtime.FuncForPC(pc[0]).Name()
|
|
return funcName
|
|
}
|