aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/datamaps/config.go
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-07-25 19:04:52 +0100
committerMatthew Lemon <matt@matthewlemon.com>2020-07-25 19:04:52 +0100
commitb83f028c5c2b319acbfe0c53b239223910f9a6bb (patch)
tree1a23296e8e71fbe391a71ea72c39adf4beed5dc7 /pkg/datamaps/config.go
parent6663dc215c9b8274a947e6055ba337036f0cb772 (diff)
linting fixes
Diffstat (limited to 'pkg/datamaps/config.go')
-rw-r--r--pkg/datamaps/config.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/datamaps/config.go b/pkg/datamaps/config.go
index 6635761..84e097b 100644
--- a/pkg/datamaps/config.go
+++ b/pkg/datamaps/config.go
@@ -21,16 +21,24 @@ const (
// Which is a lot of work for what it is, but it does make this testable and serves as an example
// of how things could be done in Go.
+// GetUserConfigDir allows replaces os.UserConfigDir
+// for testing purposes.
type GetUserConfigDir func() (string, error)
+// DBPathChecker contains the func used to create the user config dir.
type DBPathChecker struct {
getUserConfigDir GetUserConfigDir
}
+// NewDBPathChecker creaes a DBPathChecker using whatever
+// func you want as the argument, as long as it produces
+// the user config directory.
func NewDBPathChecker(h GetUserConfigDir) *DBPathChecker {
return &DBPathChecker{getUserConfigDir: h}
}
+// Check returns true if the necessary config files (including
+// the database) are in place - false if not
func (db *DBPathChecker) Check() bool {
userConfig, err := db.getUserConfigDir()
if err != nil {