notsure
This commit is contained in:
parent
425cb042b9
commit
4b83d18db4
|
@ -40,7 +40,7 @@ func (repo *Repo) RedoGoMod() (bool, error) {
|
|||
|
||||
if repo.Exists("go.sum") {
|
||||
// return the attempt to parse go.mod & go.sum
|
||||
return repo.parseGoSum()
|
||||
return repo.ParseGoSum()
|
||||
}
|
||||
repo.GoDeps = new(GoDeps)
|
||||
repo.GoPrimitive = false
|
||||
|
@ -61,7 +61,8 @@ func (repo *Repo) RedoGoMod() (bool, error) {
|
|||
}
|
||||
|
||||
// reads and parses the go.sum file
|
||||
func (repo *Repo) parseGoSum() (bool, error) {
|
||||
// does not change anything
|
||||
func (repo *Repo) ParseGoSum() (bool, error) {
|
||||
// empty out what was there before
|
||||
repo.GoDeps = nil
|
||||
tmp := filepath.Join(repo.FullPath, "go.sum")
|
||||
|
|
|
@ -57,6 +57,8 @@ func (repo *Repo) IsProtobuf() (bool, []string, error) {
|
|||
return anyfound, allc, err
|
||||
}
|
||||
|
||||
// look for any proto files. do not enter directories
|
||||
// note: good golang libraries are best done in a single directory
|
||||
func scanForProtobuf(srcDir string) ([]string, []string, error) {
|
||||
var protofiles []string
|
||||
var compiled []string
|
||||
|
@ -66,6 +68,11 @@ func scanForProtobuf(srcDir string) ([]string, []string, error) {
|
|||
return err
|
||||
}
|
||||
|
||||
// ignore the start dir
|
||||
if srcDir == path {
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.HasSuffix(path, ".proto") {
|
||||
//
|
||||
protofiles = append(protofiles, path)
|
||||
|
@ -75,6 +82,10 @@ func scanForProtobuf(srcDir string) ([]string, []string, error) {
|
|||
compiled = append(compiled, path)
|
||||
}
|
||||
|
||||
// don't go into any directories
|
||||
if info.IsDir() {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
|
@ -83,17 +94,26 @@ func scanForProtobuf(srcDir string) ([]string, []string, error) {
|
|||
|
||||
func (repo *Repo) GetProtoFiles() ([]string, error) {
|
||||
var protofiles []string
|
||||
err := filepath.Walk(repo.GetFullPath(), func(path string, info os.FileInfo, err error) error {
|
||||
srcDir := repo.GetFullPath()
|
||||
err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
log.Log(GITPBWARN, "Error accessing path:", path, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// ignore the start dir
|
||||
if srcDir == path {
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.HasSuffix(path, ".proto") {
|
||||
//
|
||||
protofiles = append(protofiles, path)
|
||||
}
|
||||
|
||||
if info.IsDir() {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue