IsDirectory() check
This commit is contained in:
parent
fb792e13a7
commit
eee35998d0
2
Makefile
2
Makefile
|
@ -1,6 +1,8 @@
|
||||||
all:
|
all:
|
||||||
@GO111MODULE=off go vet
|
@GO111MODULE=off go vet
|
||||||
@echo go vet: this go library package builds okay
|
@echo go vet: this go library package builds okay
|
||||||
|
|
||||||
|
test:
|
||||||
make -C testGui
|
make -C testGui
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package repolist
|
package repolist
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"go.wit.com/lib/gui/repostatus"
|
"go.wit.com/lib/gui/repostatus"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -60,9 +62,14 @@ func (r *RepoRow) Show2() {
|
||||||
|
|
||||||
// adds a gui row to the table based off the repo protobuf
|
// adds a gui row to the table based off the repo protobuf
|
||||||
func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) {
|
func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) {
|
||||||
|
if !pb.IsDirectory() {
|
||||||
|
// this directory doesn't exist anymore
|
||||||
|
// was moved, or isn't in the ~/go/src or wherever go.work is
|
||||||
|
return nil, errors.New("path is gone: " + pb.FullPath)
|
||||||
|
}
|
||||||
test, ok := r.allrepos[pb.GetGoPath()]
|
test, ok := r.allrepos[pb.GetGoPath()]
|
||||||
if ok {
|
if ok {
|
||||||
// this repo already exists
|
// this repo gopath was already added
|
||||||
return test, nil
|
return test, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue