this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

have lexgen output 'lexutil' pkg name

+14 -14
+2 -2
lex/gen.go
··· 135 135 pf("\t\"fmt\"\n") 136 136 pf("\t\"encoding/json\"\n") 137 137 pf("\tcbg \"github.com/whyrusleeping/cbor-gen\"\n") 138 - pf("\t\"github.com/bluesky-social/indigo/lex/util\"\n") 138 + pf("\tlexutil \"github.com/bluesky-social/indigo/lex/util\"\n") 139 139 for _, xpkg := range packages { 140 140 if xpkg.Prefix != pkg.Prefix { 141 141 pf("\t%s %q\n", importNameForPrefix(xpkg.Prefix), xpkg.Import) ··· 190 190 if buf.Len() == 0 { 191 191 outf("func init() {\n") 192 192 } 193 - outf("util.RegisterType(%q, &%s{})\n", id, t.Name) 193 + outf("lexutil.RegisterType(%q, &%s{})\n", id, t.Name) 194 194 } 195 195 } 196 196 if buf.Len() == 0 {
+12 -12
lex/type_schema.go
··· 55 55 pf := printerf(w) 56 56 fname := typename 57 57 58 - params := "ctx context.Context, c util.LexClient" 58 + params := "ctx context.Context, c lexutil.LexClient" 59 59 inpvar := "nil" 60 60 inpenc := "" 61 61 ··· 174 174 var reqtype string 175 175 switch s.Type { 176 176 case "procedure": 177 - reqtype = "util.Procedure" 177 + reqtype = "lexutil.Procedure" 178 178 case "query": 179 - reqtype = "util.Query" 179 + reqtype = "lexutil.Query" 180 180 default: 181 181 return fmt.Errorf("can only generate RPC for Query or Procedure (got %s)", s.Type) 182 182 } ··· 555 555 if k == "didDoc" || k == "plcOp" || k == "meta" { 556 556 return "interface{}", nil 557 557 } else { 558 - return "*util.LexiconTypeDecoder", nil 558 + return "*lexutil.LexiconTypeDecoder", nil 559 559 } 560 560 case "union": 561 561 if len(v.Refs) > 0 { 562 562 return "*" + name + "_" + strings.Title(k), nil 563 563 } else { 564 564 // an empty union is effectively an 'unknown', but with mandatory type indicator 565 - return "*util.LexiconTypeDecoder", nil 565 + return "*lexutil.LexiconTypeDecoder", nil 566 566 } 567 567 case "blob": 568 - return "*util.LexBlob", nil 568 + return "*lexutil.LexBlob", nil 569 569 case "array": 570 570 subt, err := s.typeNameForField(name+"_"+strings.Title(k), "Elem", *v.Items) 571 571 if err != nil { ··· 574 574 575 575 return "[]" + subt, nil 576 576 case "cid-link": 577 - return "util.LexLink", nil 577 + return "lexutil.LexLink", nil 578 578 case "bytes": 579 - return "util.LexBytes", nil 579 + return "lexutil.LexBytes", nil 580 580 default: 581 581 return "", fmt.Errorf("field %q in %s has unsupported type name (%s)", k, name, v.Type) 582 582 } ··· 692 692 jsonOmit, cborOmit := omit, omit 693 693 694 694 // Don't generate pointers to lexbytes, as it's already a pointer. 695 - if ptr == "*" && tname == "util.LexBytes" { 695 + if ptr == "*" && tname == "lexutil.LexBytes" { 696 696 ptr = "" 697 697 } 698 698 699 699 // TODO: hard-coded hacks for now, making this type (with underlying type []byte) 700 700 // be omitempty. 701 - if ptr == "" && tname == "util.LexBytes" { 701 + if ptr == "" && tname == "lexutil.LexBytes" { 702 702 jsonOmit = ",omitempty" 703 703 cborOmit = ",omitempty" 704 704 } ··· 827 827 func (ts *TypeSchema) writeJsonUnmarshalerEnum(name string, w io.Writer) error { 828 828 pf := printerf(w) 829 829 pf("func (t *%s) UnmarshalJSON(b []byte) (error) {\n", name) 830 - pf("\ttyp, err := util.TypeExtract(b)\n") 830 + pf("\ttyp, err := lexutil.TypeExtract(b)\n") 831 831 pf("\tif err != nil {\n\t\treturn err\n\t}\n\n") 832 832 pf("\tswitch typ {\n") 833 833 for _, e := range ts.Refs { ··· 884 884 func (ts *TypeSchema) writeCborUnmarshalerEnum(name string, w io.Writer) error { 885 885 pf := printerf(w) 886 886 pf("func (t *%s) UnmarshalCBOR(r io.Reader) error {\n", name) 887 - pf("\ttyp, b, err := util.CborTypeExtractReader(r)\n") 887 + pf("\ttyp, b, err := lexutil.CborTypeExtractReader(r)\n") 888 888 pf("\tif err != nil {\n\t\treturn err\n\t}\n\n") 889 889 pf("\tswitch typ {\n") 890 890 for _, e := range ts.Refs {