* Allow GeneratingHandlers to skip Apply if resource version didn't change
* Run go generate
* Add call count to FakeApply
* Add test for UniqueApplyForResourceVersion
* Simplify error handling
Co-authored-by: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com>
* Make generated code more readable
Co-authored-by: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com>
* Rename constant
* Rename seenResourceVersion to storeResourceVersion
* go generate
* Add comments to code generator
* Run go generate
* Upgrade golangci-lint GitHub action, since it always fails now
---------
Co-authored-by: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com>
Add the ability to use an index number to get an item out of a slice.
The number will still be a string representation of an integer. For
example, to get the last element from a nested slice like:
```
data := map[string]interface{}{
"data": []interface{}{
"first",
"second",
"third",
},
}
```
Use keys like
```
val := GetValues(data, "data", "2")
```
The Generated Client, Controller, and Cache interfaces are now entirely
implemented by the generic Interfaces. These changes greatly reduce the
amount of generated code needed and allows users to use the mocks
directly with controllers without having to wrap them as an embedded
object.
* The func will crash with a runtime error for count <= 5.
* If count is 6, the result will have a leading dash.
* If len(string) == count, it will not return the original string, instead
it appends a hash.
To support easy mocking generic interfaces were added for controllers and caches.
And generated code now uses these interfaces instead of the generic structure.
This commit also adds code comments to the generated interfaces, and a README for the fake package.
Moved Controler and Cache implmentations from template strings in ype_go.go
to generic/controller.go and generic/cache.go. The generation
of type specific interface was left so that dependent packages do not
experince any breaking changes.
Removes unused member variables
`InformersPackage` `ClientsPackage` & `ListersPackage` from pkg/args.Group.
These variables were previously used to create import statements in our generated code.
Though the refactor in #85 made the variables obsolete.
Removes the generated function DeepCopy<type>OnChange.
This function is unused by our rancher products and does not work as initially intended.
This function's original intent was to be a helper function that creates
a Handler that modifies a copy of the provided object and then
updates the object if the modification produces a change.
This function was modified in 2044a7b2bb
so that it no longer returns a handler.