Nic Cope
0c7b1eb549
Bump golangci-lint, copy config from c/c
...
This copies the latest config from c/c and addresses all the linter
errors that config produces.
Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-02-20 03:45:27 -08:00
Sergen Yalçın
195a02da31
Change the error message with a more consistent with the other errors
...
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
2024-02-13 16:01:25 +03:00
Sergen Yalçın
b1cd25a73b
Change the error message
...
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
2024-02-07 11:18:55 +03:00
Sergen Yalçın
5cd11c97cb
Add a nil case to the getValueFromInterface function
...
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
2024-02-06 19:32:18 +03:00
Sergen Yalçın
4e24aae89d
- Used %q in the error message
...
- Added a unit-test case
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
2023-12-12 15:00:40 +03:00
Sergen Yalçın
cac4c15ef3
Add a nil case to the expandWildcards function
...
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
2023-12-12 13:09:14 +03:00
Hasan Turken
11e9468944
Cleanup deprecated stuff that are no longer used
...
Signed-off-by: Hasan Turken <turkenh@gmail.com>
2023-08-11 13:02:54 +03:00
Philippe Scorsolini
0aac4ba546
fix: properly validate max index
...
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
2023-03-08 16:10:26 +01:00
Philippe Scorsolini
7560fbc041
fix: enforce max index value for paths
...
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
2023-03-08 14:41:11 +01:00
Nic Cope
f0fcbc0af5
Update linter config to match c/c
...
This repo is a little out of date relative to our latest linting
practices.
Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-01-25 10:32:46 -08:00
Muvaffak Onus
ba9d8c29a7
fieldpath: DeleteField should be no-op if it cannot reach the node and it should be able to delete a top-level field
...
Signed-off-by: Muvaffak Onus <me@muvaf.com>
2022-08-05 19:39:20 +03:00
Muvaffak Onus
d950363569
fieldpath: add DeleteField function to delete elements from Paved
...
Signed-off-by: Muvaffak Onus <me@muvaf.com>
2022-08-05 14:29:14 +03:00
Aditya Sharma
cd68866501
Fix lints
...
Signed-off-by: Aditya Sharma <git@adi.run>
2022-07-21 22:01:32 -07:00
Aditya Sharma
1deb753676
s/interface{}/any/g
...
Signed-off-by: Aditya Sharma <git@adi.run>
2022-07-21 21:46:18 -07:00
Hasan Turken
47bff13a91
Proper printing for wildcards
...
Signed-off-by: Hasan Turken <turkenh@gmail.com>
2021-10-04 15:46:39 +03:00
Hasan Turken
77b66f3d77
Add unit tests for paved.ExpandWildcards
...
Signed-off-by: Hasan Turken <turkenh@gmail.com>
2021-10-04 15:11:37 +03:00
Hasan Turken
aefd94be9f
Add expand wildcards to Paved
...
Signed-off-by: Hasan Turken <turkenh@gmail.com>
2021-10-03 23:07:28 +03:00
Nic Cope
af4e148a11
Replace github.com/pkg/errors with our own pkg/errors.
...
Signed-off-by: Nic Cope <negz@rk0n.org>
2021-09-09 07:50:57 +00:00
Alper Rifat Ulucinar
4d6ec580be
Do not append duplicate slice elements when MergeOptions.AppendSlice is set
...
- Move resource.WithMergeOptions to core Crossplane and unexport
- Move fieldpath.object functions to core Crossplane and unexport
- Move fieldpath.MergeValue & related functions to its own file
- Add tests for fieldpath.MergeValue
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
2021-08-04 21:38:43 +03:00
Alper Rifat Ulucinar
e7b4a22e42
Add Paved.MargeValue method
...
- Add "fieldpath/object" package that deals with runtime.Objects
- Move MergeOptions struct to package "apis/common/v1".
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
2021-08-02 14:19:03 +03:00
Muvaffak Onus
c714c6dceb
fieldpath: update unit tests to use the same json marshal/unmarshaller as apimachinery
...
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-09-14 21:08:51 +03:00
Muvaffak Onus
9c0d784174
fieldpath: add GetInteger to retrieve int64 number
...
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-09-10 18:31:51 +03:00
Nic Cope
bd09d0c8f4
Make it possible to distinguish fieldpath.IsNotFound errors
...
https://github.com/crossplane/crossplane/issues/1455
See the above issue for a use case; this will allow the composition patching
functionality to ignore this error.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-28 21:36:06 -07:00
Nic Cope
ae9aa170fc
Add a fieldpath.PaveObject convenience method
...
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-21 23:15:04 -07:00
Nic Cope
90d2786f90
Add a test for GetValueInto
...
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-20 21:29:10 -07:00
Muvaffak Onus
4a7ece2ff5
Add composition interfaces and unstructured composition structs.
...
Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
2020-04-21 03:11:24 +03:00
Nic Cope
b33c53e6d5
Round-trip paved values through JSON serialisation before setting them
...
Paved objects expect their internal unstructured content to be of the types
produced by json.Unmarshal. This allows us to enforce that for any call to
p.SetValue("some.path", T) where T is any JSON serialisable type.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-03-02 22:03:54 -08:00
Nic Cope
ca61a42964
Add getters and setters for unstructured content
...
This helps convert a *fieldpath.Paved to and from an *unstructured.Unstructured.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-02-26 21:05:37 -08:00
Nic Cope
f67177024d
Add a package for getting and setting unstructured fields by path
...
https://github.com/kubernetes-sigs/kustomize/blob/d190e1/api/k8sdeps/kunstruct/helper.go
https://github.com/kubernetes/apimachinery/blob/2373d0/pkg/apis/meta/v1/unstructured/helpers.go
This package is similar to the above two, with some key differences:
* Our fieldpath lexer is a little stricter; it won't allow dangling open braces,
unexpected periods, or empty brackets. It also supplies the position of any
syntax error if lexing fails.
* We support setting and getting fields within a pkg/json unmarshalled object by
fieldpath. Other packages support only getting fields, or only setting fields
in paths that do not contain any array indexes.
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-02-25 12:56:34 -08:00