Symptom:
When we write go code for kubernetes OwnerReference , we get such errorexpected ';', found '{'code is like
var oradbownerref = []metav1.ObjectMeta.OwnerReference{{
Kind: apexords.TypeMeta.Kind,
APIVersion: apexords.TypeMeta.APIVersion,
Name: apexords.ObjectMeta.Name,
UID: apexords.ObjectMeta.UID,
}}
Solution:
It is due to OwnerReference is on metav1 level ,not metav1.ObjectMeta level.Correct code is
var oradbownerref = []metav1.OwnerReference{{
Kind: apexords.TypeMeta.Kind,
APIVersion: apexords.TypeMeta.APIVersion,
Name: apexords.ObjectMeta.Name,
UID: apexords.ObjectMeta.UID,
}}
No comments:
Post a Comment