core.go: The vdl "any" type is now generated as go *vdl.Value.
Previously we were generating as vdl.AnyRep, which was another
name for interface{}. There are multiple problems with using
interface{}:
1) Decoding into an "interface{}" requires that the type has
been registered with VDL, and uses our type name based
matching logic. This is error prone; if we happen to change
the package path, the type name changes. And if the type
isn't registered, we'll end up with a *vdl.Value anyways.
Now there's no ambiguity; you always get a *vdl.Value, which
can represent values of all vdl types.
2) Some Go values aren't valid in VDL. E.g. Go values that
contain channels, functions or unsafe pointers are all
invalid. Using *vdl.Value at our API boundaries forces the
callers to make an informed decision.
This is the main portion of a 7-part CL, which removes
vdl.AnyRep, and uses *vdl.Value instead.
MultiPart: 1/7
Change-Id: Ie4f3ab6bce0363f82f53c2315a7435844f6ffe85
diff --git a/services/mgmt/repository/repository.vdl.go b/services/mgmt/repository/repository.vdl.go
index a460dca..b2aab89 100644
--- a/services/mgmt/repository/repository.vdl.go
+++ b/services/mgmt/repository/repository.vdl.go
@@ -205,7 +205,7 @@
{"Profiles", ``}, // []string
{"Envelope", ``}, // application.Envelope
},
- Tags: []vdl.AnyRep{access.Tag("Write")},
+ Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))},
},
{
Name: "Remove",
@@ -213,7 +213,7 @@
InArgs: []ipc.ArgDesc{
{"Profile", ``}, // string
},
- Tags: []vdl.AnyRep{access.Tag("Write")},
+ Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))},
},
},
}
@@ -395,7 +395,7 @@
OutArgs: []ipc.ArgDesc{
{"", ``}, // profile.Specification
},
- Tags: []vdl.AnyRep{access.Tag("Read")},
+ Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Read"))},
},
{
Name: "Put",
@@ -403,12 +403,12 @@
InArgs: []ipc.ArgDesc{
{"Specification", ``}, // profile.Specification
},
- Tags: []vdl.AnyRep{access.Tag("Write")},
+ Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))},
},
{
Name: "Remove",
Doc: "// Remove removes the profile specification for the profile\n// identified through the object name suffix.",
- Tags: []vdl.AnyRep{access.Tag("Write")},
+ Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Write"))},
},
},
}