testing mutex locks and Marshal() function panic

This commit is contained in:
Jeff Carr 2025-01-13 05:56:45 -06:00
parent 208118ad5f
commit 25ab223c07
4 changed files with 8 additions and 8 deletions

View File

@ -29,7 +29,7 @@ clean:
# refs.proto
gitTag.pb.go: gitTag.proto
autogenpb --proto gitTag.proto
autogenpb --proto gitTag.proto --mutex-name "john"
goDep.pb.go: goDep.proto
autogenpb --proto goDep.proto

View File

@ -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:nomutex`
message GoDep { // `autogenpb:2nomutex`
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:nomutex`
string goVersion = 5; // version of golang the developer used to make this package version
}
message GoDeps { // `autogenpb:nomutex`
message GoDeps { // `autogenpb:2nomutex`
string uuid = 1; // `autogenpb:uuid:`
string version = 2; // `autogenpb:version`
repeated GoDep goDeps = 3; // `autogenpb:unique` `autogenpb:sort`

View File

@ -50,8 +50,8 @@ func (all *Repos) NewGoRepo(fullpath string, gopath string) (*Repo, error) {
// enforces GoPath is unique
func (all *Repos) AppendByGoPath(newr *Repo) bool {
all.Lock.RLock()
defer all.Lock.RUnlock()
all.RLock()
defer all.RUnlock()
for _, r := range all.Repos {
if r.GoInfo.GoPath == newr.GoInfo.GoPath {

View File

@ -11,7 +11,7 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time
// global settings for autogenpb `autogenpb:mutex`
message Repo { // `autogenpb:marshal` `autogenpb:nomutex`
message Repo { // `autogenpb:marshal` `autogenpb:2nomutex`
string fullPath = 1; // `autogenpb:unique` `autogenpb:sort` // the actual path to the .git directory: '/home/devel/golang.org/x/tools'
string masterBranchName = 3; // git 'main' or 'master' branch name
string develBranchName = 4; // whatever the git 'devel' branch name is
@ -43,7 +43,7 @@ message Repos { // `autogenpb:marshal` `autogenpb:sort`
}
// should it be done this way?
message GitTimes { // `autogenpb:nomutex`
message GitTimes { // `autogenpb:2nomutex`
google.protobuf.Timestamp lastPull = 1; // last time a git pull was done
google.protobuf.Timestamp lastUpdate = 2; // when was ReloadGit() last done
google.protobuf.Timestamp lastDirty = 3; // last time CheckDirty() was run
@ -56,7 +56,7 @@ message GitTimes { // `autogenpb:nomutex`
}
// this is probably better. think about moving to this instead
message GoInfo { // `autogenpb:nomutex`
message GoInfo { // `autogenpb:2nomutex`
string goPath = 1; // the logical path as used by golang: 'go.wit.com/apps/helloworld'
string desc = 2; // what is this repo?
bool goLibrary = 3; // is this a golang library?