Files
at-container-registry/gen/main.go
T

34 lines
739 B
Go

package main
// CBOR Code Generator
//
// This generates optimized CBOR marshaling code for ATProto records.
//
// Usage:
// go run gen/main.go
//
// This creates pkg/hold/pds/cbor_gen.go which should be committed to git.
// Only re-run when you modify types in pkg/hold/pds/types.go
import (
"fmt"
"os"
cbg "github.com/whyrusleeping/cbor-gen"
"atcr.io/pkg/hold/pds"
)
func main() {
// Generate map-style encoders for CrewRecord and CaptainRecord
if err := cbg.WriteMapEncodersToFile("pkg/hold/pds/cbor_gen.go", "pds",
pds.CrewRecord{},
pds.CaptainRecord{},
); err != nil {
fmt.Printf("Failed to generate CBOR encoders: %v\n", err)
os.Exit(1)
}
fmt.Println("Generated CBOR encoders in pkg/hold/pds/cbor_gen.go")
}