mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-10 14:34:58 +09:00
Run go fix over every first-party module: interface{} becomes any,
hand-written loops become slices, maps, min/max and range-over-int,
errors.As becomes errors.AsType, pointer helpers become new(expr) and
are inlined at their call sites, and so on. Every rewrite keeps
behaviour.
Three rewrites stay out. embedlit flattens embedded-field literals
such as ObjectMeta, syntax only Go 1.27 accepts, which would break
backports to release branches still on Go 1.26. omitzero drops
omitempty from struct fields, and openapi-gen reads omitempty as
optional, so metadata, spec and status would turn required in the
published schemas. And errorsastype rewrote an errors.As whose
target, apierrors.APIStatus, does not implement error, which
errors.AsType rejects at compile time.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
/*
|
|
Copyright 2024 The Cozystack Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package fuzzer
|
|
|
|
import (
|
|
"github.com/cozystack/cozystack/pkg/apis/core/v1alpha1"
|
|
|
|
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
|
"sigs.k8s.io/randfill"
|
|
)
|
|
|
|
// Funcs returns the fuzzer functions for the core api group.
|
|
var Funcs = func(codecs runtimeserializer.CodecFactory) []any {
|
|
return []any{
|
|
func(s *v1alpha1.TenantNamespace, c randfill.Continue) {
|
|
c.FillNoCustom(s) // fill self without calling this function again
|
|
},
|
|
func(s *v1alpha1.Option, c randfill.Continue) {
|
|
c.FillNoCustom(s) // fill self without calling this function again
|
|
},
|
|
func(s *v1alpha1.Tap, c randfill.Continue) {
|
|
c.FillNoCustom(s) // fill self without calling this function again
|
|
},
|
|
}
|
|
}
|