use fhelp package to attempt to install protoc
This commit is contained in:
parent
eaa7293fc7
commit
4fdcc99241
Notes:
Jeff Carr
2025-02-14 19:22:48 -06:00
// `autogen:go.mod` module go.wit.com/apps/autogenpb go 1.22 toolchain go1.23.6 require ( github.com/alexflint/go-arg v1.5.1 github.com/go-cmd/cmd v1.4.3 go.wit.com/lib/fhelp v0.0.7 go.wit.com/lib/gui/shell v0.22.26 go.wit.com/log v0.22.16 golang.org/x/text v0.22.0 google.golang.org/protobuf v1.36.5 ) require ( github.com/alexflint/go-scalar v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect ) // `autogen:go.sum` github.com/alexflint/go-arg v1.5.1 h1:nBuWUCpuRy0snAG+uIJ6N0UvYxpxA0/ghA/AaHxlT8Y= github.com/alexflint/go-arg v1.5.1/go.mod h1:A7vTJzvjoaSTypg4biM5uYNTkJ27SkNTArtYXnlqVO8= github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y= github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.wit.com/lib/fhelp v0.0.7 h1:DX1L12OhLFpy+SMHovxC8BgeABGCFvxRxUPQa75tZvw= go.wit.com/lib/fhelp v0.0.7/go.mod h1:G2swZygn0kt++XPT3Vnfiq1bJMjarkhdo6fHr+Pc2sw= go.wit.com/lib/gui/shell v0.22.26 h1:F+7aadEujsTgyBEs5ptKGL6N72reDkGd/7b0Ju4HeTU= go.wit.com/lib/gui/shell v0.22.26/go.mod h1:Km5o+DLU5up5jvTEum9wiTdsZZG/EUNERVzn2wJ6DBE= go.wit.com/log v0.22.16 h1:E0Vd0Z2ILtfjhs7J/CQ4g13DK1jtQiYl6l5KOBGsZoA= go.wit.com/log v0.22.16/go.mod h1:/c5Uj30sWRQ4B5ei2ElB6Q8Si/cK6v+KbxnH208KD84= golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= // `autogen:file.marshal.pb.go` // Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. // This file was autogenerated with autogenpb v0.0.52 2025-02-12_06:22:03_UTC // go install go.wit.com/apps/autogenpb@latest // // define which structs (messages) you want to use in the .proto file // Then sort.pb.go and marshal.pb.go files are autogenerated // // autogenpb uses it and has an example .proto file with instructions // package main import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" ) // human readable JSON func (v *Files) FormatJSON() string { return protojson.Format(v) } // marshal json func (v *Files) MarshalJSON() ([]byte, error) { return protojson.Marshal(v) } // unmarshal json func (v *Files) UnmarshalJSON(data []byte) error { return protojson.Unmarshal(data, v) } // apparently this isn't stable, but it's awesomely better // https://protobuf.dev/reference/go/faq/#unstable-text // it's brilliant for config files! func (v *Files) FormatTEXT() string { v.fixUuid() return prototext.Format(v) } // unmarshalTEXT. This reads the .text config file back in after the user edits it func (v *Files) UnmarshalTEXT(data []byte) error { return prototext.Unmarshal(data, v) } // marshal to wire. This is called winning. func (v *Files) Marshal() ([]byte, error) { v.fixUuid() return proto.Marshal(v) } // unmarshal from wire. You have won. func (v *Files) Unmarshal(data []byte) error { return proto.Unmarshal(data, v) } // human readable JSON func (v *Identify) FormatJSON() string { return protojson.Format(v) } // marshal json func (v *Identify) MarshalJSON() ([]byte, error) { return protojson.Marshal(v) } // unmarshal json func (v *Identify) UnmarshalJSON(data []byte) error { return protojson.Unmarshal(data, v) } // apparently this isn't stable, but it's awesomely better // https://protobuf.dev/reference/go/faq/#unstable-text // it's brilliant for config files! func (v *Identify) FormatTEXT() string { return prototext.Format(v) } // unmarshalTEXT. This reads the .text config file back in after the user edits it func (v *Identify) UnmarshalTEXT(data []byte) error { return prototext.Unmarshal(data, v) } // marshal to wire. This is called winning. func (v *Identify) Marshal() ([]byte, error) { return proto.Marshal(v) } // unmarshal from wire. You have won. func (v *Identify) Unmarshal(data []byte) error { return proto.Unmarshal(data, v) } // `autogen:file.pb.go` // Code modified by go.wit.com/apps/autogenpb DO NOT EDIT. // // user defined Mutex locks were auto added // // autogenpb version & build time: v0.0.52 2025-02-12_06:22:03_UTC // autogenpb auto generates Sort(), Unique() and Marshal() functions // go install go.wit.com/apps/autogenpb@latest // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.33.0 // protoc v3.21.12 // source: file.proto // Look at "example/fruit.proto" not this file // this file is actually used by autogenpb // here are some docs, but probably it's just easier to run // autogenpb on this file and see what gets autogenerated // in this directory. All autogenerated files are named *.pb.go // the 'uuid' standard at the end is an experiment // establish a way to identify arbitrary .pb files // You can generate Marshal & Unmarshal for any struct (message) you want // You can generate SortBy and Append functions ONLY FOR 'repeated <message>' // Also, those structs must be defined in the same file // Additionally, you must use `autogenpb:mutex` on the parent struct. // The autogenerated code requires a RW mutex and autogenpb will insert it into the struct package main // autogenpb changed the package name import ( reflect "reflect" sync "sync" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) // below are the actual structs autogen uses // autogen parses the .proto file and then store the information // it needs in these protobuf files, then it processes the // protobuf files to write out *.sort.pb.go and *.marshal.pb.go files type MsgVar struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields VarName string `protobuf:"bytes,1,opt,name=varName,proto3" json:"varName,omitempty"` // the variable name VarType string `protobuf:"bytes,2,opt,name=varType,proto3" json:"varType,omitempty"` // the variable type IsRepeated bool `protobuf:"varint,3,opt,name=isRepeated,proto3" json:"isRepeated,omitempty"` // does the variable repeate HasSort bool `protobuf:"varint,4,opt,name=hasSort,proto3" json:"hasSort,omitempty"` // marked with sort HasUnique bool `protobuf:"varint,5,opt,name=hasUnique,proto3" json:"hasUnique,omitempty"` // marked with unique } func (x *MsgVar) Reset() { *x = MsgVar{} if protoimpl.UnsafeEnabled { mi := &file_file_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MsgVar) String() string { return protoimpl.X.MessageStringOf(x) } func (*MsgVar) ProtoMessage() {} func (x *MsgVar) ProtoReflect() protoreflect.Message { mi := &file_file_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use MsgVar.ProtoReflect.Descriptor instead. func (*MsgVar) Descriptor() ([]byte, []int) { return file_file_proto_rawDescGZIP(), []int{0} } func (x *MsgVar) GetVarName() string { if x != nil { return x.VarName } return "" } func (x *MsgVar) GetVarType() string { if x != nil { return x.VarType } return "" } func (x *MsgVar) GetIsRepeated() bool { if x != nil { return x.IsRepeated } return false } func (x *MsgVar) GetHasSort() bool { if x != nil { return x.HasSort } return false } func (x *MsgVar) GetHasUnique() bool { if x != nil { return x.HasUnique } return false } type MsgName struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // the name of the message aka struct. for this example: "Shelf" Lockname string `protobuf:"bytes,2,opt,name=lockname,proto3" json:"lockname,omitempty"` // name of the lockfile. ends in Mu DoMarshal bool `protobuf:"varint,3,opt,name=doMarshal,proto3" json:"doMarshal,omitempty"` // if msg struct should have Marshal & Unmarshal functions DoMutex bool `protobuf:"varint,4,opt,name=doMutex,proto3" json:"doMutex,omitempty"` // true if a mutex is needed for the message struct DoProtocMutex bool `protobuf:"varint,5,opt,name=doProtocMutex,proto3" json:"doProtocMutex,omitempty"` // an experiment to insert a mutex into the protoc generated msg struct (bad idea?) MutexFound bool `protobuf:"varint,6,opt,name=mutexFound,proto3" json:"mutexFound,omitempty"` // true if the mutex was added to the protoc pb.go file Sort []string `protobuf:"bytes,7,rep,name=sort,proto3" json:"sort,omitempty"` // keys to sort on Unique []string `protobuf:"bytes,8,rep,name=unique,proto3" json:"unique,omitempty"` // if the fields should have AppendUnique() functions Vars []*MsgVar `protobuf:"bytes,9,rep,name=vars,proto3" json:"vars,omitempty"` // store all the vars in the message NeedIter bool `protobuf:"varint,10,opt,name=needIter,proto3" json:"needIter,omitempty"` // true if the sort iterator has not been generated yet NeedAll bool `protobuf:"varint,11,opt,name=needAll,proto3" json:"needAll,omitempty"` // true if the sort iterator has not been generated yet NoMutex bool `protobuf:"varint,12,opt,name=noMutex,proto3" json:"noMutex,omitempty"` // only use the global mutex } func (x *MsgName) Reset() { *x = MsgName{} if protoimpl.UnsafeEnabled { mi := &file_file_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MsgName) String() string { return protoimpl.X.MessageStringOf(x) } func (*MsgName) ProtoMessage() {} func (x *MsgName) ProtoReflect() protoreflect.Message { mi := &file_file_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use MsgName.ProtoReflect.Descriptor instead. func (*MsgName) Descriptor() ([]byte, []int) { return file_file_proto_rawDescGZIP(), []int{1} } func (x *MsgName) GetName() string { if x != nil { return x.Name } return "" } func (x *MsgName) GetLockname() string { if x != nil { return x.Lockname } return "" } func (x *MsgName) GetDoMarshal() bool { if x != nil { return x.DoMarshal } return false } func (x *MsgName) GetDoMutex() bool { if x != nil { return x.DoMutex } return false } func (x *MsgName) GetDoProtocMutex() bool { if x != nil { return x.DoProtocMutex } return false } func (x *MsgName) GetMutexFound() bool { if x != nil { return x.MutexFound } return false } func (x *MsgName) GetSort() []string { if x != nil { return x.Sort } return nil } func (x *MsgName) GetUnique() []string { if x != nil { return x.Unique } return nil } func (x *MsgName) GetVars() []*MsgVar { if x != nil { return x.Vars } return nil } func (x *MsgName) GetNeedIter() bool { if x != nil { return x.NeedIter } return false } func (x *MsgName) GetNeedAll() bool { if x != nil { return x.NeedAll } return false } func (x *MsgName) GetNoMutex() bool { if x != nil { return x.NoMutex } return false } type Sort struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields MsgName string `protobuf:"bytes,1,opt,name=msgName,proto3" json:"msgName,omitempty"` // `autogenpb:unique` File VarType string `protobuf:"bytes,2,opt,name=varType,proto3" json:"varType,omitempty"` // `autogenpb:unique` MsgName VarName string `protobuf:"bytes,3,opt,name=varName,proto3" json:"varName,omitempty"` // `autogenpb:unique` msgNames, sortNames Lockname string `protobuf:"bytes,4,opt,name=lockname,proto3" json:"lockname,omitempty"` // NeedAll bool `protobuf:"varint,5,opt,name=needAll,proto3" json:"needAll,omitempty"` // } func (x *Sort) Reset() { *x = Sort{} if protoimpl.UnsafeEnabled { mi := &file_file_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Sort) String() string { return protoimpl.X.MessageStringOf(x) } func (*Sort) ProtoMessage() {} func (x *Sort) ProtoReflect() protoreflect.Message { mi := &file_file_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Sort.ProtoReflect.Descriptor instead. func (*Sort) Descriptor() ([]byte, []int) { return file_file_proto_rawDescGZIP(), []int{2} } func (x *Sort) GetMsgName() string { if x != nil { return x.MsgName } return "" } func (x *Sort) GetVarType() string { if x != nil { return x.VarType } return "" } func (x *Sort) GetVarName() string { if x != nil { return x.VarName } return "" } func (x *Sort) GetLockname() string { if x != nil { return x.Lockname } return "" } func (x *Sort) GetNeedAll() bool { if x != nil { return x.NeedAll } return false } type Find struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // `autogenpb:unique` File VarType string `protobuf:"bytes,2,opt,name=varType,proto3" json:"varType,omitempty"` // `autogenpb:unique` MsgName VarName string `protobuf:"bytes,3,opt,name=varName,proto3" json:"varName,omitempty"` // `autogenpb:unique` msgNames, sortNames NeedAll bool `protobuf:"varint,4,opt,name=needAll,proto3" json:"needAll,omitempty"` // } func (x *Find) Reset() { *x = Find{} if protoimpl.UnsafeEnabled { mi := &file_file_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Find) String() string { return protoimpl.X.MessageStringOf(x) } func (*Find) ProtoMessage() {} func (x *Find) ProtoReflect() protoreflect.Message { mi := &file_file_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Find.ProtoReflect.Descriptor instead. func (*Find) Descriptor() ([]byte, []int) { return file_file_proto_rawDescGZIP(), []int{3} } func (x *Find) GetParent() string { if x != nil { return x.Parent } return "" } func (x *Find) GetVarType() string { if x != nil { return x.VarType } return "" } func (x *Find) GetVarName() string { if x != nil { return x.VarName } return "" } func (x *Find) GetNeedAll() bool { if x != nil { return x.NeedAll } return false } type File struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // `autogenpb:var:w io.Writer` Package string `protobuf:"bytes,1,opt,name=Package,proto3" json:"Package,omitempty"` // whatever the package name is at the top of the .go file Filename string `protobuf:"bytes,2,opt,name=filename,proto3" json:"filename,omitempty"` // yellow.proto Pbfilename string `protobuf:"bytes,3,opt,name=pbfilename,proto3" json:"pbfilename,omitempty"` // yellow.pb.go Filebase string `protobuf:"bytes,4,opt,name=filebase,proto3" json:"filebase,omitempty"` // yellow Uuid string `protobuf:"bytes,5,opt,name=uuid,proto3" json:"uuid,omitempty"` // the uuid to use in a func NewMsgName() Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` // the version to use in a func NewMsgName() Bases *MsgName `protobuf:"bytes,7,opt,name=bases,proto3" json:"bases,omitempty"` // the message in "plural" form Base *MsgName `protobuf:"bytes,8,opt,name=base,proto3" json:"base,omitempty"` // the primary repeated message for the master struct // every struct in this proto file, this file has: "Apple", "Apples", ... "File", etc... MsgNames []*MsgName `protobuf:"bytes,9,rep,name=msgNames,proto3" json:"msgNames,omitempty"` SortNames []*MsgName `protobuf:"bytes,10,rep,name=sortNames,proto3" json:"sortNames,omitempty"` // variables that are repeated can have the standard functions generated (Sort(), etc) IterMap map[string]string `protobuf:"bytes,11,rep,name=iterMap,proto3" json:"iterMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` ToSort []*Sort `protobuf:"bytes,12,rep,name=toSort,proto3" json:"toSort,omitempty"` // variables that are repeated can have the standard functions generated (Sort(), etc) GoPath string `protobuf:"bytes,13,opt,name=goPath,proto3" json:"goPath,omitempty"` // the version to use in a func NewMsgName() } func (x *File) Reset() { *x = File{} if protoimpl.UnsafeEnabled { mi := &file_file_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *File) String() string { return protoimpl.X.MessageStringOf(x) } func (*File) ProtoMessage() {} func (x *File) ProtoReflect() protoreflect.Message { mi := &file_file_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use File.ProtoReflect.Descriptor instead. func (*File) Descriptor() ([]byte, []int) { return file_file_proto_rawDescGZIP(), []int{4} } func (x *File) GetPackage() string { if x != nil { return x.Package } return "" } func (x *File) GetFilename() string { if x != nil { return x.Filename } return "" } func (x *File) GetPbfilename() string { if x != nil { return x.Pbfilename } return "" } func (x *File) GetFilebase() string { if x != nil { return x.Filebase } return "" } func (x *File) GetUuid() string { if x != nil { return x.Uuid } return "" } func (x *File) GetVersion() string { if x != nil { return x.Version } return "" } func (x *File) GetBases() *MsgName { if x != nil { return x.Bases } return nil } func (x *File) GetBase() *MsgName { if x != nil { return x.Base } return nil } func (x *File) GetMsgNames() []*MsgName { if x != nil { return x.MsgNames } return nil } func (x *File) GetSortNames() []*MsgName { if x != nil { return x.SortNames } return nil } func (x *File) GetIterMap() map[string]string { if x != nil { return x.IterMap } return nil } func (x *File) GetToSort() []*Sort { if x != nil { return x.ToSort } return nil } func (x *File) GetGoPath() string { if x != nil { return x.GoPath } return "" } // I know, I know, the whole point of using protobuf // is so you don't need a uuid or versions because it's // inherently forward compatable. nonetheless, a simple stubbed out // trivial and empty protobuf message can marshal and identify all the files // also, this could be used to modify /usr/bin/file /usr/share/magic to identify the files // maybe this is already been done and is pointless, but it seems like a good idea type Files struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // `autogenpb:uuid:6c9ae4dd-648d-4b51-9738-bd59fb8fafd5` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.38` Files []*File `protobuf:"bytes,3,rep,name=Files,proto3" json:"Files,omitempty"` // an array of each .proto file in the working directory } func (x *Files) Reset() { *x = Files{} if protoimpl.UnsafeEnabled { mi := &file_file_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Files) String() string { return protoimpl.X.MessageStringOf(x) } func (*Files) ProtoMessage() {} func (x *Files) ProtoReflect() protoreflect.Message { mi := &file_file_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Files.ProtoReflect.Descriptor instead. func (*Files) Descriptor() ([]byte, []int) { return file_file_proto_rawDescGZIP(), []int{5} } func (x *Files) GetUuid() string { if x != nil { return x.Uuid } return "" } func (x *Files) GetVersion() string { if x != nil { return x.Version } return "" } func (x *Files) GetFiles() []*File { if x != nil { return x.Files } return nil } // this generic message is used by autogen to identify and // then dump the uuid and version from any arbitrary .pb file type Identify struct { sync.RWMutex // auto-added by go.wit.com/apps/autogenpb state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // } func (x *Identify) Reset() { *x = Identify{} if protoimpl.UnsafeEnabled { mi := &file_file_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Identify) String() string { return protoimpl.X.MessageStringOf(x) } func (*Identify) ProtoMessage() {} func (x *Identify) ProtoReflect() protoreflect.Message { mi := &file_file_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Identify.ProtoReflect.Descriptor instead. func (*Identify) Descriptor() ([]byte, []int) { return file_file_proto_rawDescGZIP(), []int{6} } func (x *Identify) GetUuid() string { if x != nil { return x.Uuid } return "" } func (x *Identify) GetVersion() string { if x != nil { return x.Version } return "" } var File_file_proto protoreflect.FileDescriptor var file_file_proto_rawDesc = []byte{ 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x06, 0x4d, 0x73, 0x67, 0x56, 0x61, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x68, 0x61, 0x73, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0xd5, 0x02, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x6f, 0x4d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x64, 0x6f, 0x4d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x4d, 0x75, 0x74, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x64, 0x6f, 0x4d, 0x75, 0x74, 0x65, 0x78, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x4d, 0x75, 0x74, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x4d, 0x75, 0x74, 0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x75, 0x74, 0x65, 0x78, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x6d, 0x75, 0x74, 0x65, 0x78, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x76, 0x61, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x61, 0x72, 0x52, 0x04, 0x76, 0x61, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x65, 0x65, 0x64, 0x49, 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, 0x65, 0x65, 0x64, 0x49, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x65, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x6f, 0x4d, 0x75, 0x74, 0x65, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x4d, 0x75, 0x74, 0x65, 0x78, 0x22, 0x8a, 0x01, 0x0a, 0x04, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x65, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x22, 0x6c, 0x0a, 0x04, 0x46, 0x69, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x61, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x65, 0x65, 0x64, 0x41, 0x6c, 0x6c, 0x22, 0xf1, 0x03, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x62, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x62, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x62, 0x61, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x62, 0x61, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x05, 0x62, 0x61, 0x73, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x05, 0x62, 0x61, 0x73, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x6d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x08, 0x6d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x73, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x09, 0x73, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x07, 0x69, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x70, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x2e, 0x49, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x69, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x70, 0x12, 0x22, 0x0a, 0x06, 0x74, 0x6f, 0x53, 0x6f, 0x72, 0x74, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x53, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x74, 0x6f, 0x53, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x6f, 0x50, 0x61, 0x74, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x6f, 0x50, 0x61, 0x74, 0x68, 0x1a, 0x3a, 0x0a, 0x0c, 0x49, 0x74, 0x65, 0x72, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x57, 0x0a, 0x05, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x05, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x38, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_file_proto_rawDescOnce sync.Once file_file_proto_rawDescData = file_file_proto_rawDesc ) func file_file_proto_rawDescGZIP() []byte { file_file_proto_rawDescOnce.Do(func() { file_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_file_proto_rawDescData) }) return file_file_proto_rawDescData } var file_file_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_file_proto_goTypes = []interface{}{ (*MsgVar)(nil), // 0: main.MsgVar (*MsgName)(nil), // 1: main.MsgName (*Sort)(nil), // 2: main.Sort (*Find)(nil), // 3: main.Find (*File)(nil), // 4: main.File (*Files)(nil), // 5: main.Files (*Identify)(nil), // 6: main.Identify nil, // 7: main.File.IterMapEntry } var file_file_proto_depIdxs = []int32{ 0, // 0: main.MsgName.vars:type_name -> main.MsgVar 1, // 1: main.File.bases:type_name -> main.MsgName 1, // 2: main.File.base:type_name -> main.MsgName 1, // 3: main.File.msgNames:type_name -> main.MsgName 1, // 4: main.File.sortNames:type_name -> main.MsgName 7, // 5: main.File.iterMap:type_name -> main.File.IterMapEntry 2, // 6: main.File.toSort:type_name -> main.Sort 4, // 7: main.Files.Files:type_name -> main.File 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension extendee 0, // [0:8] is the sub-list for field type_name } func init() { file_file_proto_init() } func file_file_proto_init() { if File_file_proto != nil { return } if !protoimpl.UnsafeEnabled { file_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgVar); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgName); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Sort); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_file_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Find); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_file_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*File); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_file_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Files); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_file_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Identify); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_file_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 0, }, GoTypes: file_file_proto_goTypes, DependencyIndexes: file_file_proto_depIdxs, MessageInfos: file_file_proto_msgTypes, }.Build() File_file_proto = out.File file_file_proto_rawDesc = nil file_file_proto_goTypes = nil file_file_proto_depIdxs = nil } // `autogen:file.sort.pb.go` // Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. // This file was autogenerated with autogenpb v0.0.52 2025-02-12_06:22:03_UTC // go install go.wit.com/apps/autogenpb@latest // // define which structs (messages) you want to use in the .proto file // Then sort.pb.go and marshal.pb.go files are autogenerated // // autogenpb uses it and has an example .proto file with instructions // package main import ( "fmt" "sync" ) // a simple global lock var fileMu sync.RWMutex func (x *Files) fixUuid() { if x == nil { return } if x.Uuid == "6c9ae4dd-648d-4b51-9738-bd59fb8fafd5" { return } x.Uuid = "6c9ae4dd-648d-4b51-9738-bd59fb8fafd5" x.Version = "v0.0.38 go.wit.com/apps/autogenpb" } func NewFiles() *Files { x := new(Files) x.Uuid = "6c9ae4dd-648d-4b51-9738-bd59fb8fafd5" x.Version = "v0.0.38 go.wit.com/apps/autogenpb" return x } // START SORT // DEFINE THE Files ITERATOR. // itializes a new iterator. func newFilesIterator(things []*Files) *FilesIterator { return &FilesIterator{things: things} } type FilesIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Files index int } func (it *FilesIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *FilesIterator) Next() *Files { if it.things[it.index-1] == nil { fmt.Println("Next() error in FilesIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE File ITERATOR. // itializes a new iterator. func newFileIterator(things []*File) *FileIterator { return &FileIterator{things: things} } type FileIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*File index int } func (it *FileIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *FileIterator) Next() *File { if it.things[it.index-1] == nil { fmt.Println("Next() error in FileIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE MsgVar ITERATOR. // itializes a new iterator. func newMsgVarIterator(things []*MsgVar) *MsgVarIterator { return &MsgVarIterator{things: things} } type MsgVarIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*MsgVar index int } func (it *MsgVarIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *MsgVarIterator) Next() *MsgVar { if it.things[it.index-1] == nil { fmt.Println("Next() error in MsgVarIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE MsgName ITERATOR. // itializes a new iterator. func newMsgNameIterator(things []*MsgName) *MsgNameIterator { return &MsgNameIterator{things: things} } type MsgNameIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*MsgName index int } func (it *MsgNameIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *MsgNameIterator) Next() *MsgName { if it.things[it.index-1] == nil { fmt.Println("Next() error in MsgNameIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Sort ITERATOR. // itializes a new iterator. func newSortIterator(things []*Sort) *SortIterator { return &SortIterator{things: things} } type SortIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Sort index int } func (it *SortIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *SortIterator) Next() *Sort { if it.things[it.index-1] == nil { fmt.Println("Next() error in SortIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Find ITERATOR. // itializes a new iterator. func newFindIterator(things []*Find) *FindIterator { return &FindIterator{things: things} } type FindIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Find index int } func (it *FindIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *FindIterator) Next() *Find { if it.things[it.index-1] == nil { fmt.Println("Next() error in FindIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // DEFINE THE Identify ITERATOR. // itializes a new iterator. func newIdentifyIterator(things []*Identify) *IdentifyIterator { return &IdentifyIterator{things: things} } type IdentifyIterator struct { sync.RWMutex // this isn't getting used properly yet? things []*Identify index int } func (it *IdentifyIterator) Scan() bool { if it.index >= len(it.things) { return false } it.index++ return true } // Next() returns the next thing in the array func (it *IdentifyIterator) Next() *Identify { if it.things[it.index-1] == nil { fmt.Println("Next() error in IdentifyIterator", it.index) } return it.things[it.index-1] } // END DEFINE THE ITERATOR // safely returns a slice of pointers to the FRUIT protobufs func (x *Files) allFiles() []*File { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*File tmp = make([]*File, len(x.Files)) for i, p := range x.Files { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *File) allMsgNames() []*MsgName { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*MsgName tmp = make([]*MsgName, len(x.MsgNames)) for i, p := range x.MsgNames { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *File) allSortNames() []*MsgName { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*MsgName tmp = make([]*MsgName, len(x.SortNames)) for i, p := range x.SortNames { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *File) allToSort() []*Sort { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*Sort tmp = make([]*Sort, len(x.ToSort)) for i, p := range x.ToSort { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the FRUIT protobufs func (x *MsgName) allVars() []*MsgVar { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each FRUIT var tmp []*MsgVar tmp = make([]*MsgVar, len(x.Vars)) for i, p := range x.Vars { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the File protobufs func (x *Files) selectAllFiles() []*File { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each File var tmp []*File tmp = make([]*File, len(x.Files)) for i, p := range x.Files { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the MsgName protobufs func (x *File) selectAllMsgNames() []*MsgName { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each MsgName var tmp []*MsgName tmp = make([]*MsgName, len(x.MsgNames)) for i, p := range x.MsgNames { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the MsgName protobufs func (x *File) selectAllSortNames() []*MsgName { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each MsgName var tmp []*MsgName tmp = make([]*MsgName, len(x.SortNames)) for i, p := range x.SortNames { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the Sort protobufs func (x *File) selectAllToSort() []*Sort { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each Sort var tmp []*Sort tmp = make([]*Sort, len(x.ToSort)) for i, p := range x.ToSort { tmp[i] = p // Copy pointers for safe iteration } return tmp } // safely returns a slice of pointers to the MsgVar protobufs func (x *MsgName) selectAllVars() []*MsgVar { x.RLock() defer x.RUnlock() // Create a new slice to hold pointers to each MsgVar var tmp []*MsgVar tmp = make([]*MsgVar, len(x.Vars)) for i, p := range x.Vars { tmp[i] = p // Copy pointers for safe iteration } return tmp } // END SORT func (x *Files) Len() int { x.RLock() defer x.RUnlock() return len(x.Files) } // just a simple Append() shortcut (but still uses the mutex lock) func (x *Files) Append(y *File) { x.Lock() defer x.Unlock() x.Files = append(x.Files, y) } func (x *Files) All() *FileIterator { FilePointers := x.selectAllFiles() iterator := newFileIterator(FilePointers) return iterator } func (x *Files) Delete(y *File) bool { x.Lock() defer x.Unlock() for i, _ := range x.Files { if x.Files[i] == y { x.Files[i] = x.Files[len(x.Files)-1] x.Files = x.Files[:len(x.Files)-1] return true } } return false } // `autogen:`
96
file.proto
96
file.proto
|
@ -26,60 +26,60 @@ package main;
|
|||
// protobuf files to write out *.sort.pb.go and *.marshal.pb.go files
|
||||
//
|
||||
message MsgVar {
|
||||
string varName = 1; // the variable name
|
||||
string varType = 2; // the variable type
|
||||
bool isRepeated = 3; // does the variable repeate
|
||||
bool hasSort = 4; // marked with sort
|
||||
bool hasUnique = 5; // marked with unique
|
||||
string varName = 1; // the variable name
|
||||
string varType = 2; // the variable type
|
||||
bool isRepeated = 3; // does the variable repeate
|
||||
bool hasSort = 4; // marked with sort
|
||||
bool hasUnique = 5; // marked with unique
|
||||
}
|
||||
|
||||
message MsgName {
|
||||
string name = 1; // the name of the message aka struct. for this example: "Shelf"
|
||||
string lockname = 2; // name of the lockfile. ends in Mu
|
||||
bool doMarshal = 3; // if msg struct should have Marshal & Unmarshal functions
|
||||
bool doMutex = 4; // true if a mutex is needed for the message struct
|
||||
bool doProtocMutex = 5; // an experiment to insert a mutex into the protoc generated msg struct (bad idea?)
|
||||
bool mutexFound = 6; // true if the mutex was added to the protoc pb.go file
|
||||
repeated string sort = 7; // keys to sort on
|
||||
repeated string unique = 8; // if the fields should have AppendUnique() functions
|
||||
repeated MsgVar vars = 9; // store all the vars in the message
|
||||
bool needIter = 10; // true if the sort iterator has not been generated yet
|
||||
bool needAll = 11; // true if the sort iterator has not been generated yet
|
||||
bool noMutex = 12; // only use the global mutex
|
||||
string name = 1; // the name of the message aka struct. for this example: "Shelf"
|
||||
string lockname = 2; // name of the lockfile. ends in Mu
|
||||
bool doMarshal = 3; // if msg struct should have Marshal & Unmarshal functions
|
||||
bool doMutex = 4; // true if a mutex is needed for the message struct
|
||||
bool doProtocMutex = 5; // an experiment to insert a mutex into the protoc generated msg struct (bad idea?)
|
||||
bool mutexFound = 6; // true if the mutex was added to the protoc pb.go file
|
||||
repeated string sort = 7; // keys to sort on
|
||||
repeated string unique = 8; // if the fields should have AppendUnique() functions
|
||||
repeated MsgVar vars = 9; // store all the vars in the message
|
||||
bool needIter = 10; // true if the sort iterator has not been generated yet
|
||||
bool needAll = 11; // true if the sort iterator has not been generated yet
|
||||
bool noMutex = 12; // only use the global mutex
|
||||
}
|
||||
|
||||
message Sort {
|
||||
string msgName = 1; // `autogenpb:unique` File
|
||||
string varType = 2; // `autogenpb:unique` MsgName
|
||||
string varName = 3; // `autogenpb:unique` msgNames, sortNames
|
||||
string lockname = 4; //
|
||||
bool needAll = 5; //
|
||||
string msgName = 1; // `autogenpb:unique` File
|
||||
string varType = 2; // `autogenpb:unique` MsgName
|
||||
string varName = 3; // `autogenpb:unique` msgNames, sortNames
|
||||
string lockname = 4; //
|
||||
bool needAll = 5; //
|
||||
}
|
||||
|
||||
message Find {
|
||||
string parent = 1; // `autogenpb:unique` File
|
||||
string varType = 2; // `autogenpb:unique` MsgName
|
||||
string varName = 3; // `autogenpb:unique` msgNames, sortNames
|
||||
bool needAll = 4; //
|
||||
string parent = 1; // `autogenpb:unique` File
|
||||
string varType = 2; // `autogenpb:unique` MsgName
|
||||
string varName = 3; // `autogenpb:unique` msgNames, sortNames
|
||||
bool needAll = 4; //
|
||||
}
|
||||
|
||||
message File {
|
||||
// `autogenpb:var:w io.Writer`
|
||||
string Package = 1; // whatever the package name is at the top of the .go file
|
||||
string filename = 2; // yellow.proto
|
||||
string pbfilename = 3; // yellow.pb.go
|
||||
string filebase = 4; // yellow
|
||||
string uuid = 5; // the uuid to use in a func NewMsgName()
|
||||
string version = 6; // the version to use in a func NewMsgName()
|
||||
MsgName bases = 7; // the message in "plural" form
|
||||
MsgName base = 8; // the primary repeated message for the master struct
|
||||
// `autogenpb:var:w io.Writer`
|
||||
string Package = 1; // whatever the package name is at the top of the .go file
|
||||
string filename = 2; // yellow.proto
|
||||
string pbfilename = 3; // yellow.pb.go
|
||||
string filebase = 4; // yellow
|
||||
string uuid = 5; // the uuid to use in a func NewMsgName()
|
||||
string version = 6; // the version to use in a func NewMsgName()
|
||||
MsgName bases = 7; // the message in "plural" form
|
||||
MsgName base = 8; // the primary repeated message for the master struct
|
||||
|
||||
// every struct in this proto file, this file has: "Apple", "Apples", ... "File", etc...
|
||||
repeated MsgName msgNames = 9;
|
||||
repeated MsgName sortNames = 10; // variables that are repeated can have the standard functions generated (Sort(), etc)
|
||||
map<string, string> iterMap = 11;
|
||||
repeated Sort toSort = 12; // variables that are repeated can have the standard functions generated (Sort(), etc)
|
||||
string goPath = 13; // the version to use in a func NewMsgName()
|
||||
// every struct in this proto file, this file has: "Apple", "Apples", ... "File", etc...
|
||||
repeated MsgName msgNames = 9;
|
||||
repeated MsgName sortNames = 10; // variables that are repeated can have the standard functions generated (Sort(), etc)
|
||||
map<string, string> iterMap = 11;
|
||||
repeated Sort toSort = 12; // variables that are repeated can have the standard functions generated (Sort(), etc)
|
||||
string goPath = 13; // the version to use in a func NewMsgName()
|
||||
}
|
||||
|
||||
// I know, I know, the whole point of using protobuf
|
||||
|
@ -88,15 +88,15 @@ message File {
|
|||
// trivial and empty protobuf message can marshal and identify all the files
|
||||
// also, this could be used to modify /usr/bin/file /usr/share/magic to identify the files
|
||||
// maybe this is already been done and is pointless, but it seems like a good idea
|
||||
message Files { // `autogenpb:marshal`
|
||||
string uuid = 1; // `autogenpb:uuid:6c9ae4dd-648d-4b51-9738-bd59fb8fafd5`
|
||||
string version = 2; // `autogenpb:version:v0.0.38`
|
||||
repeated File Files = 3; // an array of each .proto file in the working directory
|
||||
message Files { // `autogenpb:marshal`
|
||||
string uuid = 1; // `autogenpb:uuid:6c9ae4dd-648d-4b51-9738-bd59fb8fafd5`
|
||||
string version = 2; // `autogenpb:version:v0.0.38`
|
||||
repeated File Files = 3; // an array of each .proto file in the working directory
|
||||
}
|
||||
|
||||
// this generic message is used by autogen to identify and
|
||||
// then dump the uuid and version from any arbitrary .pb file
|
||||
message Identify { // `autogenpb:marshal`
|
||||
string uuid = 1; //
|
||||
string version = 2; //
|
||||
message Identify { // `autogenpb:marshal`
|
||||
string uuid = 1; //
|
||||
string version = 2; //
|
||||
}
|
||||
|
|
9
human.go
9
human.go
|
@ -5,13 +5,8 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
|
||||
"github.com/go-cmd/cmd"
|
||||
"github.com/google/uuid"
|
||||
"go.wit.com/log"
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
// This was just going to be a function to print the results to stdout
|
||||
|
@ -131,6 +126,7 @@ func (msg *MsgName) printMsg() {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func checkCmd(cmd string) {
|
||||
// path, err := exec.LookPath(cmd)
|
||||
_, err := exec.LookPath(cmd)
|
||||
|
@ -160,6 +156,7 @@ func (pf *File) noPluralMessage() {
|
|||
log.Info("###########################################################################")
|
||||
badExit(fmt.Errorf("proto file error %s", pf.Filename))
|
||||
}
|
||||
*/
|
||||
|
||||
// message Fruits { // `autogenpb:marshal` `autogenpb:mutex`
|
||||
// string uuid = 1; // `autogenpb:uuid:be926ad9-f07f-484c-adf2-d96eeabf3079`
|
||||
|
@ -167,6 +164,7 @@ func (pf *File) noPluralMessage() {
|
|||
// repeated Fruit Fruits = 3; // THIS MUST BE "Fruit" and then "Fruit" + "s"
|
||||
// }
|
||||
|
||||
/*
|
||||
func (pf *File) noUuid() {
|
||||
base := cases.Title(language.English, cases.NoLower).String(pf.Filebase)
|
||||
id := uuid.New()
|
||||
|
@ -209,3 +207,4 @@ func userInstructions() {
|
|||
log.Info(" apt install protoc-gen-go # for protoc-gen-go")
|
||||
log.Info("")
|
||||
}
|
||||
*/
|
||||
|
|
31
main.go
31
main.go
|
@ -1,9 +1,9 @@
|
|||
//go:build go1.20
|
||||
// +build go1.20
|
||||
|
||||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
// +build go1.20
|
||||
|
||||
// protobuf the way I am using them, require GO 1.20. I think. I could be wrong.
|
||||
// The Go Protocol Buffers library embeds a sync.Mutex within the MessageState struct to prevent unintended shallow copies of message structs
|
||||
// this optionally (but it is the default) inserts a mutex into the struct generated by protoc
|
||||
|
@ -21,6 +21,7 @@ import (
|
|||
|
||||
"github.com/alexflint/go-arg"
|
||||
"github.com/go-cmd/cmd"
|
||||
"go.wit.com/lib/fhelp"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
@ -102,16 +103,15 @@ func main() {
|
|||
argv.GoSrc = filepath.Join(homeDir, "go/src")
|
||||
}
|
||||
|
||||
var startpwd string
|
||||
startpwd, _ = os.Getwd()
|
||||
log.Info("start pwd = ", startpwd)
|
||||
if argv.GoPath == "" {
|
||||
pwd, _ := os.Getwd()
|
||||
argv.GoPath = strings.TrimPrefix(pwd, argv.GoSrc)
|
||||
argv.GoPath = strings.TrimPrefix(startpwd, argv.GoSrc)
|
||||
argv.GoPath = strings.Trim(argv.GoPath, "/")
|
||||
}
|
||||
log.Info(argv.GoSrc, argv.GoPath)
|
||||
|
||||
pwd, _ := os.Getwd()
|
||||
log.Info("pwd = ", pwd)
|
||||
|
||||
if !shell.Exists("go.sum") {
|
||||
shell.RunQuiet([]string{"go-mod-clean"})
|
||||
if !shell.Exists("go.sum") {
|
||||
|
@ -145,20 +145,29 @@ func main() {
|
|||
// try to make foo.pb.go with protoc if it's not here
|
||||
// this is helpful because the protoc-gen-go lines
|
||||
// are also annoying to code by hand
|
||||
checkCmd("protoc")
|
||||
checkCmd("protoc-gen-go")
|
||||
// checkCmd("protoc")
|
||||
// checkCmd("protoc-gen-go")
|
||||
|
||||
if !fhelp.CheckProtoc() {
|
||||
badExit(fmt.Errorf("you do not have 'protoc' installed"))
|
||||
}
|
||||
|
||||
pf.Pbfilename = pf.Filebase + ".pb.go"
|
||||
// try to create the foo.pb.go file using protoc if it is not there
|
||||
if !shell.Exists(pf.Pbfilename) {
|
||||
checkCmd("protoc")
|
||||
checkCmd("protoc-gen-go")
|
||||
if !fhelp.CheckProtoc() {
|
||||
badExit(fmt.Errorf("you do not have 'protoc' installed"))
|
||||
}
|
||||
|
||||
// checkCmd("protoc")
|
||||
// checkCmd("protoc-gen-go")
|
||||
|
||||
if err := pb.protocBuild(pf); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
|
||||
}
|
||||
os.Chdir(startpwd)
|
||||
|
||||
// try to add the Mutex to the pb.go file
|
||||
if err := pb.addMutex(pf); err != nil {
|
||||
|
|
16
protoc.go
16
protoc.go
|
@ -96,16 +96,18 @@ func (pb *Files) protocBuild(pf *File) error {
|
|||
for i, s := range cmd {
|
||||
log.Info("\t", i, s)
|
||||
}
|
||||
return runprotoc(argv.GoSrc, cmd)
|
||||
os.Chdir(argv.GoSrc)
|
||||
_, err = shell.RunVerbose(cmd)
|
||||
return err
|
||||
}
|
||||
|
||||
/*
|
||||
func runprotoc(pwd string, mycmd []string) error {
|
||||
result := shell.PathRun(argv.GoSrc, mycmd)
|
||||
if result.Error != nil {
|
||||
return userNotes(result)
|
||||
}
|
||||
if result.Exit != 0 {
|
||||
return userNotes(result)
|
||||
os.Chdir(argv.GoSrc)
|
||||
err := shell.Exec(mycmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue