gitpb/repo.new.go

27 lines
672 B
Go
Raw Normal View History

2024-11-27 14:41:57 -06:00
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.
2024-11-27 14:55:39 -06:00
func (all *Repos) NewGoPath(basepath string, gopath string) *Repo {
if r := all.FindByGoPath(gopath); r != nil {
2024-11-27 14:41:57 -06:00
// already had this gopath
2024-11-27 14:55:39 -06:00
return r
2024-11-27 14:41:57 -06:00
}
// add a new one here
newr := Repo{
FullPath: filepath.Join(basepath, gopath),
GoPath: gopath,
}
newr.UpdateGit()
2024-11-27 14:55:39 -06:00
all.add(&newr)
2024-11-27 14:41:57 -06:00
return &newr
}