diff --git a/goDep.proto b/goDep.proto index 8dde9f3..72d32e7 100644 --- a/goDep.proto +++ b/goDep.proto @@ -8,7 +8,7 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time // global settings for autogenpb `autogenpb:mutex` -message GoDep { // `autogenpb:2nomutex` +message GoDep { // `autogenpb:nomutex` string hash = 1; // `autogenpb:unique` `autogenpb:sort` // md5sum/hash value from the go.sum file google.protobuf.Timestamp ctime = 2; // get the go date from 'go list' ? string version = 3; // v1.2.2 @@ -16,7 +16,7 @@ message GoDep { // `autogenpb:2nomutex` string goVersion = 5; // version of golang the developer used to make this package version } -message GoDeps { // `autogenpb:2nomutex` +message GoDeps { // `autogenpb:nomutex` string uuid = 1; // `autogenpb:uuid:` string version = 2; // `autogenpb:version` repeated GoDep goDeps = 3; // `autogenpb:unique` `autogenpb:sort` diff --git a/repo.new.go b/repo.new.go index c073fad..39dd303 100644 --- a/repo.new.go +++ b/repo.new.go @@ -51,14 +51,16 @@ func (all *Repos) NewGoRepo(fullpath string, gopath string) (*Repo, error) { // enforces GoPath is unique func (all *Repos) AppendByGoPath(newr *Repo) bool { all.RLock() - defer all.RUnlock() for _, r := range all.Repos { if r.GoInfo.GoPath == newr.GoInfo.GoPath { + all.RUnlock() return false } } + all.RUnlock() - all.Repos = append(all.Repos, newr) + // all.Repos = append(all.Repos, newr) + all.Append(newr) return true } diff --git a/repo.proto b/repo.proto index 83c7206..76376c1 100644 --- a/repo.proto +++ b/repo.proto @@ -36,7 +36,7 @@ message Repo { // `autogenpb:marshal` `autogenpb:2nomutex` string state = 23; // status or state. useful for building tooling } -message Repos { // `autogenpb:marshal` `autogenpb:sort` +message Repos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:2nomutex` string uuid = 1; // `autogenpb:uuid:8daaeba1-fb1f-4762-ae6e-95a55d352673` string version = 2; // `autogenpb:version:2` repeated Repo repos = 3; // `autogenpb:append` // generate AppendUnique() function for this