Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

run:
deadline: 5m
go: '1.22'
go: "1.24"

linters:
enable-all: true
Expand Down Expand Up @@ -42,6 +42,11 @@ linters:
- varcheck # abandoned by author
- maligned # abandoned by author
- interfacer # archived by author
# TODO(koba1t): temporarily disabled, will be addressed after upgrading to Go 1.24
- usetesting
- mnd
- copyloopvar
- intrange

linters-settings:
dupl:
Expand All @@ -52,14 +57,14 @@ linters-settings:
min-complexity: 30
revive:
rules:
- name: var-naming
arguments:
- [ "ID", "API", "JSON" ] # AllowList
- [ ] # DenyList
- name: var-naming
arguments:
- ["ID", "API", "JSON"] # AllowList
- [] # DenyList
gomnd:
ignored-functions:
- os.WriteFile
- make
- os.WriteFile
- make
gomoddirectives:
replace-local: true
gosec:
Expand Down
6 changes: 4 additions & 2 deletions Makefile-plugins.mk
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,17 @@ generate-kustomize-builtin-plugins: $(builtplugins)
go generate .; \
done

# Check for diff by comparing current revision of generated plugins on HEAD and newly generated plugins on local branch,
# Check for diff by comparing current revision of generated plugins on HEAD and newly generated plugins on local branch,
# If diff is found, throw error code 1
.PHONY: builtin-plugins-diff
builtin-plugins-diff: $(builtplugins)
for file in $(abspath $(builtinplugins)); do \
echo "Checking for diff... $${file}" ; \
set -e ; \
if [ "`git diff $${file} | wc -c`" -gt 0 ]; then\
echo "Error(1): diff found on $${file}"; exit 1; \
echo "Error(1): diff found on $${file}"; \
git diff $${file};\
exit 1;\
fi \
done

Expand Down
6 changes: 2 additions & 4 deletions api/filters/nameref/nameref.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,14 @@ func getRoleRefGvk(n *resource.Resource) (*resid.Gvk, error) {
return nil, err
}
if apiGroup.IsNil() {
return nil, fmt.Errorf(
"apiGroup cannot be found in roleRef %s", roleRef.MustString())
return nil, fmt.Errorf("apiGroup cannot be found in roleRef %s", roleRef.MustString())
}
kind, err := roleRef.Pipe(yaml.Lookup("kind"))
if err != nil {
return nil, err
}
if kind.IsNil() {
return nil, fmt.Errorf(
"kind cannot be found in roleRef %s", roleRef.MustString())
return nil, fmt.Errorf("kind cannot be found in roleRef %s", roleRef.MustString())
}
return &resid.Gvk{
Group: apiGroup.YNode().Value,
Expand Down
6 changes: 3 additions & 3 deletions api/filters/replacement/replacement.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ func copyValueToTarget(target *yaml.RNode, value *yaml.RNode, selector *types.Ta
Path: kyaml_utils.SmarterPathSplitter(fp, "."),
Create: createKind})
if err != nil {
return errors.WrapPrefixf(err, fieldRetrievalError(fp, createKind != 0)) //nolint:govet
return errors.WrapPrefixf(err, "%s", fieldRetrievalError(fp, createKind != 0))
}
targetFields, err := targetFieldList.Elements()
if err != nil {
return errors.WrapPrefixf(err, fieldRetrievalError(fp, createKind != 0)) //nolint:govet
return errors.WrapPrefixf(err, "%s", fieldRetrievalError(fp, createKind != 0))
}
if len(targetFields) == 0 {
return errors.Errorf(fieldRetrievalError(fp, createKind != 0)) //nolint:govet
return errors.Errorf("%s", fieldRetrievalError(fp, createKind != 0))
}

for _, t := range targetFields {
Expand Down
6 changes: 3 additions & 3 deletions api/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kustomize/api

go 1.22.7
go 1.24.0

require (
github.com/blang/semver/v4 v4.0.0
Expand Down Expand Up @@ -28,8 +28,8 @@ require (
github.com/sergi/go-diff v1.2.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.yaml.in/yaml/v3 v3.0.3 // indirect
golang.org/x/sys v0.29.0 // indirect
google.golang.org/protobuf v1.36.1 // indirect
golang.org/x/sys v0.35.0 // indirect
google.golang.org/protobuf v1.36.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
16 changes: 8 additions & 8 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+Gr
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand All @@ -38,8 +38,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -62,10 +62,10 @@ go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE=
go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
Expand Down
2 changes: 0 additions & 2 deletions api/internal/builtins/AnnotationsTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/ConfigMapGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/HashTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions api/internal/builtins/HelmChartInflationGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/IAMPolicyGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/ImageTagTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/LabelTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/NamespaceTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/PatchJson6902Transformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/PatchStrategicMergeTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/PatchTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/PrefixTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/ReplacementTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/ReplicaCountTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/SecretGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/SortOrderTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/SuffixTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/internal/builtins/ValueAddTransformer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/internal/git/repospec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ func TestNewRepoSpecFromUrl_Smoke(t *testing.T) {
rs.Dir = ""
rs.Submodules = false
rs.Timeout = 0
assert.Equal(t, &tc.repoSpec, rs) //nolint:gosec
assert.Equal(t, &tc.repoSpec, rs)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/internal/loader/fileloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (fl *FileLoader) New(path string) (ifc.Loader, error) {
}
root, err := filesys.ConfirmDir(fl.fSys, fl.root.Join(path))
if err != nil {
return nil, errors.WrapPrefixf(err, ErrRtNotDir.Error()) //nolint:govet
return nil, errors.WrapPrefixf(err, "%s", ErrRtNotDir.Error())
}
if err = fl.errIfGitContainmentViolation(root); err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion api/internal/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewLoader(
}
root, err := filesys.ConfirmDir(fSys, target)
if err != nil {
return nil, errors.WrapPrefixf(err, ErrRtNotDir.Error()) //nolint:govet
return nil, errors.WrapPrefixf(err, "%s", ErrRtNotDir.Error())
}
return newLoaderAtConfirmedDir(
lr, root, fSys, nil, git.ClonerUsingGitExec), nil
Expand Down
10 changes: 4 additions & 6 deletions api/internal/plugins/execplugin/execplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,13 @@ func (p *ExecPlugin) invokePlugin(input []byte) ([]byte, error) {
_, err = f.Write(p.cfg)
if err != nil {
return nil, errors.WrapPrefixf(
err, "writing plugin config to "+f.Name())
err, "%s", "writing plugin config to "+f.Name())
}
err = f.Close()
if err != nil {
return nil, errors.WrapPrefixf(
err, "closing plugin config file "+f.Name())
err, "%s", "closing plugin config file "+f.Name())
}
//nolint:gosec
cmd := exec.Command(
p.path, append([]string{f.Name()}, p.args...)...)
cmd.Env = p.getEnv()
Expand All @@ -180,10 +179,9 @@ func (p *ExecPlugin) invokePlugin(input []byte) ([]byte, error) {
}
result, err := cmd.Output()
if err != nil {
//nolint:govet
return nil, errors.WrapPrefixf(
fmt.Errorf("failure in plugin configured via %s; %w",
f.Name(), err), stdErr.String())
fmt.Errorf("failure in plugin configured via %s; %w", f.Name(), err),
"%s", stdErr.String())
}
return result, os.Remove(f.Name())
}
Expand Down
1 change: 0 additions & 1 deletion api/internal/plugins/loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
)

const (
//nolint:gosec
secretGenerator = `
apiVersion: builtin
kind: SecretGenerator
Expand Down
1 change: 0 additions & 1 deletion api/krusty/namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ resources:
th.AssertActualEqualsExpected(m, namespaceNeedInVarExpectedOutput)
}

//nolint:gosec
const namespaceNeedInVarMyAppWithNamespace string = `
resources:
- elasticsearch-dev-service.yaml
Expand Down
1 change: 0 additions & 1 deletion api/resource/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func createTestConfigMap() (*Resource, error) {
return res, nil
}

//nolint:gosec
const configMapAsString = `{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"winnie","namespace":"hundred-acre-wood"}}`

func createTestDeployment() (*Resource, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/docs/api-conventions/functions-impl.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ End-of-message
image.

```
FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye
FROM public.ecr.aws/docker/library/golang:1.24.6-bullseye
RUN go get sigs.k8s.io/kustomize/cmd/config
RUN mv /go/bin/config /usr/bin/config
COPY nginx-template.sh /usr/bin/nginx-template.sh
Expand Down
Loading
Loading