diff options
| -rw-r--r-- | formatENV.go | 9 | ||||
| -rw-r--r-- | init.go | 10 | ||||
| -rw-r--r-- | save.go | 5 | ||||
| -rw-r--r-- | table.go | 6 |
4 files changed, 12 insertions, 18 deletions
diff --git a/formatENV.go b/formatENV.go index 3718b1f..1b4c519 100644 --- a/formatENV.go +++ b/formatENV.go @@ -4,8 +4,6 @@ import ( "errors" "fmt" "strings" - - "go.wit.com/log" ) func formatENV() (string, error) { @@ -20,20 +18,21 @@ func formatENV() (string, error) { for c := range envPB.IterAll() { key := strings.ToLower(c.Var) if len(strings.Fields(key)) != 1 { - log.Info("dropping invalid key = ", c.Var, "value =", c.Value) + // fmt.Println("dropping invalid key = ", c.Var, "value =", c.Value) continue } found := findByLower(key) if found == nil { - log.Info("findByKey() got nil for key:", key) + // fmt.Println("findByKey() got nil for key:", key) } // todo: warn about duplicates? uniques[key] = found } for key, c := range uniques { + _ = key if c == nil { - log.Info("key has nil c", key) + // fmt.Println("key has nil c", key) continue } if c.Global != "" { @@ -18,7 +18,7 @@ func Init(appname, version, buildtime string, fromargv []string, goodFunc func(s badExit = badFunc if envPB != nil { - // log.Info("Init() already ran") + // fmt.Println("Init() already ran") return } envPB = NewKeys() @@ -41,7 +41,7 @@ func loadAppENV() error { } envPB.Filename = filepath.Join(configDir, APPNAME, APPNAME+".ENV") - // log.Info("envPB.Filename", envPB.Filename) + // fmt.Println("envPB.Filename", envPB.Filename) data, err := os.ReadFile(envPB.Filename) if err != nil { @@ -62,7 +62,7 @@ func InitValid() bool { } func parseENV(data string) { - // log.Info("loadENV()", filename) + // fmt.Println("loadENV()", filename) for _, line := range strings.Split(data, "\n") { line = strings.TrimSpace(line) if line == "" { @@ -70,13 +70,13 @@ func parseENV(data string) { } parts := strings.Split(line, "=") if len(parts) != 2 { - // log.Info("INVALID LINE:", i, line) + // fmt.Println("INVALID LINE:", i, line) continue } c := new(Key) c.Var = parts[0] c.Value = parts[1] envPB.Append(c) - // log.Printf("ENV LINE: (%v)\n", c) + // fmt.Printf("ENV LINE: (%v)\n", c) } } @@ -19,10 +19,7 @@ func saveENV() error { func saveENVnolock(filename string) error { outENV, err := formatENV() if err == nil { - // log.Info("SAVEENV IS RUNNING") - // log.Info("SAVEENV IS RUNNING") - // log.Info("SAVEENV IS RUNNING") - // log.Info(outENV) + // fmt.Println(outENV) } return os.WriteFile(filename, []byte(outENV), 0644) } @@ -2,16 +2,14 @@ package ENV -import ( - "go.wit.com/log" -) +import "fmt" func PrintTable() string { t := envPB.MakeTable("ENV table") // limit the number of lines t.PrintTable() - return log.Sprintf("ENV: total=(%d)", envPB.Len()) + return fmt.Sprintf("ENV: total=(%d)", envPB.Len()) } func (pb *Keys) MakeTable(name string) *KeysTable { |
