Commit Graph

21 Commits

Author SHA1 Message Date
Nic Cope 678177c524 Run golangci-lint run --fix
This commit is entirely generated by earthly +reviewable

Signed-off-by: Nic Cope <nicc@rk0n.org>
2025-07-03 12:51:13 -07:00
Jared Watts 8e6ab168b4
chore(lint): bump go/golangci-lint versions and fix all linter errors
This commit bumps the golang version to the same used currently in
core crossplane (1.23.7) and then uses the latest 1.x version of
golangci-lint. Previous versions of golangci-lint are tough to use
because of recvcheck not supporting exclusions until its v0.2.0 release.

This commit shares some similar fixes as seen in https://github.com/crossplane/crossplane/pull/6111

Signed-off-by: Jared Watts <jbw976@gmail.com>
2025-05-13 18:22:15 +01:00
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
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
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 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
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
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
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 90d2786f90 Add a test for GetValueInto
Signed-off-by: Nic Cope <negz@rk0n.org>
2020-04-20 21:29:10 -07: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 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