From 31e2be4b6f0388975244a0ee6a5929bdf9be2149 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 24 Oct 2025 13:06:36 -0500 Subject: ENV vs env isn't worth the fight. lower case is lame for this though --- README.md | 20 ++++++++++---------- SetGlobal.go | 2 +- appname.go | 2 +- exit.go | 2 +- formatENV.go | 2 +- generate.go | 2 +- init.go | 10 +++++----- key.proto | 2 +- modCache.go | 2 +- panic.go | 2 +- save.go | 2 +- structs.go | 2 +- table.go | 2 +- verbose.go | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 5a5a8a5..2e97173 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ -# ENV Library +# env Library -Works like sh ENV, but is file based. +Works like sh env, but is file based. ## Design goals -* backwards compatible: saved files are compatible with bash ENV syntax +* backwards compatible: saved files are compatible with bash env syntax * simple: only string key=value pairs * concurrent: use file locks -* global: ENV functions can be called from anywhere -* dynamic: automaticly detect ENV changes by the file mtime +* global: env functions can be called from anywhere +* dynamic: automaticly detect env changes by the file mtime ## Theory of Operation -The core philosophy of this library is to standardize ENV in a new way +The core philosophy of this library is to standardize env in a new way -ENV configuration files are loaded in this defined order: +env configuration files are loaded in this defined order: 1. /usr/share/doc/foo/foo.env # upstream application defaults 2. /etc/foo/foo.env # OS distribution defaults @@ -24,11 +24,11 @@ ENV configuration files are loaded in this defined order: ## function examples ``` -key := ENV.Get("APIKEY") +key := env.Get("APIKEY") -if ENV.True("verbose") { +if env.True("verbose") { fmt.Println("worked") } -ENV.Set("LocalPort", "8080") +env.Set("LocalPort", "8080") ``` diff --git a/SetGlobal.go b/SetGlobal.go index f255dcd..8b19325 100644 --- a/SetGlobal.go +++ b/SetGlobal.go @@ -1,4 +1,4 @@ -package ENV +package env import "errors" diff --git a/appname.go b/appname.go index 98d8dcc..9fae527 100644 --- a/appname.go +++ b/appname.go @@ -1,4 +1,4 @@ -package ENV +package env import ( "errors" diff --git a/exit.go b/exit.go index 6cf489f..364684e 100644 --- a/exit.go +++ b/exit.go @@ -1,4 +1,4 @@ -package ENV +package env import "os" diff --git a/formatENV.go b/formatENV.go index 1b4c519..ea2931c 100644 --- a/formatENV.go +++ b/formatENV.go @@ -1,4 +1,4 @@ -package ENV +package env import ( "errors" diff --git a/generate.go b/generate.go index 62f55ea..12ba344 100644 --- a/generate.go +++ b/generate.go @@ -1,4 +1,4 @@ -package ENV +package env // 'make generate' will call this // diff --git a/init.go b/init.go index 180ee44..ac03111 100644 --- a/init.go +++ b/init.go @@ -1,4 +1,4 @@ -package ENV +package env import ( "os" @@ -26,12 +26,12 @@ func Init(appname, version, buildtime string, fromargv []string, goodFunc func(s loadAppENV() - SetGlobal("lib/ENV", "APPNAME", APPNAME) - SetGlobal("lib/ENV", "VERSION", VERSION) - SetGlobal("lib/ENV", "BUILDTIME", BUILDTIME) + SetGlobal("lib/env", "APPNAME", APPNAME) + SetGlobal("lib/env", "VERSION", VERSION) + SetGlobal("lib/env", "BUILDTIME", BUILDTIME) } -// if it exists, loads ~/.config//.ENV +// if it exists, loads ~/.config//.env func loadAppENV() error { saveMu.Lock() saveMu.Unlock() diff --git a/key.proto b/key.proto index 3a49d57..6ca0ae0 100644 --- a/key.proto +++ b/key.proto @@ -2,7 +2,7 @@ syntax = "proto3"; -package ENV; +package env; message Key { // string var = 1; // ENV var name `autogenpb:unique` `autogenpb:sort` diff --git a/modCache.go b/modCache.go index d02e046..dceeed9 100644 --- a/modCache.go +++ b/modCache.go @@ -4,7 +4,7 @@ // Parallel cache. // This file is copied from cmd/go/internal/par. -package ENV +package env import ( "sync" diff --git a/panic.go b/panic.go index 488cee9..46d47ec 100644 --- a/panic.go +++ b/panic.go @@ -1,4 +1,4 @@ -package ENV +package env func GetPanic(flag string) string { saveMu.Lock() diff --git a/save.go b/save.go index 60c791d..36e20d5 100644 --- a/save.go +++ b/save.go @@ -1,4 +1,4 @@ -package ENV +package env import ( "os" diff --git a/structs.go b/structs.go index 90a0f14..30bc60c 100644 --- a/structs.go +++ b/structs.go @@ -1,4 +1,4 @@ -package ENV +package env import ( "errors" diff --git a/table.go b/table.go index 427dfff..f6a6896 100644 --- a/table.go +++ b/table.go @@ -1,6 +1,6 @@ // Copyright 2025 WIT.COM Inc Licensed GPL 3.0 -package ENV +package env import ( "fmt" diff --git a/verbose.go b/verbose.go index 31dd0f7..e3aba43 100644 --- a/verbose.go +++ b/verbose.go @@ -1,4 +1,4 @@ -package ENV +package env // this is an experiment at this point to // see how this turns out -- cgit v1.2.3