diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-07-26 20:00:30 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-07-26 20:00:30 +0100 |
commit | 3638135ee62347ca267eaf0d6c83703accd36f8e (patch) | |
tree | 677c655c7a4aece7f0dd0f9e35a4aedbe3628543 /pkg/datamaps/config.go | |
parent | 3d9fcd0c1d56a5f5534163d56c9d65321ded4bc5 (diff) |
added re-typed []DatamapLine
Diffstat (limited to 'pkg/datamaps/config.go')
-rw-r--r-- | pkg/datamaps/config.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/datamaps/config.go b/pkg/datamaps/config.go index 84e097b..7c7f8e7 100644 --- a/pkg/datamaps/config.go +++ b/pkg/datamaps/config.go @@ -14,7 +14,7 @@ const ( // mocking funcs in go https://stackoverflow.com/questions/19167970/mock-functions-in-go // we only need the func signature to create the type. This is pretty weird, we're want to mock // os.UserHomeDir so that we can set it to something like /tmp in our tests. Here we are creating -// two types: GetUserConfigDir to represent the os.UserConfigDir function, DBPathChecker as a wrapper +// two types: GetUserConfigDir to represent the os.UserConfigDir function, dbPathChecker as a wrapper // which which we can assign methods to that holds the value of the func os.UserConfigDir and the // method, check(), which does the work, using the passed in func to determine the user $HOME/.config // directory. @@ -25,21 +25,21 @@ const ( // for testing purposes. type GetUserConfigDir func() (string, error) -// DBPathChecker contains the func used to create the user config dir. -type DBPathChecker struct { +// 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} +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 { +func (db *dbPathChecker) Check() bool { userConfig, err := db.getUserConfigDir() if err != nil { log.Fatal(err) |