Skip to content

Commit

Permalink
cue: remove support for legacy protobuf attributes
Browse files Browse the repository at this point in the history
https://cue-review.googlesource.com/c/cue/+/9368 in April 2021
added a bit of code so that we could still support old attributes like

    @protobuf(4,type=double,name=double_value)

alongside the new form

    @protobuf(4,double,name=double_value)

It has been over three years now, and we are early in the v0.11
release cycle, so it is a good time to remove the compatibility code.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: Iba2f1339a56138f642216bb802612fe8402f547b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200324
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Matthew Sackman <[email protected]>
  • Loading branch information
mvdan committed Aug 30, 2024
1 parent de41586 commit 985855f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions cue/attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,5 @@ func (a *Attribute) Flag(pos int, key string) (bool, error) {
// and reports the value if found. It reports an error if the attribute is
// invalid or if the first pos-1 entries are not defined.
func (a *Attribute) Lookup(pos int, key string) (val string, found bool, err error) {
val, found, err = a.attr.Lookup(pos, key)

// TODO: remove at some point. This is an ugly hack to simulate the old
// behavior of protobufs.
if !found && a.attr.Name == "protobuf" && key == "type" {
val, err = a.String(1)
found = err == nil
}
return val, found, err
return a.attr.Lookup(pos, key)
}

0 comments on commit 985855f

Please sign in to comment.