summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-24 18:31:45 -0500
committerJeff Carr <[email protected]>2025-10-24 18:31:45 -0500
commite3f7c41f1082f132182c84961ab9fdf9666c8d79 (patch)
tree31d9761f8d7162d4b2918fd36fc1f973304b1519
parenta2d6aac9f22bfe1060930e756a7dff86b3918f7e (diff)
s/ENV/env/ but ENV really is better herev0.0.189
-rw-r--r--Load.go10
-rw-r--r--Save.go6
-rw-r--r--SetMode.go10
-rw-r--r--clone.go4
-rw-r--r--finalGoSumCheck.go12
-rw-r--r--init.go32
-rw-r--r--patchset.config.go4
-rw-r--r--repoNew.go10
-rw-r--r--rill.go18
-rw-r--r--scanRepoDir.go8
10 files changed, 57 insertions, 57 deletions
diff --git a/Load.go b/Load.go
index 34f5ef3..ec1d035 100644
--- a/Load.go
+++ b/Load.go
@@ -13,8 +13,8 @@ import (
"errors"
"os"
- "go.wit.com/lib/ENV"
"go.wit.com/lib/config"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/argvpb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@@ -29,7 +29,7 @@ func (pb *ForgeConfigs) loadConfig() error {
log.Info("forge has not been configured")
panic("config failed to load. make a new/blank forge config here?")
}
- ENV.SetGlobal("lib/forgepb", "ForgeCfg", pb.Filename)
+ env.SetGlobal("lib/forgepb", "ForgeCfg", pb.Filename)
var changed bool
// migrate from the old gopath to "namespace"
for fc := range pb.IterAll() {
@@ -60,7 +60,7 @@ func (f *Forge) reposCacheLoad() error {
f.Repos.Filename = config.MakeCacheFilename("forge", "repos")
err := config.ReLoad(f.Repos)
if err == nil {
- ENV.SetGlobal("lib/forgepb", "ReposPB", f.Repos.Filename)
+ env.SetGlobal("lib/forgepb", "ReposPB", f.Repos.Filename)
}
return err
}
@@ -81,7 +81,7 @@ func (f *Forge) patchesCacheLoad() error {
log.Printf("patchesCacheLoad() failed err (%v) filename (%s)\n", err, f.Patches.Filename)
panic("failed to load patches")
}
- ENV.SetGlobal("lib/forgepb", "PatchesPB", f.Patches.Filename)
+ env.SetGlobal("lib/forgepb", "PatchesPB", f.Patches.Filename)
return err
}
@@ -91,7 +91,7 @@ func makeDefaultConfig() (*ForgeConfigs, error) {
cfg.loadConfig()
cfg.addSampleConfigs()
- ENV.PrintTable()
+ env.PrintTable()
var err error
if err = cfg.saveVerbose(); err != nil {
log.Info("config save error:", err)
diff --git a/Save.go b/Save.go
index beb2be5..c02bc83 100644
--- a/Save.go
+++ b/Save.go
@@ -5,8 +5,8 @@ package forgepb
import (
"errors"
- "go.wit.com/lib/ENV"
"go.wit.com/lib/config"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/argvpb"
"go.wit.com/log"
)
@@ -31,7 +31,7 @@ func (f *Forge) Save() error {
// THIS IS NOT RIGHT ANYMORE ?
if config.HasChanged("repos") {
log.Info("forgepb.Save() thinks repos changed")
- if ENV.Verbose() {
+ if env.Verbose() {
log.Info("forgepb.Save() trying SaveVerbose()")
err = f.Repos.SaveVerbose()
} else {
@@ -79,7 +79,7 @@ func (f *Forge) Save() error {
}
func (f *Forge) saveRepos() error {
- if ENV.Verbose() {
+ if env.Verbose() {
return f.Repos.SaveVerbose()
}
return f.Repos.Save()
diff --git a/SetMode.go b/SetMode.go
index 50fea4b..0527a1a 100644
--- a/SetMode.go
+++ b/SetMode.go
@@ -3,7 +3,7 @@
package forgepb
import (
- "go.wit.com/lib/ENV"
+ "go.wit.com/lib/env"
)
func (f *Forge) SetMode(newmode ForgeMode) error {
@@ -12,13 +12,13 @@ func (f *Forge) SetMode(newmode ForgeMode) error {
return nil
}
f.mode = newmode
- err := ENV.Set("mode", newmode.String())
+ err := env.Set("mode", newmode.String())
if err != nil {
- panic("ENV.Set() doesn't work")
+ panic("env.Set() doesn't work")
}
- err = ENV.Save()
+ err = env.Save()
if err != nil {
- panic("ENV.Save() doesn't work")
+ panic("env.Save() doesn't work")
}
return err
}
diff --git a/clone.go b/clone.go
index d44874e..5c8d469 100644
--- a/clone.go
+++ b/clone.go
@@ -10,13 +10,13 @@ import (
"path/filepath"
"strings"
- "go.wit.com/lib/ENV"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
func getClonePathFromMode() string {
- return ENV.Get("gopath")
+ return env.Get("gopath")
}
// will not violate filesystem namespace
diff --git a/finalGoSumCheck.go b/finalGoSumCheck.go
index daee477..e789c89 100644
--- a/finalGoSumCheck.go
+++ b/finalGoSumCheck.go
@@ -5,7 +5,7 @@ import (
"fmt"
"strings"
- "go.wit.com/lib/ENV"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -52,12 +52,12 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) error {
if depRepo.GetVersion() != found.GetTargetVersion() {
check := f.Repos.FindByNamespace(depRepo.GetGoPath())
if f.Config.IsReadOnly(check.GetGoPath()) {
- if ENV.Verbose() {
+ if env.Verbose() {
log.Printf("%-48s ok error .%s. vs .%s. (ignoring read-only repo)\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion())
}
} else {
if f.CheckOverride(depRepo.GetGoPath()) {
- if ENV.Verbose() {
+ if env.Verbose() {
log.Printf("%-48s ok error .%s. vs .%s. (forge.CheckOverride())\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion())
}
// skip this gopath because it's probably broken forever
@@ -105,7 +105,7 @@ func (f *Forge) CheckOverride(gopath string) bool {
}
// fuckit for now. just blacklist github.com
if strings.HasPrefix(gopath, "github.com/") {
- if ENV.Verbose() {
+ if env.Verbose() {
log.Info("CheckOverride() is ignoring everything at github.com", gopath)
}
return true
@@ -140,12 +140,12 @@ func (f *Forge) TestGoDepsCheckOk(godeps *gitpb.GoDeps) error {
if depRepo.GetVersion() != found.GetTargetVersion() {
check := f.Repos.FindByNamespace(depRepo.GetGoPath())
if f.Config.IsReadOnly(check.GetGoPath()) {
- if ENV.Verbose() {
+ if env.Verbose() {
log.Printf("%-48s ok error .%s. vs .%s. (ignoring read-only repo)\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion())
}
} else {
if f.CheckOverride(depRepo.GetGoPath()) {
- if ENV.Verbose() {
+ if env.Verbose() {
log.Printf("%-48s ok error .%s. vs .%s. (forge.CheckOverride())\n", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetTargetVersion())
}
// skip this gopath because it's probably broken forever
diff --git a/init.go b/init.go
index d95d4bf..b3a4d2f 100644
--- a/init.go
+++ b/init.go
@@ -8,9 +8,9 @@ import (
"os/user"
"path/filepath"
- "go.wit.com/lib/ENV"
"go.wit.com/lib/cobol"
"go.wit.com/lib/config"
+ "go.wit.com/lib/env"
"go.wit.com/log"
)
@@ -62,27 +62,27 @@ func (f *Forge) Close() error {
func (f *Forge) postInit() error {
// always define
- if ENV.Get("username") == "" {
+ if env.Get("username") == "" {
usr, _ := user.Current()
- ENV.SetGlobal("lib/forgepb", "username", usr.Username)
- ENV.Save()
+ env.SetGlobal("lib/forgepb", "username", usr.Username)
+ env.Save()
}
// always define
- if ENV.Get("homeDir") == "" {
+ if env.Get("homeDir") == "" {
homeDir, _ := os.UserHomeDir()
- ENV.SetGlobal("lib/forgepb", "homeDir", homeDir)
- ENV.Save()
+ env.SetGlobal("lib/forgepb", "homeDir", homeDir)
+ env.Save()
}
// always define
- if ENV.Get("gopath") == "" {
- gopath := filepath.Join(ENV.Get("homedir"), "go/src")
- ENV.SetGlobal("lib/forgepb", "gopath", gopath)
+ if env.Get("gopath") == "" {
+ gopath := filepath.Join(env.Get("homedir"), "go/src")
+ env.SetGlobal("lib/forgepb", "gopath", gopath)
}
// always set f.mode
- switch ENV.Get("Mode") {
+ switch env.Get("Mode") {
case "NORMAL":
f.mode = ForgeMode_NORMAL
case "CLEAN":
@@ -94,12 +94,12 @@ func (f *Forge) postInit() error {
}
// todo: play with these / determine good values based on user's machine
- if cobol.Int(ENV.Get("RillX")) == 0 {
- ENV.SetGlobal("lib/forgepb", "RillX", "10")
+ if cobol.Int(env.Get("RillX")) == 0 {
+ env.SetGlobal("lib/forgepb", "RillX", "10")
}
- if cobol.Int(ENV.Get("RillY")) == 0 {
- ENV.SetGlobal("lib/forgepb", "RillY", "20")
- ENV.Save()
+ if cobol.Int(env.Get("RillY")) == 0 {
+ env.SetGlobal("lib/forgepb", "RillY", "20")
+ env.Save()
}
// create an initial repos.pb file
diff --git a/patchset.config.go b/patchset.config.go
index a8b34f4..94f52b0 100644
--- a/patchset.config.go
+++ b/patchset.config.go
@@ -7,8 +7,8 @@ import (
"strings"
"github.com/google/uuid"
- "go.wit.com/lib/ENV"
"go.wit.com/lib/config"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
"google.golang.org/protobuf/proto"
@@ -21,7 +21,7 @@ func (f *Forge) InitPatchsets() error {
}
func (f *Forge) SavePatchsets() error {
- filename := ENV.Get("PatchPB")
+ filename := env.Get("PatchPB")
regfile, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
if err != nil {
log.Info("SavePatchsets() filename open error:", filename, err)
diff --git a/repoNew.go b/repoNew.go
index 88b8dea..66a37d5 100644
--- a/repoNew.go
+++ b/repoNew.go
@@ -9,14 +9,14 @@ import (
"regexp"
"strings"
- "go.wit.com/lib/ENV"
"go.wit.com/lib/config"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
func (f *Forge) NewGoRepo(gopath string, url string) (*gitpb.Repo, error) {
- fullpath := filepath.Join(ENV.Get("ReposDir"), gopath)
+ fullpath := filepath.Join(env.Get("ReposDir"), gopath)
test := f.Repos.FindByFullPath(fullpath)
if test != nil {
return test, nil
@@ -193,12 +193,12 @@ func (f *Forge) configUserBranchName(repo *gitpb.Repo) string {
if uname != "" {
return uname
}
- if ENV.Get("username") == "" {
+ if env.Get("username") == "" {
// something is wrong!
}
// use the os.Username
- uname = ENV.Get("username")
+ uname = env.Get("username")
return uname
}
@@ -248,6 +248,6 @@ func (f *Forge) FindAnyPath(dir string) *gitpb.Repo {
}
func (f *Forge) DeleteByGoPath(gopath string) bool {
- fullpath := filepath.Join(ENV.Get("ReposDir"), gopath)
+ fullpath := filepath.Join(env.Get("ReposDir"), gopath)
return f.Repos.DeleteByFullPath(fullpath)
}
diff --git a/rill.go b/rill.go
index f72c06d..d0dde77 100644
--- a/rill.go
+++ b/rill.go
@@ -6,9 +6,9 @@ import (
"time"
"github.com/destel/rill"
- "go.wit.com/lib/ENV"
"go.wit.com/lib/cobol"
"go.wit.com/lib/config"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -36,11 +36,11 @@ func (f *Forge) RillReload() int {
var counter int
// Read users from the API.
// Concurrency = 20
- dirs := rill.Map(ids, cobol.Int(ENV.Get("RillX")), func(repo *gitpb.Repo) (*gitpb.Repo, error) {
+ dirs := rill.Map(ids, cobol.Int(env.Get("RillX")), func(repo *gitpb.Repo) (*gitpb.Repo, error) {
return repo, nil
})
- rill.ForEach(dirs, cobol.Int(ENV.Get("RillY")), func(repo *gitpb.Repo) error {
+ rill.ForEach(dirs, cobol.Int(env.Get("RillY")), func(repo *gitpb.Repo) error {
if err := repo.HasChanged(); err != nil {
counter += 1
return err
@@ -60,8 +60,8 @@ func (f *Forge) RillFuncError(rillf func(*gitpb.Repo) error) map[string]*RillSta
}
func (f *Forge) ConfigRill(rillX int, rillY int) {
- ENV.Set("RillX", fmt.Sprintf("%d", rillX))
- ENV.Set("RillY", fmt.Sprintf("%d", rillY))
+ env.Set("RillX", fmt.Sprintf("%d", rillX))
+ env.Set("RillY", fmt.Sprintf("%d", rillY))
// log.Infof("Setting rill values to %d,%d\n", f.Config.RillX, f.Config.RillY)
}
@@ -135,11 +135,11 @@ func (f *Forge) RillRepos(rillf func(*gitpb.Repo) error) map[string]*RillStats {
// Read users from the API.
// Concurrency = 20
- dirs := rill.Map(ids, cobol.Int(ENV.Get("RillX")), func(id *gitpb.Repo) (*gitpb.Repo, error) {
+ dirs := rill.Map(ids, cobol.Int(env.Get("RillX")), func(id *gitpb.Repo) (*gitpb.Repo, error) {
return id, nil
})
- rill.ForEach(dirs, cobol.Int(ENV.Get("RillY")), func(repo *gitpb.Repo) error {
+ rill.ForEach(dirs, cobol.Int(env.Get("RillY")), func(repo *gitpb.Repo) error {
// todo: make this a goroutine to show stats to the user
rillMu.Lock()
counter += 1
@@ -186,11 +186,11 @@ func (f *Forge) RunOnRepos(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) ma
// Read users from the API.
// Concurrency = 20
- dirs := rill.Map(ids, cobol.Int(ENV.Get("RillX")), func(id *gitpb.Repo) (*gitpb.Repo, error) {
+ dirs := rill.Map(ids, cobol.Int(env.Get("RillX")), func(id *gitpb.Repo) (*gitpb.Repo, error) {
return id, nil
})
- rill.ForEach(dirs, cobol.Int(ENV.Get("RillY")), func(repo *gitpb.Repo) error {
+ rill.ForEach(dirs, cobol.Int(env.Get("RillY")), func(repo *gitpb.Repo) error {
// todo: make this a goroutine to show stats to the user
rillMu.Lock()
counter += 1
diff --git a/scanRepoDir.go b/scanRepoDir.go
index 6cc2762..1e6c7e2 100644
--- a/scanRepoDir.go
+++ b/scanRepoDir.go
@@ -7,9 +7,9 @@ import (
"path/filepath"
"github.com/destel/rill"
- "go.wit.com/lib/ENV"
"go.wit.com/lib/cobol"
"go.wit.com/lib/config"
+ "go.wit.com/lib/env"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -39,7 +39,7 @@ func (f *Forge) checkNamespace(fullpath string) (*gitpb.Repo, error) {
}
func (f *Forge) RescanRepos() error {
- gopath := ENV.Get("gopath")
+ gopath := env.Get("gopath")
log.Info("RescanRepos() running in", gopath)
f.scanRepoDir(gopath)
f.Save()
@@ -83,13 +83,13 @@ func (f *Forge) rillScanDirsNew(fullpaths []string) (int, error) {
ids := rill.FromSlice(fullpaths, nil)
// Read users from the API. // Concurrency = 20
- dirs := rill.Map(ids, cobol.Int(ENV.Get("RillX")), func(id string) (*gitpb.Repo, error) {
+ dirs := rill.Map(ids, cobol.Int(env.Get("RillX")), func(id string) (*gitpb.Repo, error) {
return f.checkNamespace(id)
})
var counter int
// Activate users. // Concurrency = 10
- err := rill.ForEach(dirs, cobol.Int(ENV.Get("RillY")), func(repo *gitpb.Repo) error {
+ err := rill.ForEach(dirs, cobol.Int(env.Get("RillY")), func(repo *gitpb.Repo) error {
if repo == nil {
return nil
}