aboutsummaryrefslogtreecommitdiffstats
path: root/common/path.go
diff options
context:
space:
mode:
authorkiel barry <kiel.j.barry@gmail.com>2018-05-29 18:42:21 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-05-29 18:42:21 +0800
commit84f8c0cc1fbe1ab9c128555392a82ba609820fef (patch)
tree4859fe37105cc88d4d338a9f5bc55e42a017a29f /common/path.go
parent998f6564b28ea9241d0052c2abee090d2b9a8b63 (diff)
downloaddexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.tar.gz
dexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.tar.zst
dexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.zip
common: improve documentation comments (#16701)
This commit adds many comments and removes unused code. It also removes the EmptyHash function, which had some uses but was silly.
Diffstat (limited to 'common/path.go')
-rw-r--r--common/path.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/path.go b/common/path.go
index bd8da86e7..69820cfe5 100644
--- a/common/path.go
+++ b/common/path.go
@@ -30,6 +30,7 @@ func MakeName(name, version string) string {
return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version())
}
+// FileExist checks if a file exists at filePath.
func FileExist(filePath string) bool {
_, err := os.Stat(filePath)
if err != nil && os.IsNotExist(err) {
@@ -39,9 +40,10 @@ func FileExist(filePath string) bool {
return true
}
-func AbsolutePath(Datadir string, filename string) string {
+// AbsolutePath returns datadir + filename, or filename if it is absolute.
+func AbsolutePath(datadir string, filename string) string {
if filepath.IsAbs(filename) {
return filename
}
- return filepath.Join(Datadir, filename)
+ return filepath.Join(datadir, filename)
}