summaryrefslogtreecommitdiff
path: root/repo.new.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-27 14:41:57 -0600
committerJeff Carr <[email protected]>2024-11-27 14:41:57 -0600
commitc51b8c96b12de401cc277b97552f5f9df959c74e (patch)
treec9e34871de6325b60a8e1de055d4f62b4eaad43b /repo.new.go
parentcedd7ea6f17451ca7eb8ae2cf2a243ba9c551430 (diff)
ideas on code structure
Diffstat (limited to 'repo.new.go')
-rw-r--r--repo.new.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/repo.new.go b/repo.new.go
new file mode 100644
index 0000000..6a37b8f
--- /dev/null
+++ b/repo.new.go
@@ -0,0 +1,26 @@
+package gitpb
+
+import (
+ "path/filepath"
+)
+
+// scans in a new git repo. If it detects the repo is a golang project,
+// then it parses the go.mod/go.sum files
+// TODO: try adding python, rails, perl, rust, other language things?
+// I probably will never have time to try that, but I'd take patches for anyone
+// that might see this note and feel so inclined.
+func (r *Repos) InitNewGoPath(basepath string, gopath string) *Repo {
+ if oldr := r.FindByPath(gopath); oldr != nil {
+ // already had this gopath
+ return oldr
+ }
+ // add a new one here
+ newr := Repo{
+ FullPath: filepath.Join(basepath, gopath),
+ GoPath: gopath,
+ }
+ newr.UpdateGit()
+
+ r.Append(&newr)
+ return &newr
+}