diff options
author | kiel barry <kiel.j.barry@gmail.com> | 2018-05-29 18:42:21 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-05-29 18:42:21 +0800 |
commit | 84f8c0cc1fbe1ab9c128555392a82ba609820fef (patch) | |
tree | 4859fe37105cc88d4d338a9f5bc55e42a017a29f /common/path.go | |
parent | 998f6564b28ea9241d0052c2abee090d2b9a8b63 (diff) | |
download | dexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.tar dexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.tar.gz dexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.tar.bz2 dexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.tar.lz dexon-84f8c0cc1fbe1ab9c128555392a82ba609820fef.tar.xz 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.go | 6 |
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) } |