mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-02-21 22:57:15 +00:00
Bump gengo
This commit is contained in:
2
go.mod
2
go.mod
@@ -215,7 +215,7 @@ require (
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/kustomize/api v0.20.1 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@@ -476,8 +476,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 h1:I8k0vOOD2ZQWs3PtYXC0mjJdlIMriS0O/N+RjSkWB48=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
@@ -121,7 +121,7 @@ require (
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 // indirect
|
||||
k8s.io/kms v0.0.0 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
|
||||
)
|
||||
|
||||
@@ -328,8 +328,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 h1:I8k0vOOD2ZQWs3PtYXC0mjJdlIMriS0O/N+RjSkWB48=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
@@ -14,7 +14,7 @@ require (
|
||||
go.yaml.in/yaml/v2 v2.4.2
|
||||
golang.org/x/text v0.25.0
|
||||
k8s.io/apimachinery v0.0.0
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4
|
||||
k8s.io/klog/v2 v2.130.1
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b
|
||||
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
|
||||
|
||||
4
staging/src/k8s.io/code-generator/go.sum
generated
4
staging/src/k8s.io/code-generator/go.sum
generated
@@ -137,8 +137,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 h1:I8k0vOOD2ZQWs3PtYXC0mjJdlIMriS0O/N+RjSkWB48=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
@@ -106,7 +106,7 @@ require (
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 // indirect
|
||||
k8s.io/kms v0.0.0 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
|
||||
4
staging/src/k8s.io/kube-aggregator/go.sum
generated
4
staging/src/k8s.io/kube-aggregator/go.sum
generated
@@ -307,8 +307,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 h1:I8k0vOOD2ZQWs3PtYXC0mjJdlIMriS0O/N+RjSkWB48=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
2
staging/src/k8s.io/kubectl/go.sum
generated
2
staging/src/k8s.io/kubectl/go.sum
generated
@@ -233,7 +233,7 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
@@ -50,7 +50,7 @@ require (
|
||||
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
|
||||
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
|
||||
|
||||
4
staging/src/k8s.io/metrics/go.sum
generated
4
staging/src/k8s.io/metrics/go.sum
generated
@@ -150,8 +150,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 h1:I8k0vOOD2ZQWs3PtYXC0mjJdlIMriS0O/N+RjSkWB48=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
@@ -102,7 +102,7 @@ require (
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.0.0 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kms v0.0.0 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
|
||||
|
||||
4
staging/src/k8s.io/sample-apiserver/go.sum
generated
4
staging/src/k8s.io/sample-apiserver/go.sum
generated
@@ -304,8 +304,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 h1:I8k0vOOD2ZQWs3PtYXC0mjJdlIMriS0O/N+RjSkWB48=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
@@ -51,7 +51,7 @@ require (
|
||||
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
|
||||
4
staging/src/k8s.io/sample-controller/go.sum
generated
4
staging/src/k8s.io/sample-controller/go.sum
generated
@@ -151,8 +151,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
|
||||
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4 h1:I8k0vOOD2ZQWs3PtYXC0mjJdlIMriS0O/N+RjSkWB48=
|
||||
k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM=
|
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
|
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
|
||||
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
|
||||
|
||||
2
vendor/k8s.io/gengo/v2/Makefile
generated
vendored
2
vendor/k8s.io/gengo/v2/Makefile
generated
vendored
@@ -11,4 +11,4 @@ test:
|
||||
verify:
|
||||
GODEBUG=gotypesalias=0 ./hack/verify-examples.sh
|
||||
GODEBUG=gotypesalias=1 ./hack/verify-examples.sh
|
||||
./hack/verify-go-directive.sh 1.20
|
||||
./hack/verify-go-directive.sh 1.23
|
||||
|
||||
39
vendor/k8s.io/gengo/v2/generator/execute.go
generated
vendored
39
vendor/k8s.io/gengo/v2/generator/execute.go
generated
vendored
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -114,19 +115,53 @@ func assembleGoFile(w io.Writer, f *File) {
|
||||
w.Write(f.Body.Bytes())
|
||||
}
|
||||
|
||||
func formatCode(src []byte) ([]byte, error) {
|
||||
// We call goimports because it formats imports better than gofmt, but also
|
||||
// call gofmt because it has the "simplify" logic. If a gofmt binary is
|
||||
// not found, we will skip it.
|
||||
src, err := importsWrapper(src)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gofmtWrapper(src)
|
||||
}
|
||||
|
||||
func importsWrapper(src []byte) ([]byte, error) {
|
||||
opt := imports.Options{
|
||||
Comments: true,
|
||||
TabIndent: true,
|
||||
TabWidth: 8,
|
||||
FormatOnly: true, // Disable the insertion and deletion of imports
|
||||
FormatOnly: true, // Disable the insertion and deletion of imports (slow!)
|
||||
}
|
||||
return imports.Process("", src, &opt)
|
||||
}
|
||||
|
||||
func gofmtWrapper(src []byte) ([]byte, error) {
|
||||
const gofmt = "gofmt"
|
||||
|
||||
if _, err := exec.LookPath(gofmt); err != nil {
|
||||
klog.Errorf("WARNING: skipping output simplification: %v", err)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
cmd := exec.Command(gofmt, "-s")
|
||||
cmd.Stdin = bytes.NewReader(src)
|
||||
stdout := &bytes.Buffer{}
|
||||
cmd.Stdout = stdout
|
||||
stderr := &bytes.Buffer{}
|
||||
cmd.Stderr = stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
if stderr.Len() > 0 {
|
||||
return nil, fmt.Errorf("%s failed: %v: %s", gofmt, err, strings.TrimSpace(stderr.String()))
|
||||
}
|
||||
return nil, fmt.Errorf("%s failed: %v", gofmt, err)
|
||||
}
|
||||
return stdout.Bytes(), nil
|
||||
}
|
||||
|
||||
func NewGoFile() *DefaultFileType {
|
||||
return &DefaultFileType{
|
||||
Format: importsWrapper,
|
||||
Format: formatCode,
|
||||
Assemble: assembleGoFile,
|
||||
}
|
||||
}
|
||||
|
||||
4
vendor/k8s.io/gengo/v2/generator/import_tracker.go
generated
vendored
4
vendor/k8s.io/gengo/v2/generator/import_tracker.go
generated
vendored
@@ -61,13 +61,13 @@ func goTrackerLocalName(tracker namer.ImportTracker, localPkg string, t types.Na
|
||||
path := t.Package
|
||||
|
||||
// Using backslashes in package names causes gengo to produce Go code which
|
||||
// will not compile with the gc compiler. See the comment on GoSeperator.
|
||||
// will not compile with the gc compiler. See the comment on GoSeparator.
|
||||
if strings.ContainsRune(path, '\\') {
|
||||
klog.Warningf("Warning: backslash used in import path '%v', this is unsupported.\n", path)
|
||||
}
|
||||
localLeaf := filepath.Base(localPkg)
|
||||
|
||||
dirs := strings.Split(path, namer.GoSeperator)
|
||||
dirs := strings.Split(path, namer.GoSeparator)
|
||||
for n := len(dirs) - 1; n >= 0; n-- {
|
||||
// follow kube convention of not having anything between directory names
|
||||
name := strings.Join(dirs[n:], "")
|
||||
|
||||
9
vendor/k8s.io/gengo/v2/namer/namer.go
generated
vendored
9
vendor/k8s.io/gengo/v2/namer/namer.go
generated
vendored
@@ -26,14 +26,17 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// GoSeperator is used to split go import paths.
|
||||
// GoSeparator is used to split go import paths.
|
||||
// Forward slash is used instead of filepath.Seperator because it is the
|
||||
// only universally-accepted path delimiter and the only delimiter not
|
||||
// potentially forbidden by Go compilers. (In particular gc does not allow
|
||||
// the use of backslashes in import paths.)
|
||||
// See https://golang.org/ref/spec#Import_declarations.
|
||||
// See also https://github.com/kubernetes/gengo/issues/83#issuecomment-367040772.
|
||||
GoSeperator = "/"
|
||||
GoSeparator = "/"
|
||||
// GoSeperator is a typo for GoSeparator.
|
||||
// Deprecated: use GoSeparator instead.
|
||||
GoSeperator = GoSeparator
|
||||
)
|
||||
|
||||
// Returns whether a name is a private Go name.
|
||||
@@ -200,7 +203,7 @@ var (
|
||||
|
||||
// filters out unwanted directory names and sanitizes remaining names.
|
||||
func (ns *NameStrategy) filterDirs(path string) []string {
|
||||
allDirs := strings.Split(path, GoSeperator)
|
||||
allDirs := strings.Split(path, GoSeparator)
|
||||
dirs := make([]string, 0, len(allDirs))
|
||||
for _, p := range allDirs {
|
||||
if ns.IgnoreWords == nil || !ns.IgnoreWords[p] {
|
||||
|
||||
123
vendor/k8s.io/gengo/v2/parser/parse.go
generated
vendored
123
vendor/k8s.io/gengo/v2/parser/parse.go
generated
vendored
@@ -23,7 +23,10 @@ import (
|
||||
"go/constant"
|
||||
"go/token"
|
||||
gotypes "go/types"
|
||||
"maps"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -382,11 +385,117 @@ func (p *Parser) NewUniverse() (types.Universe, error) {
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// minimize returns a copy of lines with "irrelevant" lines removed. This
|
||||
// includes blank lines and paragraphs starting with "Deprecated:".
|
||||
func minimize(lines []string) []string {
|
||||
out := make([]string, 0, len(lines))
|
||||
inDeprecated := false // paragraph tracking
|
||||
prevWasBlank := false
|
||||
for _, line := range lines {
|
||||
if len(strings.TrimSpace(line)) == 0 {
|
||||
prevWasBlank = true
|
||||
inDeprecated = false
|
||||
continue
|
||||
}
|
||||
if inDeprecated {
|
||||
continue
|
||||
}
|
||||
if prevWasBlank && strings.HasPrefix(strings.TrimSpace(line), "Deprecated:") {
|
||||
prevWasBlank = false
|
||||
inDeprecated = true
|
||||
continue
|
||||
}
|
||||
prevWasBlank = false
|
||||
out = append(out, line)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// addCommentsToType takes any accumulated comment lines prior to obj and
|
||||
// attaches them to the type t.
|
||||
func (p *Parser) addCommentsToType(obj gotypes.Object, t *types.Type) {
|
||||
t.CommentLines = p.docComment(obj.Pos())
|
||||
t.SecondClosestCommentLines = p.priorDetachedComment(obj.Pos())
|
||||
if newLines, oldLines := p.docComment(obj.Pos()), t.CommentLines; len(newLines) > 0 {
|
||||
switch {
|
||||
case reflect.DeepEqual(oldLines, newLines):
|
||||
// nothing needed
|
||||
|
||||
case len(oldLines) == 0:
|
||||
// no comments associated, or comments match exactly
|
||||
t.CommentLines = newLines
|
||||
|
||||
case isTypeAlias(obj.Type()):
|
||||
// Ignore mismatched comments from obj because it's an alias.
|
||||
// This can only be hit if gotypesalias is enabled.
|
||||
if !reflect.DeepEqual(minimize(oldLines), minimize(newLines)) {
|
||||
klog.Warningf(
|
||||
"Mismatched comments on type %v.\n Using comments:\n%s\n Ignoring comments from type alias:\n%s\n",
|
||||
t.GoType,
|
||||
formatCommentBlock(oldLines),
|
||||
formatCommentBlock(newLines),
|
||||
)
|
||||
}
|
||||
|
||||
case !isTypeAlias(obj.Type()):
|
||||
// Overwrite existing comments with ones from obj because obj is not an alias.
|
||||
// If gotypesalias is enabled, this should mean we found the "real"
|
||||
// type, not an alias. If gotypesalias is disabled, we can end up
|
||||
// overwriting the "real" comments with an alias's comments, but
|
||||
// it is not clear if we can assume which one is the "real" one.
|
||||
t.CommentLines = newLines
|
||||
if !reflect.DeepEqual(minimize(oldLines), minimize(newLines)) {
|
||||
klog.Warningf(
|
||||
"Mismatched comments on type %v.\n Using comments:\n%s\n Ignoring comments from possible type alias:\n%s\n",
|
||||
t.GoType,
|
||||
formatCommentBlock(newLines),
|
||||
formatCommentBlock(oldLines),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if newLines, oldLines := p.priorDetachedComment(obj.Pos()), t.SecondClosestCommentLines; len(newLines) > 0 {
|
||||
switch {
|
||||
case reflect.DeepEqual(oldLines, newLines):
|
||||
// nothing needed
|
||||
|
||||
case len(oldLines) == 0:
|
||||
// no comments associated, or comments match exactly
|
||||
t.SecondClosestCommentLines = newLines
|
||||
|
||||
case isTypeAlias(obj.Type()):
|
||||
// Ignore mismatched comments from obj because it's an alias.
|
||||
// This can only be hit if gotypesalias is enabled.
|
||||
if !reflect.DeepEqual(minimize(oldLines), minimize(newLines)) {
|
||||
// ignore mismatched comments from obj because it's an alias
|
||||
klog.Warningf(
|
||||
"Mismatched secondClosestCommentLines on type %v.\n Using comments:\n%s\n Ignoring comments from type alias:\n%s\n",
|
||||
t.GoType,
|
||||
formatCommentBlock(oldLines),
|
||||
formatCommentBlock(newLines),
|
||||
)
|
||||
}
|
||||
|
||||
case !isTypeAlias(obj.Type()):
|
||||
// Overwrite existing comments with ones from obj because obj is not an alias.
|
||||
// If gotypesalias is enabled, this should mean we found the "real"
|
||||
// type, not an alias. If gotypesalias is disabled, we can end up
|
||||
// overwriting the "real" comments with an alias's comments, but
|
||||
// it is not clear if we can assume which one is the "real" one.
|
||||
t.SecondClosestCommentLines = newLines
|
||||
if !reflect.DeepEqual(minimize(oldLines), minimize(newLines)) {
|
||||
klog.Warningf(
|
||||
"Mismatched secondClosestCommentLines on type %v.\n Using comments:\n%s\n Ignoring comments from possible type alias:\n%s\n",
|
||||
t.GoType,
|
||||
formatCommentBlock(newLines),
|
||||
formatCommentBlock(oldLines),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func formatCommentBlock(lines []string) string {
|
||||
return " ```\n " + strings.Join(lines, "\n ") + "\n ```"
|
||||
}
|
||||
|
||||
// packageDir tries to figure out the directory of the specified package.
|
||||
@@ -510,7 +619,9 @@ func (p *Parser) addPkgToUniverse(pkg *packages.Package, u *types.Universe) erro
|
||||
|
||||
// Add all of this package's imports.
|
||||
importedPkgs := []string{}
|
||||
for _, imp := range pkg.Imports {
|
||||
// Iterate imports in a predictable order
|
||||
for _, key := range slices.Sorted(maps.Keys(pkg.Imports)) {
|
||||
imp := pkg.Imports[key]
|
||||
if err := p.addPkgToUniverse(imp, u); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -557,7 +668,11 @@ func (p *Parser) priorCommentLines(pos token.Pos, lines int) *ast.CommentGroup {
|
||||
}
|
||||
|
||||
func splitLines(str string) []string {
|
||||
return strings.Split(strings.TrimRight(str, "\n"), "\n")
|
||||
lines := strings.Split(strings.TrimRight(str, "\n"), "\n")
|
||||
if len(lines) == 1 && lines[0] == "" {
|
||||
return nil
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
func goFuncNameToName(in string) types.Name {
|
||||
|
||||
5
vendor/k8s.io/gengo/v2/parser/parse_122.go
generated
vendored
5
vendor/k8s.io/gengo/v2/parser/parse_122.go
generated
vendored
@@ -31,3 +31,8 @@ func (p *Parser) walkAliasType(u types.Universe, in gotypes.Type) *types.Type {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isTypeAlias(in gotypes.Type) bool {
|
||||
_, isAlias := in.(*gotypes.Alias)
|
||||
return isAlias
|
||||
}
|
||||
|
||||
4
vendor/k8s.io/gengo/v2/parser/parse_pre_122.go
generated
vendored
4
vendor/k8s.io/gengo/v2/parser/parse_pre_122.go
generated
vendored
@@ -28,3 +28,7 @@ import (
|
||||
func (p *Parser) walkAliasType(u types.Universe, in gotypes.Type) *types.Type {
|
||||
return nil
|
||||
}
|
||||
|
||||
func isTypeAlias(in gotypes.Type) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@@ -1081,8 +1081,8 @@ gopkg.in/yaml.v3
|
||||
## explicit; go 1.24.0
|
||||
# k8s.io/externaljwt v0.0.0 => ./staging/src/k8s.io/externaljwt
|
||||
## explicit; go 1.24.0
|
||||
# k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f
|
||||
## explicit; go 1.20
|
||||
# k8s.io/gengo/v2 v2.0.0-20250903151518-081d64401ab4
|
||||
## explicit; go 1.23
|
||||
k8s.io/gengo/v2
|
||||
k8s.io/gengo/v2/codetags
|
||||
k8s.io/gengo/v2/generator
|
||||
|
||||
Reference in New Issue
Block a user