diff --git a/docs/hugo/content/contributing/aso-codegen-structure.svg b/docs/hugo/content/contributing/aso-codegen-structure.svg
index 1be6e00a5be..706f6983156 100644
--- a/docs/hugo/content/contributing/aso-codegen-structure.svg
+++ b/docs/hugo/content/contributing/aso-codegen-structure.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/hugo/content/contributing/aso-v1-structure.svg b/docs/hugo/content/contributing/aso-v1-structure.svg
index 3cedb7c6ec1..c36ff4bc98b 100644
--- a/docs/hugo/content/contributing/aso-v1-structure.svg
+++ b/docs/hugo/content/contributing/aso-v1-structure.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/hugo/content/contributing/aso-v2-structure.svg b/docs/hugo/content/contributing/aso-v2-structure.svg
index 5100e72b985..8276964de96 100644
--- a/docs/hugo/content/contributing/aso-v2-structure.svg
+++ b/docs/hugo/content/contributing/aso-v2-structure.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/hugo/content/contributing/asoctl-structure.svg b/docs/hugo/content/contributing/asoctl-structure.svg
index b9c396855d2..9e3d7089ea4 100644
--- a/docs/hugo/content/contributing/asoctl-structure.svg
+++ b/docs/hugo/content/contributing/asoctl-structure.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/v2/internal/duration/duration.go b/v2/internal/duration/duration.go
index eebfd4baac8..b2dc20cc870 100644
--- a/v2/internal/duration/duration.go
+++ b/v2/internal/duration/duration.go
@@ -29,7 +29,7 @@ Duration marshalling
TODO: remove after go v2: https://github.com/golang/go/issues/10275
*/
-func (d ISO8601) MarshalJSON() ([]byte, error) {
+func (d *ISO8601) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, d.String())), nil
}
@@ -55,7 +55,7 @@ func (d *ISO8601) UnmarshalJSON(b []byte) error {
}
}
-func (d ISO8601) String() string {
+func (d *ISO8601) String() string {
if d.Duration == time.Duration(0) {
return "PT0S"
}
diff --git a/v2/internal/genericarmclient/cloud_error.go b/v2/internal/genericarmclient/cloud_error.go
index 21ab790f2a4..a889e317ed7 100644
--- a/v2/internal/genericarmclient/cloud_error.go
+++ b/v2/internal/genericarmclient/cloud_error.go
@@ -47,12 +47,12 @@ func NewTestCloudError(code string, message string) *CloudError {
// Error implements the error interface for type CloudError.
// The contents of the error text are not contractual and subject to change.
-func (e CloudError) Error() string {
+func (e *CloudError) Error() string {
return e.error.Error()
}
// Code returns the error code from the message, if present, or UnknownErrorCode if not.
-func (e CloudError) Code() string {
+func (e *CloudError) Code() string {
if e.code != nil && *e.code != "" {
return *e.code
}
@@ -61,7 +61,7 @@ func (e CloudError) Code() string {
}
// Message returns the message from the error, if present, or UnknownErrorMessage if not.
-func (e CloudError) Message() string {
+func (e *CloudError) Message() string {
if e.message != nil && *e.message != "" {
return *e.message
}
@@ -70,7 +70,7 @@ func (e CloudError) Message() string {
}
// Target returns the target of the error, if present, or an empty string if not.
-func (e CloudError) Target() string {
+func (e *CloudError) Target() string {
if e.target != nil && *e.target != "" {
return *e.target
}
@@ -79,7 +79,7 @@ func (e CloudError) Target() string {
}
// Details returns the details of the error, if present, or an empty slice if not
-func (e CloudError) Details() []*ErrorResponse {
+func (e *CloudError) Details() []*ErrorResponse {
return e.details
}
@@ -117,6 +117,6 @@ func (e *CloudError) UnmarshalJSON(data []byte) error {
return nil
}
-func (e CloudError) Unwrap() error {
+func (e *CloudError) Unwrap() error {
return e.error
}
diff --git a/v2/internal/testcommon/kube_per_test_context.go b/v2/internal/testcommon/kube_per_test_context.go
index 134fd51b53e..a3684ba8c72 100644
--- a/v2/internal/testcommon/kube_per_test_context.go
+++ b/v2/internal/testcommon/kube_per_test_context.go
@@ -55,7 +55,7 @@ type KubePerTestContext struct {
tracker *ResourceTracker
}
-func (tc KubePerTestContext) CreateTestNamespace(namespaceName string) error {
+func (tc *KubePerTestContext) CreateTestNamespace(namespaceName string) error {
ns := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: namespaceName,
@@ -72,22 +72,22 @@ func (tc KubePerTestContext) CreateTestNamespace(namespaceName string) error {
return nil
}
-func (tc KubePerTestContext) createTestNamespace() error {
+func (tc *KubePerTestContext) createTestNamespace() error {
return tc.CreateTestNamespace(tc.Namespace)
}
-func (tc KubePerTestContext) MakeObjectMeta(prefix string) ctrl.ObjectMeta {
+func (tc *KubePerTestContext) MakeObjectMeta(prefix string) ctrl.ObjectMeta {
return tc.MakeObjectMetaWithName(tc.Namer.GenerateName(prefix))
}
-func (tc KubePerTestContext) MakeObjectMetaWithName(name string) ctrl.ObjectMeta {
+func (tc *KubePerTestContext) MakeObjectMetaWithName(name string) ctrl.ObjectMeta {
return ctrl.ObjectMeta{
Name: name,
Namespace: tc.Namespace,
}
}
-func (tc KubePerTestContext) MakeObjectMetaWithNameAndCredentialFrom(name string, credentialFrom string) ctrl.ObjectMeta {
+func (tc *KubePerTestContext) MakeObjectMetaWithNameAndCredentialFrom(name string, credentialFrom string) ctrl.ObjectMeta {
return ctrl.ObjectMeta{
Name: name,
Namespace: tc.Namespace,
@@ -97,7 +97,7 @@ func (tc KubePerTestContext) MakeObjectMetaWithNameAndCredentialFrom(name string
}
}
-func (tc KubePerTestContext) MakeReferenceFromResource(resource client.Object) *genruntime.ResourceReference {
+func (tc *KubePerTestContext) MakeReferenceFromResource(resource client.Object) *genruntime.ResourceReference {
gvk, err := apiutil.GVKForObject(resource, tc.scheme)
if err != nil {
tc.T.Fatal(err)
@@ -110,7 +110,7 @@ func (tc KubePerTestContext) MakeReferenceFromResource(resource client.Object) *
}
}
-func (tc KubePerTestContext) NewTestResourceGroup() *resources.ResourceGroup {
+func (tc *KubePerTestContext) NewTestResourceGroup() *resources.ResourceGroup {
return &resources.ResourceGroup{
ObjectMeta: tc.MakeObjectMeta("rg"),
Spec: resources.ResourceGroup_Spec{
diff --git a/v2/internal/testcommon/test_logger.go b/v2/internal/testcommon/test_logger.go
index e4ab3a380b5..f91d4a04f08 100644
--- a/v2/internal/testcommon/test_logger.go
+++ b/v2/internal/testcommon/test_logger.go
@@ -54,7 +54,7 @@ type TestLogger struct {
ignoredPanicMax int
}
-func (_ TestLogger) Init(info logr.RuntimeInfo) {
+func (_ *TestLogger) Init(info logr.RuntimeInfo) {
}
// kvListFormat was adapted from the klog method of the same name and formats a keysAndValues list into
diff --git a/v2/pkg/genruntime/conditions/conditions.go b/v2/pkg/genruntime/conditions/conditions.go
index 27b2978bcc4..746558305f9 100644
--- a/v2/pkg/genruntime/conditions/conditions.go
+++ b/v2/pkg/genruntime/conditions/conditions.go
@@ -75,6 +75,7 @@ const (
var _ fmt.Stringer = Condition{}
// Condition defines an extension to status (an observation) of a resource
+// nolint:recvcheck
// +kubebuilder:object:generate=true
type Condition struct {
// Type of condition.
@@ -117,7 +118,7 @@ type Condition struct {
// IsEquivalent returns true if this condition is equivalent to the passed in condition.
// Two conditions are equivalent if all of their fields EXCEPT LastTransitionTime are the same.
-func (c Condition) IsEquivalent(other Condition) bool {
+func (c *Condition) IsEquivalent(other Condition) bool {
return c.Type == other.Type &&
c.Status == other.Status &&
c.Severity == other.Severity &&
@@ -127,7 +128,7 @@ func (c Condition) IsEquivalent(other Condition) bool {
}
// ShouldOverwrite determines if this condition should overwrite the other condition.
-func (c Condition) ShouldOverwrite(other Condition) bool {
+func (c *Condition) ShouldOverwrite(other Condition) bool {
// Safety check that the two conditions are of the same type. If not they certainly shouldn't overwrite
if c.Type != other.Type {
return false
@@ -161,7 +162,7 @@ func (c Condition) ShouldOverwrite(other Condition) bool {
//
// Keep in mind that this priority is specifically for comparing Conditions with the same ObservedGeneration. If the ObservedGeneration
// is different, the newer one always wins.
-func (c Condition) priority() int {
+func (c *Condition) priority() int {
switch c.Status {
case metav1.ConditionTrue:
return 5
@@ -188,10 +189,10 @@ func (c Condition) priority() int {
}
// Copy returns an independent copy of the Condition
-func (c Condition) Copy() Condition {
+func (c *Condition) Copy() Condition {
// NB: If you change this to a non-simple copy
// you will need to update genruntime.CloneSliceOfCondition
- return c
+ return *c
}
// String returns a string representation of this condition
diff --git a/v2/pkg/genruntime/configmaps.go b/v2/pkg/genruntime/configmaps.go
index 93f3fb3e6c9..6103b6815eb 100644
--- a/v2/pkg/genruntime/configmaps.go
+++ b/v2/pkg/genruntime/configmaps.go
@@ -13,6 +13,7 @@ import (
// ConfigMapReference is a reference to a Kubernetes configmap and key in the same namespace as
// the resource it is on.
+// nolint:recvcheck
// +kubebuilder:object:generate=true
type ConfigMapReference struct {
// Name is the name of the Kubernetes configmap being referenced.
diff --git a/v2/pkg/genruntime/core/destination_expression.go b/v2/pkg/genruntime/core/destination_expression.go
index 8c1c4cbe79c..55bfab09617 100644
--- a/v2/pkg/genruntime/core/destination_expression.go
+++ b/v2/pkg/genruntime/core/destination_expression.go
@@ -31,6 +31,6 @@ type DestinationExpression struct {
Value string `json:"value,omitempty"`
}
-func (s DestinationExpression) String() string {
+func (s *DestinationExpression) String() string {
return fmt.Sprintf("Name: %q, Key: %q, Value: %q", s.Name, s.Key, s.Value)
}
diff --git a/v2/pkg/genruntime/resource_reference.go b/v2/pkg/genruntime/resource_reference.go
index 364aef1232b..8045c65185f 100644
--- a/v2/pkg/genruntime/resource_reference.go
+++ b/v2/pkg/genruntime/resource_reference.go
@@ -39,7 +39,7 @@ type KnownResourceReference struct {
}
// AsResourceReference transforms this KnownResourceReference into a ResourceReference
-func (ref KnownResourceReference) AsResourceReference(group string, kind string) *ResourceReference {
+func (ref *KnownResourceReference) AsResourceReference(group string, kind string) *ResourceReference {
if ref.Name == "" {
group = ""
kind = ""
@@ -63,7 +63,7 @@ type KubernetesOwnerReference struct {
}
// AsResourceReference transforms this KnownResourceReference into a ResourceReference
-func (ref KubernetesOwnerReference) AsResourceReference(group string, kind string) *ResourceReference {
+func (ref *KubernetesOwnerReference) AsResourceReference(group string, kind string) *ResourceReference {
return &ResourceReference{
Group: group,
Kind: kind,
@@ -90,7 +90,7 @@ type ArbitraryOwnerReference struct {
}
// AsResourceReference transforms this ArbitraryOwnerReference into a ResourceReference
-func (ref ArbitraryOwnerReference) AsResourceReference() *ResourceReference {
+func (ref *ArbitraryOwnerReference) AsResourceReference() *ResourceReference {
return &ResourceReference{
Group: ref.Group,
Kind: ref.Kind,
@@ -102,6 +102,7 @@ func (ref ArbitraryOwnerReference) AsResourceReference() *ResourceReference {
var _ fmt.Stringer = ResourceReference{}
// ResourceReference represents a resource reference, either to a Kubernetes resource or directly to an Azure resource via ARMID
+// nolint:recvcheck
// +kubebuilder:object:generate=true
type ResourceReference struct {
// Group is the Kubernetes group of the resource.
@@ -131,12 +132,12 @@ func CreateResourceReferenceFromARMID(armID string) ResourceReference {
}
// IsDirectARMReference returns true if this ResourceReference is referring to an ARMID directly.
-func (ref ResourceReference) IsDirectARMReference() bool {
+func (ref *ResourceReference) IsDirectARMReference() bool {
return ref.ARMID != "" && ref.Name == "" && ref.Group == "" && ref.Kind == ""
}
// IsKubernetesReference returns true if this ResourceReference is referring to a Kubernetes resource.
-func (ref ResourceReference) IsKubernetesReference() bool {
+func (ref *ResourceReference) IsKubernetesReference() bool {
return ref.ARMID == "" && ref.Name != "" && ref.Group != "" && ref.Kind != ""
}
@@ -155,7 +156,7 @@ func (ref ResourceReference) String() string {
// TODO: We wouldn't need this if controller-gen supported DUs or OneOf better, see: https://github.com/kubernetes-sigs/controller-tools/issues/461
// Validate validates the ResourceReference to ensure that it is structurally valid.
-func (ref ResourceReference) Validate() (admission.Warnings, error) {
+func (ref *ResourceReference) Validate() (admission.Warnings, error) {
if ref.ARMID == "" && ref.Name == "" && ref.Group == "" && ref.Kind == "" {
return nil, eris.Errorf("at least one of ['ARMID'] or ['Group', 'Kind', 'Namespace', 'Name'] must be set for ResourceReference")
}
@@ -172,22 +173,22 @@ func (ref ResourceReference) Validate() (admission.Warnings, error) {
}
// AsNamespacedRef creates a NamespacedResourceReference from this reference.
-func (ref ResourceReference) AsNamespacedRef(namespace string) NamespacedResourceReference {
+func (ref *ResourceReference) AsNamespacedRef(namespace string) NamespacedResourceReference {
// If this is a direct ARM reference, don't append a namespace as it reads weird
if ref.IsDirectARMReference() {
return NamespacedResourceReference{
- ResourceReference: ref,
+ ResourceReference: *ref,
}
}
return NamespacedResourceReference{
- ResourceReference: ref,
+ ResourceReference: *ref,
Namespace: namespace,
}
}
// GroupKind returns the GroupKind of the resource reference
-func (ref ResourceReference) GroupKind() schema.GroupKind {
+func (ref *ResourceReference) GroupKind() schema.GroupKind {
return schema.GroupKind{
Group: ref.Group,
Kind: ref.Kind,
@@ -214,13 +215,13 @@ func LookupOwnerGroupKind(v interface{}) (string, string) {
}
// Copy makes an independent copy of the KnownResourceReference
-func (ref KnownResourceReference) Copy() KnownResourceReference {
- return ref
+func (ref *KnownResourceReference) Copy() KnownResourceReference {
+ return *ref
}
// Copy makes an independent copy of the ArbitraryOwnerReference
-func (ref ArbitraryOwnerReference) Copy() ArbitraryOwnerReference {
- return ref
+func (ref *ArbitraryOwnerReference) Copy() ArbitraryOwnerReference {
+ return *ref
}
// Copy makes an independent copy of the ResourceReference
@@ -229,8 +230,8 @@ func (ref ResourceReference) Copy() ResourceReference {
}
// Copy makes an independent copy of the KubernetesOwnerReference
-func (ref KubernetesOwnerReference) Copy() KubernetesOwnerReference {
- return ref
+func (ref *KubernetesOwnerReference) Copy() KubernetesOwnerReference {
+ return *ref
}
// ValidateResourceReferences calls Validate on each ResourceReference
diff --git a/v2/pkg/genruntime/secrets.go b/v2/pkg/genruntime/secrets.go
index 823309d22a9..69324399f49 100644
--- a/v2/pkg/genruntime/secrets.go
+++ b/v2/pkg/genruntime/secrets.go
@@ -11,6 +11,7 @@ import (
// SecretReference is a reference to a Kubernetes secret and key in the same namespace as
// the resource it is on.
+// nolint:recvcheck
// +kubebuilder:object:generate=true
type SecretReference struct {
// Name is the name of the Kubernetes secret being referenced.
@@ -62,6 +63,7 @@ func (s NamespacedSecretReference) String() string {
// SecretMapReference is a reference to a Kubernetes secret in the same namespace as
// the resource it is on.
+// nolint:recvcheck
// +kubebuilder:object:generate=true
type SecretMapReference struct {
// Name is the name of the Kubernetes secret being referenced.
diff --git a/v2/tools/generator/internal/astmodel/allof_type.go b/v2/tools/generator/internal/astmodel/allof_type.go
index 8d6361b1e9c..d2a0bdc8c76 100644
--- a/v2/tools/generator/internal/astmodel/allof_type.go
+++ b/v2/tools/generator/internal/astmodel/allof_type.go
@@ -92,7 +92,7 @@ func BuildAllOfType(types ...Type) Type {
// Types returns what types the AllOf can be.
// Exposed as ReadonlyTypeSet so caller can't break invariants.
func (allOf *AllOfType) Types() ReadonlyTypeSet {
- return allOf.types
+ return &allOf.types
}
// References returns any type referenced by the AllOf types
diff --git a/v2/tools/generator/internal/astmodel/oneof_type.go b/v2/tools/generator/internal/astmodel/oneof_type.go
index dbc0f8629a5..af4b797f284 100644
--- a/v2/tools/generator/internal/astmodel/oneof_type.go
+++ b/v2/tools/generator/internal/astmodel/oneof_type.go
@@ -115,7 +115,7 @@ func (oneOf *OneOfType) WithTypes(types []Type) *OneOfType {
// Types returns what subtypes the OneOf may be.
// Exposed as ReadonlyTypeSet so caller cannot break invariants.
func (oneOf *OneOfType) Types() ReadonlyTypeSet {
- return oneOf.types
+ return &oneOf.types
}
// PropertyObjects returns all the ObjectTypes that define the properties of this OneOf
diff --git a/v2/tools/generator/internal/astmodel/type_set.go b/v2/tools/generator/internal/astmodel/type_set.go
index 7224ac4fd55..28e7aaad553 100644
--- a/v2/tools/generator/internal/astmodel/type_set.go
+++ b/v2/tools/generator/internal/astmodel/type_set.go
@@ -20,7 +20,7 @@ type ReadonlyTypeSet interface {
AsSlice() []Type
}
-var _ ReadonlyTypeSet = TypeSet{}
+var _ ReadonlyTypeSet = &TypeSet{}
// MakeTypeSet makes a new TypeSet containing the given types
func MakeTypeSet(types ...Type) TypeSet {
@@ -36,7 +36,7 @@ func MakeTypeSet(types ...Type) TypeSet {
// ForEach executes the action for each type in the set
// this works around not having `range` on custom types
-func (ts TypeSet) ForEach(action func(t Type, ix int)) {
+func (ts *TypeSet) ForEach(action func(t Type, ix int)) {
for ix, t := range ts.types {
action(t, ix)
}
@@ -45,7 +45,7 @@ func (ts TypeSet) ForEach(action func(t Type, ix int)) {
// ForEachError executes the action for each type in the set,
// with the possibility to fail. This works around not having
// `range` on custom types.
-func (ts TypeSet) ForEachError(action func(t Type, ix int) error) error {
+func (ts *TypeSet) ForEachError(action func(t Type, ix int) error) error {
for ix, t := range ts.types {
if err := action(t, ix); err != nil {
return err
@@ -80,7 +80,7 @@ func (ts *TypeSet) Remove(t Type) bool {
}
// Contains checks if the set already contains the type
-func (ts TypeSet) Contains(t Type, overrides EqualityOverrides) bool {
+func (ts *TypeSet) Contains(t Type, overrides EqualityOverrides) bool {
// this is slow, but what can you do?
for _, other := range ts.types {
if t.Equals(other, overrides) {
@@ -92,7 +92,7 @@ func (ts TypeSet) Contains(t Type, overrides EqualityOverrides) bool {
}
// Equals returns true if both sets contain the same types
-func (ts TypeSet) Equals(other TypeSet, overrides ...EqualityOverrides) bool {
+func (ts *TypeSet) Equals(other TypeSet, overrides ...EqualityOverrides) bool {
if len(ts.types) != len(other.types) {
return false
}
@@ -116,12 +116,12 @@ func (ts TypeSet) Equals(other TypeSet, overrides ...EqualityOverrides) bool {
}
// Len returns the number of items in the set
-func (ts TypeSet) Len() int {
+func (ts *TypeSet) Len() int {
return len(ts.types)
}
// Single returns the only item in the set, and true, if it contains exactly one; otherwise it returns nil and false.
-func (ts TypeSet) Single() (Type, bool) {
+func (ts *TypeSet) Single() (Type, bool) {
if len(ts.types) != 1 {
return nil, false
}
@@ -130,12 +130,12 @@ func (ts TypeSet) Single() (Type, bool) {
}
// Copy returns a copy of this set that can then be modified.
-func (ts TypeSet) Copy() TypeSet {
+func (ts *TypeSet) Copy() TypeSet {
return MakeTypeSet(ts.types...)
}
// AsSlice returns the content of this set as a slice
-func (ts TypeSet) AsSlice() []Type {
+func (ts *TypeSet) AsSlice() []Type {
result := make([]Type, 0, len(ts.types))
result = append(result, ts.types...)
return result
diff --git a/v2/tools/generator/internal/astmodel/validated_type.go b/v2/tools/generator/internal/astmodel/validated_type.go
index b26fb2247a2..197fd9d61df 100644
--- a/v2/tools/generator/internal/astmodel/validated_type.go
+++ b/v2/tools/generator/internal/astmodel/validated_type.go
@@ -243,14 +243,14 @@ func equalRegexpSlices(left []*regexp.Regexp, right []*regexp.Regexp) bool {
}
// Unwrap returns the type contained within the validated type
-func (v ValidatedType) Unwrap() Type {
+func (v *ValidatedType) Unwrap() Type {
return v.element
}
// WriteDebugDescription adds a description of the current type to the passed builder
// builder receives the full description, including nested types
// definitions is a dictionary for resolving named types
-func (v ValidatedType) WriteDebugDescription(builder *strings.Builder, currentPackage InternalPackageReference) {
+func (v *ValidatedType) WriteDebugDescription(builder *strings.Builder, currentPackage InternalPackageReference) {
builder.WriteString("Validated[")
if v.element != nil {
v.element.WriteDebugDescription(builder, currentPackage)