123 lines
3.5 KiB
Plaintext
123 lines
3.5 KiB
Plaintext
// `autogen:go.mod`
|
|
|
|
module go.wit.com/lib/protobuf/zoopb
|
|
|
|
go 1.21
|
|
|
|
toolchain go1.23.4
|
|
|
|
require (
|
|
go.wit.com/log v0.22.9
|
|
google.golang.org/protobuf v1.35.2
|
|
)
|
|
|
|
// `autogen:go.sum`
|
|
|
|
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=
|
|
go.wit.com/log v0.22.9 h1:aBM6SI2kxlJcBfS/osFTomJqNhO0hfEo1gk+LCqLk7Y=
|
|
go.wit.com/log v0.22.9/go.mod h1:4uNPFBqhsAh8zNF+zxVEmC3c/9AZ8JeTfUUvRpddvLQ=
|
|
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.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
|
|
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
|
|
|
// `autogen:machine.marshal.pb.go`
|
|
|
|
package zoopb
|
|
|
|
// This file was autogenerated with autogenpb v0.0.28 DO NOT EDIT
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// You can use it on simple protobuf files
|
|
// The .proto file must have a singular and plural form of a message
|
|
// (for those of you that know ruby on rails, it's like that)
|
|
//
|
|
// You can mark which repos you want to auto generate sort.pb.go and marshal.pb.go files for
|
|
//
|
|
// For an example,
|
|
// go-clone go.wit.com/lib/protobuf/gitpb
|
|
//
|
|
|
|
import (
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
"google.golang.org/protobuf/encoding/prototext"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// human readable JSON
|
|
func (v *Machine) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *Machine) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *Machine) 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 so great for config files, I'm using it by default to try to fix the problems with it
|
|
func (v *Machine) FormatTEXT() string {
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *Machine) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *Machine) Marshal() ([]byte, error) {
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *Machine) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// human readable JSON
|
|
func (v *Machines) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *Machines) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *Machines) 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 so great for config files, I'm using it by default to try to fix the problems with it
|
|
func (v *Machines) FormatTEXT() string {
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *Machines) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *Machines) Marshal() ([]byte, error) {
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *Machines) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// `autogen:machine.pb.go`
|