tangled
alpha
login
or
join now
tom.sherman.is
/
piper
0
fork
atom
A fork of https://github.com/teal-fm/piper
0
fork
atom
overview
issues
pulls
pipelines
work on lexgen build
Kyle Loveless
10 months ago
7fe000c8
7b57b246
+32
-3
2 changed files
expand all
collapse all
unified
split
Makefile
util
gencbor
gencbor.go
+5
-3
Makefile
···
1
1
.PHONY: lexgen-types
2
2
lexgen-types:
3
3
rm -rf ../atproto \
4
4
-
&& git clone git@github.com:bluesky-social/atproto ../ \
5
5
-
go run github.com/bluesky-social/indigo/cmd/lexgen \
4
4
+
&& rm -rf ./api/cbor/cbor_gen.go \
5
5
+
&& git clone git@github.com:bluesky-social/atproto ../atproto \
6
6
+
&& go run github.com/bluesky-social/indigo/cmd/lexgen \
6
7
--build-file ./lexcfg.json \
7
8
../atproto/lexicons \
8
8
-
./lexicons/teal
9
9
+
./lexicons/teal \
10
10
+
&& go run ./util/gencbor/gencbor.go
+27
util/gencbor/gencbor.go
···
1
1
+
package main
2
2
+
3
3
+
import (
4
4
+
"reflect"
5
5
+
6
6
+
"github.com/bluesky-social/indigo/mst"
7
7
+
"github.com/teal-fm/piper/api/teal"
8
8
+
9
9
+
cbg "github.com/whyrusleeping/cbor-gen"
10
10
+
)
11
11
+
12
12
+
func main() {
13
13
+
var typeVals []any
14
14
+
for _, typ := range mst.CBORTypes() {
15
15
+
typeVals = append(typeVals, reflect.New(typ).ELem().Interface())
16
16
+
}
17
17
+
18
18
+
genCfg := cbg.Gen{
19
19
+
MaxStringLength: 1_000_000,
20
20
+
}
21
21
+
22
22
+
if err := genCfg.WriteMapEncodersToFile("api/cbor/cbor_gen.go", "teal",
23
23
+
teal.AlphaFeedPlay{},
24
24
+
); err != nil {
25
25
+
panic(err)
26
26
+
}
27
27
+
}