@@ -1130,6 +1130,12 @@ type ProfileLibraryReference_LocalLibraryResult struct {
11301130 Path string `json:"path,omitempty"`
11311131}
11321132
1133+ func (* ProfileLibraryReference_LocalLibraryResult ) isProfileLibraryReference () {}
1134+
1135+ func (l * ProfileLibraryReference_LocalLibraryResult ) String () string {
1136+ return fmt .Sprintf ("lib: %s" , l .Path )
1137+ }
1138+
11331139func NewProfileLibraryReference_LocalLibraryResult (resp * rpc.ProfileLibraryReference_LocalLibrary ) * ProfileLibraryReference_LocalLibraryResult {
11341140 return & ProfileLibraryReference_LocalLibraryResult {
11351141 Path : resp .GetPath (),
@@ -1142,10 +1148,49 @@ type ProfileLibraryReference_IndexLibraryResult struct {
11421148 IsDependency bool `json:"is_dependency,omitempty"`
11431149}
11441150
1151+ func (* ProfileLibraryReference_IndexLibraryResult ) isProfileLibraryReference () {}
1152+
1153+ func (l * ProfileLibraryReference_IndexLibraryResult ) String () string {
1154+ if l .IsDependency {
1155+ return fmt .Sprintf ("dependency: %s@%s" , l .Name , l .Version )
1156+ }
1157+ return fmt .Sprintf ("%s@%s" , l .Name , l .Version )
1158+ }
1159+
11451160func NewProfileLibraryReference_IndexLibraryResult (resp * rpc.ProfileLibraryReference_IndexLibrary ) * ProfileLibraryReference_IndexLibraryResult {
11461161 return & ProfileLibraryReference_IndexLibraryResult {
11471162 Name : resp .GetName (),
11481163 Version : resp .GetVersion (),
11491164 IsDependency : resp .GetIsDependency (),
11501165 }
11511166}
1167+
1168+ type ProfileLibraryReference struct {
1169+ Kind string `json:"kind,omitempty"`
1170+ Library ProfileLibraryReference_Library `json:"library,omitempty"`
1171+ }
1172+
1173+ type ProfileLibraryReference_Library interface {
1174+ isProfileLibraryReference ()
1175+ fmt.Stringer
1176+ }
1177+
1178+ func NewProfileLibraryReference (resp * rpc.ProfileLibraryReference ) * ProfileLibraryReference {
1179+ if lib := resp .GetIndexLibrary (); lib != nil {
1180+ return & ProfileLibraryReference {
1181+ Library : NewProfileLibraryReference_IndexLibraryResult (lib ),
1182+ Kind : "index" ,
1183+ }
1184+ }
1185+ if lib := resp .GetLocalLibrary (); lib != nil {
1186+ return & ProfileLibraryReference {
1187+ Library : NewProfileLibraryReference_LocalLibraryResult (lib ),
1188+ Kind : "local" ,
1189+ }
1190+ }
1191+ return nil
1192+ }
1193+
1194+ func (p * ProfileLibraryReference ) String () string {
1195+ return p .Library .String ()
1196+ }
0 commit comments