summaryrefslogtreecommitdiff
path: root/goDep.isPrimitive.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-03 18:03:54 -0600
committerJeff Carr <[email protected]>2024-12-03 18:03:54 -0600
commit97a2f05cf2e0c09e8576db089950483a48afea71 (patch)
tree2e258e0075cfa566c9de068846c3e5e32e4ed04e /goDep.isPrimitive.go
parent18905d7cf7ed2e2eb15f7f668c0ecbfcd6b94ec0 (diff)
renamev0.0.22
Diffstat (limited to 'goDep.isPrimitive.go')
-rw-r--r--goDep.isPrimitive.go48
1 files changed, 0 insertions, 48 deletions
diff --git a/goDep.isPrimitive.go b/goDep.isPrimitive.go
deleted file mode 100644
index a894ecd..0000000
--- a/goDep.isPrimitive.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package gitpb
-
-// only reads in the go.mod file. doesn't change anything
-
-import (
- "bufio"
- "errors"
- "os"
- "path/filepath"
- "strings"
-
- "go.wit.com/log"
-)
-
-// Detect a 'Primative' package. Sets the isPrimative flag
-// will return true if the repo is truly not dependent on _anything_ else
-// like spew or lib/widget
-// it assumes go mod ran init and tidy ran without error
-func (repo *Repo) isPrimativeGoMod() (bool, error) {
- // go mod init & go mod tidy ran without errors
- log.Log(GITPB, "isPrimativeGoMod()", repo.FullPath)
- tmp := filepath.Join(repo.FullPath, "go.mod")
- gomod, err := os.Open(tmp)
- if err != nil {
- log.Log(GITPB, "missing go.mod", repo.FullPath)
- return false, err
- }
- defer gomod.Close()
-
- scanner := bufio.NewScanner(gomod)
- for scanner.Scan() {
- line := strings.TrimSpace(scanner.Text())
-
- parts := strings.Split(line, " ")
- log.Log(GITPB, " gomod:", parts)
- if len(parts) >= 1 {
- log.Log(GITPB, " gomod: part[0] =", parts[0])
- if parts[0] == "require" {
- log.Log(GITPB, " should return false here")
- return false, errors.New("go.mod file is not primative")
- }
-
- }
- }
- repo.GoPrimitive = true
- repo.GoDeps = nil
- return true, nil
-}