This PR adds a map and list implementation on top of the go protobuf v2 api, and adds type conversions (protoreflect.Value to/from starlark.Value). This is largely boilerplate, and is unused so it should not have any functional impact on Skycfg today.
I am continuing the migration to the go protubuf v2 api, which is partially started on trunk
Tests
Added tests:
I have added tests for the map and list types. type_conversions will be tested implicitly once the message type is added (it's awkward to access right now). These tests cover TestListMutation and TestMapMutation from the existing implementation, but line up with the new protomodule_test functions for messageType, enum and package
Summary
This PR adds a map and list implementation on top of the go protobuf v2 api, and adds type conversions (
protoreflect.Value
to/fromstarlark.Value
). This is largely boilerplate, and is unused so it should not have any functional impact on Skycfg today.protomodule_map
implementation to wrap an underlyingstarlark.Dict
with typechecking on writes. This lines up withprotoMap
from the existing implementation https://github.com/stripe/skycfg/blob/trunk/internal/go/skycfg/proto_message.go#L869protomodule_list
implementation to wrap an underlyingstarlark.List
with typechecking on writes. This lines up withprotoRepeated
from the existing implementation https://github.com/stripe/skycfg/blob/trunk/internal/go/skycfg/proto_message.go#L679type_conversions
: this implementsvalueFromStarlark
andvalueToStarlark
like the existing implementation (throughout https://github.com/stripe/skycfg/blob/trunk/internal/go/skycfg/proto_message.go)Motivation
I am continuing the migration to the go protubuf v2 api, which is partially started on trunk
Tests
map
andlist
types.type_conversions
will be tested implicitly once the message type is added (it's awkward to access right now). These tests coverTestListMutation
andTestMapMutation
from the existing implementation, but line up with the newprotomodule_test
functions formessageType
,enum
andpackage
internal/