diff --git a/go.mod b/go.mod index 3a488de6a..4cedd2830 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/redhat-developer/mapt -go 1.25.5 +go 1.25.6 require ( github.com/coocood/freecache v1.2.5 github.com/pulumi/pulumi-command/sdk v1.2.1 github.com/pulumi/pulumi-random/sdk/v4 v4.19.1 - github.com/pulumi/pulumi/sdk/v3 v3.224.0 + github.com/pulumi/pulumi/sdk/v3 v3.225.1 github.com/sirupsen/logrus v1.9.4 github.com/spf13/cobra v1.10.2 ) @@ -20,19 +20,19 @@ require ( github.com/aws/amazon-ec2-instance-selector/v3 v3.1.3 github.com/aws/aws-sdk-go-v2 v1.41.3 github.com/aws/aws-sdk-go-v2/config v1.32.11 - github.com/aws/aws-sdk-go-v2/service/ec2 v1.293.0 + github.com/aws/aws-sdk-go-v2/service/ec2 v1.294.0 github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4 github.com/aws/aws-sdk-go-v2/service/sts v1.41.8 - github.com/pulumi/pulumi-aws-native/sdk v1.56.0 - github.com/pulumi/pulumi-aws/sdk/v7 v7.20.0 - github.com/pulumi/pulumi-awsx/sdk/v3 v3.2.1 - github.com/pulumi/pulumi-azure-native-sdk/authorization/v3 v3.14.0 - github.com/pulumi/pulumi-azure-native-sdk/compute/v3 v3.14.0 - github.com/pulumi/pulumi-azure-native-sdk/containerservice/v3 v3.14.0 - github.com/pulumi/pulumi-azure-native-sdk/managedidentity/v3 v3.14.0 - github.com/pulumi/pulumi-azure-native-sdk/network/v3 v3.14.0 - github.com/pulumi/pulumi-azure-native-sdk/resources/v3 v3.14.0 - github.com/pulumi/pulumi-azure-native-sdk/storage/v3 v3.14.0 + github.com/pulumi/pulumi-aws-native/sdk v1.57.0 + github.com/pulumi/pulumi-aws/sdk/v7 v7.21.0 + github.com/pulumi/pulumi-awsx/sdk/v3 v3.3.0 + github.com/pulumi/pulumi-azure-native-sdk/authorization/v3 v3.15.0 + github.com/pulumi/pulumi-azure-native-sdk/compute/v3 v3.15.0 + github.com/pulumi/pulumi-azure-native-sdk/containerservice/v3 v3.15.0 + github.com/pulumi/pulumi-azure-native-sdk/managedidentity/v3 v3.15.0 + github.com/pulumi/pulumi-azure-native-sdk/network/v3 v3.15.0 + github.com/pulumi/pulumi-azure-native-sdk/resources/v3 v3.15.0 + github.com/pulumi/pulumi-azure-native-sdk/storage/v3 v3.15.0 github.com/pulumi/pulumi-gitlab/sdk/v8 v8.11.0 github.com/pulumi/pulumi-tls/sdk/v5 v5.3.0 golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa @@ -46,7 +46,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/pgavlin/fx/v2 v2.0.12 // indirect - github.com/pulumi/pulumi-azure-native-sdk/v3 v3.14.0 // indirect + github.com/pulumi/pulumi-azure-native-sdk/v3 v3.15.0 // indirect github.com/pulumi/pulumi-docker/sdk/v4 v4.11.0 // indirect ) @@ -74,7 +74,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources/v3 v3.0.1 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/atotto/clipboard v0.1.4 // indirect @@ -113,7 +113,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect github.com/hashicorp/go-version v1.8.0 // indirect github.com/iwdgo/sigintwindows v0.2.2 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -147,28 +147,28 @@ require ( github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/zclconf/go-cty v1.18.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/collector/featuregate v1.51.0 // indirect - go.opentelemetry.io/collector/pdata v1.51.0 // indirect - go.opentelemetry.io/otel v1.40.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect - go.opentelemetry.io/otel/metric v1.40.0 // indirect - go.opentelemetry.io/otel/sdk v1.40.0 // indirect - go.opentelemetry.io/otel/trace v1.40.0 // indirect + go.opentelemetry.io/collector/featuregate v1.53.0 // indirect + go.opentelemetry.io/collector/pdata v1.53.0 // indirect + go.opentelemetry.io/otel v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect + go.opentelemetry.io/otel/metric v1.42.0 // indirect + go.opentelemetry.io/otel/sdk v1.42.0 // indirect + go.opentelemetry.io/otel/trace v1.42.0 // indirect go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/oauth2 v0.34.0 // indirect - golang.org/x/sync v0.19.0 // indirect - golang.org/x/time v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect + golang.org/x/oauth2 v0.36.0 // indirect + golang.org/x/sync v0.20.0 // indirect + golang.org/x/time v0.15.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect + k8s.io/klog/v2 v2.140.0 // indirect + k8s.io/kube-openapi v0.0.0-20260304202019-5b3e3fdb0acf // indirect + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect @@ -217,7 +217,7 @@ require ( go.uber.org/atomic v1.11.0 // indirect golang.org/x/crypto v0.48.0 // indirect golang.org/x/net v0.51.0 // indirect - golang.org/x/sys v0.41.0 // indirect + golang.org/x/sys v0.42.0 // indirect golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect google.golang.org/grpc v1.79.2 // indirect diff --git a/go.sum b/go.sum index 1b318996c..9a832a22a 100644 --- a/go.sum +++ b/go.sum @@ -28,10 +28,10 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0/go.mod h1:TpiwjwnW/khS0LKs4vW5UmmT9OWcxaveS8U7+tlknzo= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 h1:XRzhVemXdgvJqCH0sFfrBUTnUJSBrBf7++ypk+twtRs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk= -github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= -github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0 h1:4iB+IesclUXdP0ICgAabvq2FYLXrJWKx1fJQ+GxSo3Y= +github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= @@ -69,8 +69,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.5 h1:clHU5fm//kWS1C2HgtgWxfQbFbx4 github.com/aws/aws-sdk-go-v2/internal/ini v1.8.5/go.mod h1:O3h0IK87yXci+kg6flUKzJnWeziQUKciKrLjcatSNcY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.20 h1:qi3e/dmpdONhj1RyIZdi6DKKpDXS5Lb8ftr3p7cyHJc= github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.20/go.mod h1:V1K+TeJVD5JOk3D9e5tsX2KUdL7BlB+FV6cBhdobN8c= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.293.0 h1:dgdIaG/GCiXMo16HAdFwpjt9Vn34bD2WVH5SiZdwzUc= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.293.0/go.mod h1:2dMnUs1QzlGzsm46i9oBHAxVHQp7b6qF7PljWcgVEVE= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.294.0 h1:776KnBqePBBR6zEDi0bUIHXzUBOISa2WgAKEgckUF8M= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.294.0/go.mod h1:rB577GvkmJADVOFGY8/j9sPv/ewcsEtQNsd9Lrn7Zx0= github.com/aws/aws-sdk-go-v2/service/ecs v1.73.1 h1:TSmcWx+RzhGJrPNoFkuqANafJQ7xY3W2UBg6ShN3ae8= github.com/aws/aws-sdk-go-v2/service/ecs v1.73.1/go.mod h1:KWILGx+bRowcGyJU/va2Ift48c658blP5e1qvldnIRE= github.com/aws/aws-sdk-go-v2/service/iam v1.53.4 h1:FUWGS7m97SYL0bk9Kb+Q4bVpcSrKOHNiIbEXIRFTRW4= @@ -216,8 +216,8 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -334,28 +334,28 @@ github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 h1:vkHw5I/plNdTr435 github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231/go.mod h1:murToZ2N9hNJzewjHBgfFdXhZKjY3z5cYC1VXk+lbFE= github.com/pulumi/esc v0.22.0 h1:Kbk0kIPsoIu6vnLgKtiE8AKRfl8B8bg6adiQuwJiBjA= github.com/pulumi/esc v0.22.0/go.mod h1:mkghIFn/TvN3XnP4jmCB4U5BG1I4UjGluARi39ckrCE= -github.com/pulumi/pulumi-aws-native/sdk v1.56.0 h1:pFUJuATUwRCfZk+mb1MftTqGYnbh+8KH5tXkTgZ8+dc= -github.com/pulumi/pulumi-aws-native/sdk v1.56.0/go.mod h1:UkhMdEA8ukabGNkdw0nW3gF3lvCA35iU42XjCQN4pNM= -github.com/pulumi/pulumi-aws/sdk/v7 v7.20.0 h1:lUkhos4MN016kNr4Qk3c3bo021/2eoDj8YLMryqplhw= -github.com/pulumi/pulumi-aws/sdk/v7 v7.20.0/go.mod h1:roeZielU3NuaZyTQWeW1jHV1JB2r3oV9a2sZbU8WeQs= -github.com/pulumi/pulumi-awsx/sdk/v3 v3.2.1 h1:2yFX9uxAcSi3dzNs1aRSdz52pWuLRtT1VbvtEdkU2dU= -github.com/pulumi/pulumi-awsx/sdk/v3 v3.2.1/go.mod h1:Jyr19gfK8Q7XYPxi2+NGwypZy2PnEHCypHqIUx1qU5o= -github.com/pulumi/pulumi-azure-native-sdk/authorization/v3 v3.14.0 h1:LvK2Ve5g7Pv3INaGc6v0DigJQxilijlaW5n/wYvot1k= -github.com/pulumi/pulumi-azure-native-sdk/authorization/v3 v3.14.0/go.mod h1:seNWKUDY09nLiOLLe/BlCSTdHUwoP3qJS+0jD5S3ltQ= -github.com/pulumi/pulumi-azure-native-sdk/compute/v3 v3.14.0 h1:dejLT5csB3iPPrm+SJ+J8689pjDPab5F7LRKVDsY0as= -github.com/pulumi/pulumi-azure-native-sdk/compute/v3 v3.14.0/go.mod h1:h+jjjy+3Ytg5QDRy0laI2WpI1lsbxNO9euqhHx9gBFs= -github.com/pulumi/pulumi-azure-native-sdk/containerservice/v3 v3.14.0 h1:x3XBsKVGN1GezwFqrAxjeI4p9DhdshOdH/Um3Y23vvU= -github.com/pulumi/pulumi-azure-native-sdk/containerservice/v3 v3.14.0/go.mod h1:oXiLzeqAm4yLE426N9JQaRM8fPNMfUzYri3u/Vx5n0o= -github.com/pulumi/pulumi-azure-native-sdk/managedidentity/v3 v3.14.0 h1:zZidv5mmN5/HS3zU0RktpULloNikX2AZw6mAOGpSCpo= -github.com/pulumi/pulumi-azure-native-sdk/managedidentity/v3 v3.14.0/go.mod h1:DjKhtbrocV/S3AbCUKXMxYYr+gByDt9jyPjmyohd3+I= -github.com/pulumi/pulumi-azure-native-sdk/network/v3 v3.14.0 h1:GSV73YhJcSiYQ2nawVWr1sUEsP8aRoSsKDrRdoJPOKE= -github.com/pulumi/pulumi-azure-native-sdk/network/v3 v3.14.0/go.mod h1:ESa7SVfSWWp9c+rtnRRzmi2Xs6cfG3hwDp49OTl7OoU= -github.com/pulumi/pulumi-azure-native-sdk/resources/v3 v3.14.0 h1:UC7qtT+nEOwklPQUupfLbQ0JRrRJ2OrGczr/OVhi0Ig= -github.com/pulumi/pulumi-azure-native-sdk/resources/v3 v3.14.0/go.mod h1:C4BY+62r/puESyTLigDV1doOs4ur2b1kCVCSsH8Jh10= -github.com/pulumi/pulumi-azure-native-sdk/storage/v3 v3.14.0 h1:O6b6+euriIsbhVLRggv2hzoCsbvV8CgfnTquYrl2BEY= -github.com/pulumi/pulumi-azure-native-sdk/storage/v3 v3.14.0/go.mod h1:eXbHKmOCwrIkw12pdxnjFPfj4vFMlDcaBAJD6JV0qmg= -github.com/pulumi/pulumi-azure-native-sdk/v3 v3.14.0 h1:29XtsDNMNqDOjWqTyHnN0KoQAMvboNPnVYSbnVH9mFY= -github.com/pulumi/pulumi-azure-native-sdk/v3 v3.14.0/go.mod h1:HpTlXFm+yGTmCdDj3rszMvzS0OBk1kpN2TNbAwnChNI= +github.com/pulumi/pulumi-aws-native/sdk v1.57.0 h1:It+iBKVjnlB7aKMdTXegPSZ6hlElWdzjpQjcsw1CQAM= +github.com/pulumi/pulumi-aws-native/sdk v1.57.0/go.mod h1:mZqNmPQKFtR3F21zQSsjb/2O25tb+9wV2BnO6W2X9bg= +github.com/pulumi/pulumi-aws/sdk/v7 v7.21.0 h1:r9BtOd8R5Y8uHjx8xJJRQuNP5U2YZevyeuZqFT4Rwyw= +github.com/pulumi/pulumi-aws/sdk/v7 v7.21.0/go.mod h1:ZfWMh9R4tKLJadncyFVPIhaEr4mqLcS84jF9r3YtXkE= +github.com/pulumi/pulumi-awsx/sdk/v3 v3.3.0 h1:FnBJCueeAyLQyDY1JyJz8coMI8C6ltFVQHN6OXj2QV4= +github.com/pulumi/pulumi-awsx/sdk/v3 v3.3.0/go.mod h1:2/RMtCM6nOYsWHV0rFZRze7PdSMIKM61ZHbDGEwMaOs= +github.com/pulumi/pulumi-azure-native-sdk/authorization/v3 v3.15.0 h1:ixiRpCi/rDZonx6u2Ekm2vyt2AvkPTBiFOsvr26/6ms= +github.com/pulumi/pulumi-azure-native-sdk/authorization/v3 v3.15.0/go.mod h1:sX9895VTxroCuVSgnfJFxgSdtt8vm0WSeVsYi+O4oNw= +github.com/pulumi/pulumi-azure-native-sdk/compute/v3 v3.15.0 h1:7fawXOouZT5sXB5Uj+B6iT1Tla5o19eKugsdolKJF8E= +github.com/pulumi/pulumi-azure-native-sdk/compute/v3 v3.15.0/go.mod h1:QRWGNdhZHYq5y1ZPbM+MtAQ6eJgCxyfbIRJLnptBU5s= +github.com/pulumi/pulumi-azure-native-sdk/containerservice/v3 v3.15.0 h1:8mz1NdDhoH0Ky832j5GWYUgbNRnwkGopYCQ78mEm1go= +github.com/pulumi/pulumi-azure-native-sdk/containerservice/v3 v3.15.0/go.mod h1:BdYgy4z+mztbQbXirekvWwkwcQBxN4UmDSbBH+iWjds= +github.com/pulumi/pulumi-azure-native-sdk/managedidentity/v3 v3.15.0 h1:zPg045umQxuWQzWlRC9AZPgqoTgXEAlT5qMVUFyA4Ww= +github.com/pulumi/pulumi-azure-native-sdk/managedidentity/v3 v3.15.0/go.mod h1:6uqtBCO/77I78nTnRK1eWtp7y7kMAhgtCj0dzMjqPtM= +github.com/pulumi/pulumi-azure-native-sdk/network/v3 v3.15.0 h1:TokpnB2dd8ehp6mfeSGa61Afwr4KjcVpzbrLPDO98Dw= +github.com/pulumi/pulumi-azure-native-sdk/network/v3 v3.15.0/go.mod h1:jsY9P9r8h/d+0qkt9kNITxCso1dHJCA/BYhg24vGSKU= +github.com/pulumi/pulumi-azure-native-sdk/resources/v3 v3.15.0 h1:DaDnMM0jFUsPvECtt/CTnMMw75882QyXtQLG9we4+nk= +github.com/pulumi/pulumi-azure-native-sdk/resources/v3 v3.15.0/go.mod h1:0LCEqxArd1axsjot6hwbXBTVzThTFDkZ/LS60ODuRH0= +github.com/pulumi/pulumi-azure-native-sdk/storage/v3 v3.15.0 h1:A1cksYWKtvBHTvWbhcUpJc8vV994LJY54F9SDBbb3DU= +github.com/pulumi/pulumi-azure-native-sdk/storage/v3 v3.15.0/go.mod h1:WeNzJQtMdUPFAChZPDpw6hbKb1FbMgTlDVoeKhNPZ6E= +github.com/pulumi/pulumi-azure-native-sdk/v3 v3.15.0 h1:krYpX1ddRcYbwSJfSTJkm8Kv5rZW8A06qITJiHEf83w= +github.com/pulumi/pulumi-azure-native-sdk/v3 v3.15.0/go.mod h1:HpTlXFm+yGTmCdDj3rszMvzS0OBk1kpN2TNbAwnChNI= github.com/pulumi/pulumi-command/sdk v1.2.1 h1:mAziZ91a/9U+5IjZH5Skcar80OSmpBSYljeQNRblTWQ= github.com/pulumi/pulumi-command/sdk v1.2.1/go.mod h1:hQxv9DXg6bFjcd9BEiNdMImQ/V1rnC9D115q5VXYNps= github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild v0.0.15 h1:K6F/3o44gGj+ljRS4spCGvAXMSwECHITjaCccfjXNyE= @@ -370,8 +370,8 @@ github.com/pulumi/pulumi-random/sdk/v4 v4.19.1 h1:MUr4+gUQy+wqhoHsuhXO6ypT40KhU9 github.com/pulumi/pulumi-random/sdk/v4 v4.19.1/go.mod h1:AJpJvPU3qJaq02VUui3rMZHchvVpTvVuVp0lbCeEE50= github.com/pulumi/pulumi-tls/sdk/v5 v5.3.0 h1:T5flLAVyTUbnNRbKMpwMpHoNiquxRlGzpevYkan5ZkM= github.com/pulumi/pulumi-tls/sdk/v5 v5.3.0/go.mod h1:dGWmFbFPclMTOrhpYtXN6trciFHZR08p31S6TqRrLzo= -github.com/pulumi/pulumi/sdk/v3 v3.224.0 h1:z/4vxGI2oO9IY6Jr5pJ5rCCfaF0D9CDMyf71vTvLots= -github.com/pulumi/pulumi/sdk/v3 v3.224.0/go.mod h1:O6FsKAEKCj3axqPQ6DyMUn/07pN1I2vq9wI1WFEuxnI= +github.com/pulumi/pulumi/sdk/v3 v3.225.1 h1:yn64PBZocE0Ums82fc6jaWRZthZ352BFi/tVAs5jrps= +github.com/pulumi/pulumi/sdk/v3 v3.225.1/go.mod h1:kiwkjulVm9ibqTOcyrZYhaRZsDSxWpzIKPXtCFeffBE= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= @@ -434,26 +434,26 @@ github.com/zclconf/go-cty v1.18.0 h1:pJ8+HNI4gFoyRNqVE37wWbJWVw43BZczFo7KUoRczaA github.com/zclconf/go-cty v1.18.0/go.mod h1:qpnV6EDNgC1sns/AleL1fvatHw72j+S+nS+MJ+T2CSg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/collector/featuregate v1.51.0 h1:dxJuv/3T84dhNKp7fz5+8srHz1dhquGzDpLW4OZTFBw= -go.opentelemetry.io/collector/featuregate v1.51.0/go.mod h1:/1bclXgP91pISaEeNulRxzzmzMTm4I5Xih2SnI4HRSo= -go.opentelemetry.io/collector/internal/testutil v0.145.0 h1:H/KL0GH3kGqSMKxZvnQ0B0CulfO9xdTg4DZf28uV7fY= -go.opentelemetry.io/collector/internal/testutil v0.145.0/go.mod h1:YAD9EAkwh/l5asZNbEBEUCqEjoL1OKMjAMoPjPqH76c= -go.opentelemetry.io/collector/pdata v1.51.0 h1:DnDhSEuDXNdzGRB7f6oOfXpbDApwBX3tY+3K69oUrDA= -go.opentelemetry.io/collector/pdata v1.51.0/go.mod h1:GoX1bjKDR++mgFKdT7Hynv9+mdgQ1DDXbjs7/Ww209Q= -go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms= -go.opentelemetry.io/otel v1.40.0/go.mod h1:IMb+uXZUKkMXdPddhwAHm6UfOwJyh4ct1ybIlV14J0g= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 h1:DvJDOPmSWQHWywQS6lKL+pb8s3gBLOZUtw4N+mavW1I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0/go.mod h1:EtekO9DEJb4/jRyN4v4Qjc2yA7AtfCBuz2FynRUWTXs= -go.opentelemetry.io/otel/metric v1.40.0 h1:rcZe317KPftE2rstWIBitCdVp89A2HqjkxR3c11+p9g= -go.opentelemetry.io/otel/metric v1.40.0/go.mod h1:ib/crwQH7N3r5kfiBZQbwrTge743UDc7DTFVZrrXnqc= -go.opentelemetry.io/otel/sdk v1.40.0 h1:KHW/jUzgo6wsPh9At46+h4upjtccTmuZCFAc9OJ71f8= -go.opentelemetry.io/otel/sdk v1.40.0/go.mod h1:Ph7EFdYvxq72Y8Li9q8KebuYUr2KoeyHx0DRMKrYBUE= -go.opentelemetry.io/otel/sdk/metric v1.40.0 h1:mtmdVqgQkeRxHgRv4qhyJduP3fYJRMX4AtAlbuWdCYw= -go.opentelemetry.io/otel/sdk/metric v1.40.0/go.mod h1:4Z2bGMf0KSK3uRjlczMOeMhKU2rhUqdWNoKcYrtcBPg= -go.opentelemetry.io/otel/trace v1.40.0 h1:WA4etStDttCSYuhwvEa8OP8I5EWu24lkOzp+ZYblVjw= -go.opentelemetry.io/otel/trace v1.40.0/go.mod h1:zeAhriXecNGP/s2SEG3+Y8X9ujcJOTqQ5RgdEJcawiA= +go.opentelemetry.io/collector/featuregate v1.53.0 h1:cgjXdtl7jezWxq6V0eohe/JqjY4PBotZGb5+bTR2OJw= +go.opentelemetry.io/collector/featuregate v1.53.0/go.mod h1:PS7zY/zaCb28EqciePVwRHVhc3oKortTFXsi3I6ee4g= +go.opentelemetry.io/collector/internal/testutil v0.147.0 h1:DFlRxBRp23/sZnpTITK25yqe0d56yNvK+63IaWc6OsU= +go.opentelemetry.io/collector/internal/testutil v0.147.0/go.mod h1:Jkjs6rkqs973LqgZ0Fe3zrokQRKULYXPIf4HuqStiEE= +go.opentelemetry.io/collector/pdata v1.53.0 h1:DlYDbRwammEZaxDZHINx5v0n8SEOVNniPbi6FRTlVkA= +go.opentelemetry.io/collector/pdata v1.53.0/go.mod h1:LRSYGNjKXaUrZEwZv3Yl+8/zV2HmRGKXW62zB2bysms= +go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho= +go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0/go.mod h1:J2pvYM5NGHofZ2/Ru6zw/TNWnEQp5crgyDeSrYpXkAw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 h1:zWWrB1U6nqhS/k6zYB74CjRpuiitRtLLi68VcgmOEto= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0/go.mod h1:2qXPNBX1OVRC0IwOnfo1ljoid+RD0QK3443EaqVlsOU= +go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4= +go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI= +go.opentelemetry.io/otel/sdk v1.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo= +go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts= +go.opentelemetry.io/otel/sdk/metric v1.42.0 h1:D/1QR46Clz6ajyZ3G8SgNlTJKBdGp84q9RKCAZ3YGuA= +go.opentelemetry.io/otel/sdk/metric v1.42.0/go.mod h1:Ua6AAlDKdZ7tdvaQKfSmnFTdHx37+J4ba8MwVCYM5hc= +go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY= +go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc= go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.opentelemetry.io/proto/slim/otlp v1.9.0 h1:fPVMv8tP3TrsqlkH1HWYUpbCY9cAIemx184VGkS6vlE= @@ -494,13 +494,13 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= -golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= -golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -518,8 +518,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg= golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM= @@ -528,8 +528,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= -golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= +golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -544,8 +544,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= -google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409/go.mod h1:fl8J1IvUjCilwZzQowmw2b7HQB2eAuYBabMXzWurF+I= +google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171 h1:tu/dtnW1o3wfaxCOjSLn5IRX4YDcJrtlpzYkhHhGaC4= +google.golang.org/genproto/googleapis/api v0.0.0-20260226221140-a57be14db171/go.mod h1:M5krXqk4GhBKvB596udGL3UyjL4I1+cTbK0orROM9ng= google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= google.golang.org/grpc v1.79.2 h1:fRMD94s2tITpyJGtBBn7MkMseNpOZU8ZxgC3MMBaXRU= @@ -575,12 +575,12 @@ k8s.io/apimachinery v0.35.2 h1:NqsM/mmZA7sHW02JZ9RTtk3wInRgbVxL8MPfzSANAK8= k8s.io/apimachinery v0.35.2/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= k8s.io/client-go v0.35.2 h1:YUfPefdGJA4aljDdayAXkc98DnPkIetMl4PrKX97W9o= k8s.io/client-go v0.35.2/go.mod h1:4QqEwh4oQpeK8AaefZ0jwTFJw/9kIjdQi0jpKeYvz7g= -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-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= +k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= +k8s.io/kube-openapi v0.0.0-20260304202019-5b3e3fdb0acf h1:btPscg4cMql0XdYK2jLsJcNEKmACJz8l+U7geC06FiM= +k8s.io/kube-openapi v0.0.0-20260304202019-5b3e3fdb0acf/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= lukechampine.com/frand v1.5.1 h1:fg0eRtdmGFIxhP5zQJzM1lFDbD6CUfu/f+7WgAZd5/w= lukechampine.com/frand v1.5.1/go.mod h1:4VstaWc2plN4Mjr10chUD46RAVGWhpkZ5Nja8+Azp0Q= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= diff --git a/oci/Containerfile b/oci/Containerfile index b39c9a85c..b5657b30d 100644 --- a/oci/Containerfile +++ b/oci/Containerfile @@ -1,12 +1,12 @@ -FROM registry.access.redhat.com/ubi9/go-toolset@sha256:b3b98e0b21ddbb979d968ca319b8eebdca121e30d58994072cbf99ce86e5d24e as builder +FROM registry.access.redhat.com/ubi9/go-toolset@sha256:71101fd9ba32aabeaec2c073e5786c91642aaee902475fce3d8280457fb19e9d as builder ARG TARGETARCH USER root WORKDIR /workspace COPY . . # renovate: datasource=github-releases depName=pulumi/pulumi -ENV PULUMI_VERSION 3.224.0 +ENV PULUMI_VERSION 3.225.1 ENV PULUMI_BASE_URL="https://github.com/pulumi/pulumi/releases/download/v${PULUMI_VERSION}/pulumi-v${PULUMI_VERSION}" ENV PULUMI_URL="${PULUMI_BASE_URL}-linux-x64.tar.gz" @@ -32,11 +32,11 @@ ENV AWS_SDK_LOAD_CONFIG=1 \ # Pulumi plugins # renovate: datasource=github-releases depName=pulumi/pulumi-aws -ARG PULUMI_AWS_VERSION=v7.20.0 +ARG PULUMI_AWS_VERSION=v7.21.0 # renovate: datasource=github-releases depName=pulumi/pulumi-awsx -ARG PULUMI_AWSX_VERSION=v3.2.1 +ARG PULUMI_AWSX_VERSION=v3.3.0 # renovate: datasource=github-releases depName=pulumi/pulumi-azure-native -ARG PULUMI_AZURE_NATIVE_VERSION=v3.14.0 +ARG PULUMI_AZURE_NATIVE_VERSION=v3.15.0 # renovate: datasource=github-releases depName=pulumi/pulumi-command ARG PULUMI_COMMAND_VERSION=v1.2.1 # renovate: datasource=github-releases depName=pulumi/pulumi-tls @@ -44,7 +44,7 @@ ARG PULUMI_TLS_VERSION=v5.3.0 # renovate: datasource=github-releases depName=pulumi/pulumi-random ARG PULUMI_RANDOM_VERSION=v4.19.1 # renovate: datasource=github-releases depName=pulumi/pulumi-aws-native -ARG PULUMI_AWS_NATIVE_VERSION=v1.56.0 +ARG PULUMI_AWS_NATIVE_VERSION=v1.57.0 # renovate: datasource=github-releases depName=pulumi/pulumi-gitlab ARG PULUMI_GITLAB_VERSION=v9.9.0 diff --git a/tools/go.mod b/tools/go.mod index 926e48bf4..8f5f43214 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -2,9 +2,7 @@ module github.com/redhat-developer/mapt/tools go 1.25.0 -require github.com/golangci/golangci-lint/v2 v2.10.1 - -require github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect +require github.com/golangci/golangci-lint/v2 v2.11.2 require ( github.com/charmbracelet/x/cellbuf v0.0.15 // indirect @@ -22,12 +20,13 @@ require ( dev.gaijin.team/go/golib v0.8.1 // indirect github.com/AdminBenni/iota-mixing v1.0.0 // indirect github.com/MirrexOne/unqueryvet v1.5.4 // indirect - github.com/alexkohler/prealloc v1.0.2 // indirect + github.com/alexkohler/prealloc v1.1.0 // indirect github.com/alfatraining/structtag v1.0.0 // indirect github.com/clipperhouse/uax29/v2 v2.7.0 // indirect github.com/denis-tingaikin/go-header v0.5.0 // indirect github.com/godoc-lint/godoc-lint v0.11.2 // indirect github.com/golangci/asciicheck v0.5.0 // indirect + github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect github.com/gostaticanalysis/nilerr v0.1.2 // indirect github.com/nunnatsa/ginkgolinter v0.23.0 // indirect ) @@ -116,7 +115,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jgautheron/goconst v1.8.2 // indirect + github.com/jgautheron/goconst v1.9.0 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jjti/go-spancheck v0.6.5 // indirect github.com/julz/importas v0.2.0 // indirect @@ -143,7 +142,7 @@ require ( github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.21 // indirect - github.com/mgechev/revive v1.14.0 // indirect + github.com/mgechev/revive v1.15.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/moricho/tparallel v0.3.2 // indirect github.com/muesli/termenv v0.16.0 // indirect @@ -211,8 +210,8 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect golang.org/x/exp/typeparams v0.0.0-20260218203240-3dfff04db8fa // indirect golang.org/x/mod v0.33.0 // indirect - golang.org/x/sync v0.19.0 // indirect - golang.org/x/sys v0.41.0 // indirect + golang.org/x/sync v0.20.0 // indirect + golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.34.0 // indirect golang.org/x/tools v0.42.0 // indirect google.golang.org/protobuf v1.36.11 // indirect diff --git a/tools/go.sum b/tools/go.sum index 570338917..48fd00e8c 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -44,8 +44,8 @@ github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alexkohler/nakedret/v2 v2.0.6 h1:ME3Qef1/KIKr3kWX3nti3hhgNxw6aqN5pZmQiFSsuzQ= github.com/alexkohler/nakedret/v2 v2.0.6/go.mod h1:l3RKju/IzOMQHmsEvXwkqMDzHHvurNQfAgE1eVmT40Q= -github.com/alexkohler/prealloc v1.0.2 h1:MPo8cIkGkZytq7WNH9UHv3DIX1mPz1RatPXnZb0zHWQ= -github.com/alexkohler/prealloc v1.0.2/go.mod h1:fT39Jge3bQrfA7nPMDngUfvUbQGQeJyGQnR+913SCig= +github.com/alexkohler/prealloc v1.1.0 h1:cKGRBqlXw5iyQGLYhrXrDlcHxugXpTq4tQ5c91wkf8M= +github.com/alexkohler/prealloc v1.1.0/go.mod h1:fT39Jge3bQrfA7nPMDngUfvUbQGQeJyGQnR+913SCig= github.com/alfatraining/structtag v1.0.0 h1:2qmcUqNcCoyVJ0up879K614L9PazjBSFruTB0GOFjCc= github.com/alfatraining/structtag v1.0.0/go.mod h1:p3Xi5SwzTi+Ryj64DqjLWz7XurHxbGsq6y3ubePJPus= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= @@ -177,8 +177,8 @@ github.com/golangci/go-printf-func-name v0.1.1 h1:hIYTFJqAGp1iwoIfsNTpoq1xZAarog github.com/golangci/go-printf-func-name v0.1.1/go.mod h1:Es64MpWEZbh0UBtTAICOZiB+miW53w/K9Or/4QogJss= github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0aiOTsLKO2aZQAPT4nlQCsimGcSGE= github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY= -github.com/golangci/golangci-lint/v2 v2.10.1 h1:flhw5Px6ojbLyEFzXvJn5B2HEdkkRlkhE1SnmCbQBiE= -github.com/golangci/golangci-lint/v2 v2.10.1/go.mod h1:dBsrOk6zj0vDhlTv+IiJGqkDokR24IVTS7W3EVfPTQY= +github.com/golangci/golangci-lint/v2 v2.11.2 h1:4Icd3mEqthcFcFww8L67OBtfKB/obXxko8aFUMqP/5w= +github.com/golangci/golangci-lint/v2 v2.11.2/go.mod h1:wexdFBIQNhHNhDe1oqzlGFE5dYUqlfccWJKWjoWF1GI= github.com/golangci/golines v0.15.0 h1:Qnph25g8Y1c5fdo1X7GaRDGgnMHgnxh4Gk4VfPTtRx0= github.com/golangci/golines v0.15.0/go.mod h1:AZjXd23tbHMpowhtnGlj9KCNsysj72aeZVVHnVcZx10= github.com/golangci/misspell v0.8.0 h1:qvxQhiE2/5z+BVRo1kwYA8yGz+lOlu5Jfvtx2b04Jbg= @@ -225,8 +225,8 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jgautheron/goconst v1.8.2 h1:y0XF7X8CikZ93fSNT6WBTb/NElBu9IjaY7CCYQrCMX4= -github.com/jgautheron/goconst v1.8.2/go.mod h1:A0oxgBCHy55NQn6sYpO7UdnA9p+h7cPtoOZUmvNIako= +github.com/jgautheron/goconst v1.9.0 h1:lCZu0hmff6FtZQ65KCcK2G/f49AbSJIMyugfhvR5Id8= +github.com/jgautheron/goconst v1.9.0/go.mod h1:0p+wv1lFOiUr0IlNNT1nrm6+8DB8u2sU6KHGzFRXHDc= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jjti/go-spancheck v0.6.5 h1:lmi7pKxa37oKYIMScialXUK6hP3iY5F1gu+mLBPgYB8= @@ -285,8 +285,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w= github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= -github.com/mgechev/revive v1.14.0 h1:CC2Ulb3kV7JFYt+izwORoS3VT/+Plb8BvslI/l1yZsc= -github.com/mgechev/revive v1.14.0/go.mod h1:MvnujelCZBZCaoDv5B3foPo6WWgULSSFxvfxp7GsPfo= +github.com/mgechev/revive v1.15.0 h1:vJ0HzSBzfNyPbHKolgiFjHxLek9KUijhqh42yGoqZ8Q= +github.com/mgechev/revive v1.15.0/go.mod h1:LlAKO3QQe9OJ0pVZzI2GPa8CbXGZ/9lNpCGvK4T/a8A= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/moricho/tparallel v0.3.2 h1:odr8aZVFA3NZrNybggMkYO3rgPRcqjeQUlBBFVxKHTI= @@ -494,8 +494,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -512,8 +512,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= diff --git a/tools/vendor/github.com/alexkohler/prealloc/pkg/math.go b/tools/vendor/github.com/alexkohler/prealloc/pkg/math.go index 4335b0860..4a4923682 100644 --- a/tools/vendor/github.com/alexkohler/prealloc/pkg/math.go +++ b/tools/vendor/github.com/alexkohler/prealloc/pkg/math.go @@ -39,7 +39,33 @@ func addIntExpr(x, y ast.Expr) ast.Expr { return &ast.BinaryExpr{X: x, Op: token.ADD, Y: y} } +func incIntExpr(x ast.Expr) ast.Expr { + if x == nil { + return nil + } + + xInt, xOK := intValue(x) + if xOK { + return intExpr(xInt + 1) + } + if binary, ok := x.(*ast.BinaryExpr); ok && binary.Op == token.SUB { + if yInt, yOK := intValue(binary.Y); yOK && yInt == 1 { + return binary.X + } + } + return &ast.BinaryExpr{X: x, Op: token.ADD, Y: intExpr(1)} +} + func subIntExpr(x, y ast.Expr) ast.Expr { + if binary, ok := x.(*ast.BinaryExpr); ok && binary.Op == token.ADD { + if exprEqual(binary.X, y) { + return binary.Y + } + if exprEqual(binary.Y, y) { + return binary.X + } + } + if unary, ok := y.(*ast.UnaryExpr); ok && unary.Op == token.SUB { y = unary.X } else { @@ -78,6 +104,26 @@ func mulIntExpr(x, y ast.Expr) ast.Expr { return &ast.BinaryExpr{X: x, Op: token.MUL, Y: y} } +func divIntExpr(x, y ast.Expr) (ast.Expr, bool) { + if x == nil || y == nil { + return nil, false + } + + xInt, xOK := intValue(x) + yInt, yOK := intValue(y) + + if xOK && yOK { + return intExpr(xInt / yInt), xInt%yInt != 0 + } + if yOK && yInt == 0 { + return nil, false + } + if (xOK && xInt == 0) || (yOK && yInt == 1) { + return x, false + } + return &ast.BinaryExpr{X: x, Op: token.QUO, Y: y}, true +} + func intExpr(n int) *ast.BasicLit { return &ast.BasicLit{Kind: token.INT, Value: strconv.Itoa(n)} } diff --git a/tools/vendor/github.com/alexkohler/prealloc/pkg/prealloc.go b/tools/vendor/github.com/alexkohler/prealloc/pkg/prealloc.go index d21613ae7..959a8671c 100644 --- a/tools/vendor/github.com/alexkohler/prealloc/pkg/prealloc.go +++ b/tools/vendor/github.com/alexkohler/prealloc/pkg/prealloc.go @@ -5,6 +5,7 @@ import ( "go/ast" "go/format" "go/token" + "go/types" "strconv" "golang.org/x/tools/go/analysis" @@ -17,6 +18,8 @@ type sliceDeclaration struct { lenExpr ast.Expr // Initial length of this slice. exclude bool // Whether this slice has been disqualified due to an unsupported pattern. hasReturn bool // Whether a return statement has been found after the first append. Any subsequent appends will disqualify this slice in simple mode. + assigning bool // Whether this slice is currently being assigned the result of an append. + detached bool // Whether this slice has been appended without reassignment. Will be disqualified if this happens more than once. } type sliceAppend struct { @@ -29,27 +32,27 @@ type returnsVisitor struct { simple bool includeRangeLoops bool includeForLoops bool + pass *analysis.Pass // visitor fields sliceDeclarations []*sliceDeclaration sliceAppends []*sliceAppend loopVars []ast.Expr - preallocHints []analysis.Diagnostic level int // Current nesting level. Loops do not increment the level. hasReturn bool // Whether a return statement has been found. Slices appended before and after a return are disqualified in simple mode. hasGoto bool // Whether a goto statement has been found. Goto disqualifies pending and subsequent slices in simple mode. hasBranch bool // Whether a branch statement has been found. Loops with branch statements are unsupported in simple mode. } -func Check(files []*ast.File, simple, includeRangeLoops, includeForLoops bool) []analysis.Diagnostic { +func Check(pass *analysis.Pass, simple, includeRangeLoops, includeForLoops bool) { retVis := &returnsVisitor{ simple: simple, includeRangeLoops: includeRangeLoops, includeForLoops: includeForLoops, + pass: pass, } - for _, f := range files { + for _, f := range pass.Files { ast.Walk(retVis, f) } - return retVis.preallocHints } func (v *returnsVisitor) Visit(node ast.Node) ast.Visitor { @@ -116,7 +119,7 @@ func (v *returnsVisitor) Visit(node ast.Node) ast.Visitor { buf.Truncate(undo) } } - v.preallocHints = append(v.preallocHints, analysis.Diagnostic{ + v.pass.Report(analysis.Diagnostic{ Pos: sliceDecl.pos, Message: buf.String(), }) @@ -137,15 +140,21 @@ func (v *returnsVisitor) Visit(node ast.Node) ast.Visitor { return nil case *ast.ValueSpec: - _, isArrayType := inferExprType(s.Type).(*ast.ArrayType) + var isArrayOrSlice bool + if t := v.pass.TypesInfo.TypeOf(s.Type); t != nil { + switch t.Underlying().(type) { + case *types.Array, *types.Slice: + isArrayOrSlice = true + } + } for i, name := range s.Names { var lenExpr ast.Expr if i >= len(s.Values) { - if !isArrayType { + if !isArrayOrSlice { continue } lenExpr = intExpr(0) - } else if lenExpr = isCreateArray(s.Values[i]); lenExpr == nil { + } else if lenExpr = v.isCreateArray(s.Values[i]); lenExpr == nil { if id, ok := s.Values[i].(*ast.Ident); !ok || id.Name != "nil" { continue } @@ -174,7 +183,7 @@ func (v *returnsVisitor) Visit(node ast.Node) ast.Visitor { if !ok { continue } - if lenExpr := isCreateArray(s.Rhs[i]); lenExpr != nil { + if lenExpr := v.isCreateArray(s.Rhs[i]); lenExpr != nil { v.sliceDeclarations = append(v.sliceDeclarations, &sliceDeclaration{name: ident.Name, pos: s.Pos(), level: v.level, lenExpr: lenExpr}) } else { declIdx := -1 @@ -199,7 +208,7 @@ func (v *returnsVisitor) Visit(node ast.Node) ast.Visitor { if len(expr.Args) >= 2 && !sliceDecl.hasReturn && sliceDecl.level == v.level { if funIdent, ok := expr.Fun.(*ast.Ident); ok && funIdent.Name == "append" { if rhsIdent, ok := expr.Args[0].(*ast.Ident); ok && ident.Name == rhsIdent.Name { - v.sliceAppends = append(v.sliceAppends, &sliceAppend{index: declIdx, countExpr: appendCount(expr)}) + sliceDecl.assigning = true continue } } @@ -209,6 +218,45 @@ func (v *returnsVisitor) Visit(node ast.Node) ast.Visitor { } } + case *ast.CallExpr: + if funIdent, ok := s.Fun.(*ast.Ident); ok && funIdent.Name == "append" && len(s.Args) >= 2 { + if rhsIdent, ok := s.Args[0].(*ast.Ident); ok { + declIdx := -1 + for i := len(v.sliceDeclarations) - 1; i >= 0; i-- { + if v.sliceDeclarations[i].name == rhsIdent.Name { + declIdx = i + break + } + } + if declIdx < 0 { + return v + } + sliceDecl := v.sliceDeclarations[declIdx] + if sliceDecl.exclude { + return v + } + + if sliceDecl.hasReturn || sliceDecl.level != v.level || sliceDecl.detached { + sliceDecl.exclude = true + return v + } + + countExpr := v.appendCount(s) + if countExpr != nil && (hasAny(countExpr, v.loopVars) || hasVarReference(countExpr, sliceDecl.name)) { + // exclude slice if append count references it + sliceDecl.exclude = true + return v + } + + if sliceDecl.assigning { + sliceDecl.assigning = false + } else { + sliceDecl.detached = true + } + v.sliceAppends = append(v.sliceAppends, &sliceAppend{index: declIdx, countExpr: countExpr}) + } + } + case *ast.RangeStmt: return v.walkRange(s) @@ -288,17 +336,26 @@ func (v *returnsVisitor) walkRange(stmt *ast.RangeStmt) ast.Visitor { } } } else { - for i := range v.sliceDeclarations { + for i, sliceDecl := range v.sliceDeclarations { + if sliceDecl.exclude { + continue + } prev := -1 for j := len(v.sliceAppends) - 1; j >= appendIdx; j-- { if v.sliceAppends[j] != nil && v.sliceAppends[j].index == i { - if prev >= 0 { + if prev < 0 { + if loopCountExpr == nil { + // make appends indeterminate if the loop count is indeterminate + v.sliceAppends[j].countExpr = nil + } else if hasVarReference(loopCountExpr, sliceDecl.name) { + // exclude slice if loop count references it + sliceDecl.exclude = true + break + } + } else { // consolidate appends to the same slice v.sliceAppends[j].countExpr = addIntExpr(v.sliceAppends[j].countExpr, v.sliceAppends[prev].countExpr) v.sliceAppends[prev] = nil - } else if loopCountExpr == nil { - // make appends indeterminate if the loop count is indeterminate - v.sliceAppends[j].countExpr = nil } prev = j } @@ -347,17 +404,26 @@ func (v *returnsVisitor) walkFor(stmt *ast.ForStmt) ast.Visitor { } } } else { - for i := range v.sliceDeclarations { + for i, sliceDecl := range v.sliceDeclarations { + if sliceDecl.exclude { + continue + } prev := -1 for j := len(v.sliceAppends) - 1; j >= appendIdx; j-- { if v.sliceAppends[j] != nil && v.sliceAppends[j].index == i { - if prev >= 0 { + if prev < 0 { + if loopCountExpr == nil { + // make appends indeterminate if the loop count is indeterminate + v.sliceAppends[j].countExpr = nil + } else if hasVarReference(loopCountExpr, sliceDecl.name) { + // exclude slice if loop count references it + sliceDecl.exclude = true + break + } + } else { // consolidate appends to the same slice v.sliceAppends[j].countExpr = addIntExpr(v.sliceAppends[j].countExpr, v.sliceAppends[prev].countExpr) v.sliceAppends[prev] = nil - } else if loopCountExpr == nil { - // make appends indeterminate if the loop count is indeterminate - v.sliceAppends[j].countExpr = nil } prev = j } @@ -379,12 +445,15 @@ func (v *returnsVisitor) walkSwitchSelect(body *ast.BlockStmt) ast.Visitor { return nil } -func isCreateArray(expr ast.Expr) ast.Expr { +func (v *returnsVisitor) isCreateArray(expr ast.Expr) ast.Expr { switch e := expr.(type) { case *ast.CompositeLit: // []any{...} - if _, ok := inferExprType(e.Type).(*ast.ArrayType); ok { - return intExpr(len(e.Elts)) + if t := v.pass.TypesInfo.TypeOf(e); t != nil { + switch t.Underlying().(type) { + case *types.Array, *types.Slice: + return intExpr(len(e.Elts)) + } } case *ast.CallExpr: switch len(e.Args) { @@ -394,8 +463,10 @@ func isCreateArray(expr ast.Expr) ast.Expr { if !ok || arg.Name != "nil" { return nil } - if _, ok = inferExprType(e.Fun).(*ast.ArrayType); ok { - return intExpr(0) + if t := v.pass.TypesInfo.TypeOf(e.Fun); t != nil { + if _, ok := t.Underlying().(*types.Slice); ok { + return intExpr(0) + } } case 2: // make([]any, n) @@ -421,37 +492,41 @@ func (v *returnsVisitor) rangeLoopCount(stmt *ast.RangeStmt) (ast.Expr, bool) { } } else if len(call.Args) >= 2 { if funIdent, ok := call.Fun.(*ast.Ident); ok && funIdent.Name == "append" { - return addIntExpr(sliceLength(call.Args[0]), appendCount(call)), true + return addIntExpr(v.sliceLength(call.Args[0]), v.appendCount(call)), true } } } - xType := inferExprType(x) + xType := v.pass.TypesInfo.TypeOf(x) + if xType != nil { + xType = xType.Underlying() + } switch xType := xType.(type) { - case *ast.ChanType, *ast.FuncType: + case *types.Chan, *types.Signature: return nil, false - case *ast.ArrayType: + case *types.Array: + if _, ok := stmt.X.(*ast.CompositeLit); ok && xType.Len() >= 0 { + return intExpr(int(xType.Len())), true + } + case *types.Slice: if lit, ok := stmt.X.(*ast.CompositeLit); ok { - if xType.Len != nil { - return xType.Len, true - } return intExpr(len(lit.Elts)), true } - case *ast.MapType: + case *types.Map: if lit, ok := x.(*ast.CompositeLit); ok { return intExpr(len(lit.Elts)), true } - case *ast.StarExpr: - if xType, ok := xType.X.(*ast.ArrayType); !ok || xType.Len == nil { + case *types.Pointer: + if xType, ok := xType.Elem().(*types.Array); !ok { return nil, true } else if unary, ok := x.(*ast.UnaryExpr); ok && unary.Op == token.AND { - if _, ok := unary.X.(*ast.CompositeLit); ok { - return xType.Len, true + if _, ok := unary.X.(*ast.CompositeLit); ok && xType.Len() >= 0 { + return intExpr(int(xType.Len())), true } } - case *ast.Ident: - if xType.Name == "string" { + case *types.Basic: + if xType.Info()&types.IsString != 0 { if lit, ok := x.(*ast.BasicLit); ok && lit.Kind == token.STRING { if str, err := strconv.Unquote(lit.Value); err == nil { return intExpr(len(str)), true @@ -466,12 +541,11 @@ func (v *returnsVisitor) rangeLoopCount(stmt *ast.RangeStmt) (ast.Expr, bool) { return nil, true } - if ident, ok := xType.(*ast.Ident); ok { - switch ident.Name { - case "byte", "rune", "int", "int8", "int16", "int32", "int64", - "uint", "uint8", "uint16", "uint32", "uint64", "uintptr": + if xType, ok := xType.(*types.Basic); ok { + switch { + case xType.Info()&types.IsInteger != 0: return x, true - case "string": + case xType.Info()&types.IsString != 0: default: return nil, true } @@ -491,14 +565,14 @@ func (v *returnsVisitor) rangeLoopCount(stmt *ast.RangeStmt) (ast.Expr, bool) { return &ast.CallExpr{Fun: ast.NewIdent("len"), Args: []ast.Expr{x}}, true } -func appendCount(expr *ast.CallExpr) ast.Expr { +func (v *returnsVisitor) appendCount(expr *ast.CallExpr) ast.Expr { if expr.Ellipsis.IsValid() { - return sliceLength(expr.Args[1]) + return v.sliceLength(expr.Args[1]) } return intExpr(len(expr.Args) - 1) } -func sliceLength(expr ast.Expr) ast.Expr { +func (v *returnsVisitor) sliceLength(expr ast.Expr) ast.Expr { if call, ok := expr.(*ast.CallExpr); ok { if len(call.Args) == 1 { if _, ok := call.Fun.(*ast.ArrayType); ok { @@ -506,18 +580,22 @@ func sliceLength(expr ast.Expr) ast.Expr { } } else if len(call.Args) >= 2 { if funIdent, ok := call.Fun.(*ast.Ident); ok && funIdent.Name == "append" { - return addIntExpr(sliceLength(call.Args[0]), appendCount(call)) + return addIntExpr(v.sliceLength(call.Args[0]), v.appendCount(call)) } } } - switch xType := inferExprType(expr).(type) { - case *ast.ArrayType: + xType := v.pass.TypesInfo.TypeOf(expr) + if xType == nil { + return nil + } + switch xType := xType.Underlying().(type) { + case *types.Array, *types.Slice: if lit, ok := expr.(*ast.CompositeLit); ok { return intExpr(len(lit.Elts)) } - case *ast.Ident: - if xType.Name == "string" { + case *types.Basic: + if xType.Info()&types.IsString != 0 { if lit, ok := expr.(*ast.BasicLit); ok && lit.Kind == token.STRING { if str, err := strconv.Unquote(lit.Value); err == nil { return intExpr(len(str)) @@ -558,55 +636,96 @@ func (v *returnsVisitor) forLoopCount(stmt *ast.ForStmt) (ast.Expr, bool) { return nil, false } - initStmt, ok := stmt.Init.(*ast.AssignStmt) - if !ok { + initAssign, ok := stmt.Init.(*ast.AssignStmt) + if !ok || len(initAssign.Lhs) != len(initAssign.Rhs) { return nil, true } - postStmt, ok := stmt.Post.(*ast.IncDecStmt) - if !ok { - return nil, true - } + for i, lhs := range initAssign.Lhs { + initIdent, ok := lhs.(*ast.Ident) + if !ok { + continue + } - postIdent, ok := postStmt.X.(*ast.Ident) - if !ok { - return nil, true - } + var reverse bool + var step ast.Expr + switch s := stmt.Post.(type) { + case *ast.IncDecStmt: + if isIdentName(s.X, initIdent.Name) { + reverse = s.Tok == token.DEC + step = intExpr(1) + } + + case *ast.AssignStmt: + if len(s.Lhs) != len(s.Rhs) { + return nil, true + } + + for i, lhs := range s.Lhs { + if !isIdentName(lhs, initIdent.Name) { + continue + } + switch s.Tok { + case token.ADD_ASSIGN, token.SUB_ASSIGN: + step = s.Rhs[i] + reverse = s.Tok == token.SUB_ASSIGN + case token.ASSIGN: + if rhsBinary, ok := s.Rhs[i].(*ast.BinaryExpr); ok { + reverse = s.Tok == token.SUB + if rhsBinary.Op == token.ADD || reverse { + if isIdentName(rhsBinary.X, initIdent.Name) { + step = rhsBinary.Y + } else if isIdentName(rhsBinary.Y, initIdent.Name) { + step = rhsBinary.X + } + } + } else { + return nil, false + } + default: + return nil, false + } + if step != nil { + break + } + } + } - index := -1 - for i := range initStmt.Lhs { - if ident, ok := initStmt.Lhs[i].(*ast.Ident); ok && ident.Name == postIdent.Name { - index = i - break + if step == nil { + continue } - } - if index < 0 { - return nil, true - } - lower := initStmt.Rhs[index] - if hasCall(lower) { - return nil, true - } + lower := initAssign.Rhs[i] + if hasCall(lower) { + continue // NATO: this should trigger another attempt + } - upper, op := forLoopUpperBound(stmt.Cond, postIdent.Name) + upper, op := forLoopUpperBound(stmt.Cond, initIdent.Name) - if postStmt.Tok == token.INC { - if op == token.GTR || op == token.GEQ { - return nil, false + if !reverse { + if op == token.GTR || op == token.GEQ { + return nil, false + } + } else { + if op == token.LSS || op == token.LEQ { + return nil, false + } + lower, upper = upper, lower } - } else { - if op == token.LSS || op == token.LEQ { - return nil, false + + if op == token.LEQ || op == token.GEQ { + upper = incIntExpr(upper) } - lower, upper = upper, lower - } - countExpr := subIntExpr(upper, lower) - if op == token.LEQ || op == token.GEQ { - countExpr = addIntExpr(countExpr, intExpr(1)) + countExpr, rounded := divIntExpr(subIntExpr(upper, lower), step) + if rounded { + // extra capacity in case non-unary step increment is rounded down + countExpr = incIntExpr(countExpr) + } + return countExpr, true } - return countExpr, true + + return nil, true } func forLoopUpperBound(expr ast.Expr, name string) (ast.Expr, token.Token) { @@ -675,6 +794,11 @@ func forLoopUpperBound(expr ast.Expr, name string) (ast.Expr, token.Token) { return nil, 0 } +func isIdentName(expr ast.Expr, name string) bool { + ident, ok := expr.(*ast.Ident) + return ok && ident.Name == name +} + func hasAny(node ast.Node, exprs []ast.Expr) bool { var found bool ast.Inspect(node, func(node ast.Node) bool { @@ -713,6 +837,11 @@ func hasCall(expr ast.Expr) bool { // allow cheap pure built-in functions return true } + case *ast.SelectorExpr: + // allow argument-less methods + if len(call.Args) == 0 { + return true + } } found = true } @@ -720,3 +849,31 @@ func hasCall(expr ast.Expr) bool { }) return found } + +func hasVarReference(expr ast.Expr, name string) bool { + found := false + ast.Inspect(expr, func(node ast.Node) bool { + switch n := node.(type) { + case *ast.SelectorExpr: + // process target expression, ignore field selector + found = hasVarReference(n.X, name) + return false + case *ast.CallExpr: + // process args, ignore function name + for _, arg := range n.Args { + if found = hasVarReference(arg, name); found { + break + } + } + return false + case *ast.KeyValueExpr: + // process value, ignore key + found = hasVarReference(n.Value, name) + return false + case *ast.Ident: + found = n.Name == name + } + return !found + }) + return found +} diff --git a/tools/vendor/github.com/alexkohler/prealloc/pkg/types.go b/tools/vendor/github.com/alexkohler/prealloc/pkg/types.go deleted file mode 100644 index 6d0561590..000000000 --- a/tools/vendor/github.com/alexkohler/prealloc/pkg/types.go +++ /dev/null @@ -1,376 +0,0 @@ -package pkg - -import ( - "go/ast" - "go/token" -) - -func inferExprType(expr ast.Expr) ast.Expr { - switch e := expr.(type) { - case *ast.ArrayType, *ast.StructType, *ast.FuncType, *ast.InterfaceType, *ast.MapType, *ast.ChanType: - return e - case *ast.ParenExpr: - return inferExprType(e.X) - case *ast.SliceExpr: - return inferExprType(e.X) - case *ast.TypeAssertExpr: - return inferExprType(e.Type) - case *ast.CompositeLit: - return inferExprType(e.Type) - case *ast.Ellipsis: - return &ast.ArrayType{Elt: e.Elt} - case *ast.FuncLit: - return &ast.FuncType{Results: e.Type.Results} - case *ast.BasicLit: - return inferBasicType(e) - case *ast.BinaryExpr: - return inferBinaryType(e) - case *ast.StarExpr: - return inferStarType(e) - case *ast.UnaryExpr: - return inferUnaryType(e) - case *ast.CallExpr: - return inferCallType(e) - case *ast.IndexExpr: - return inferIndexType(e) - case *ast.IndexListExpr: - return inferIndexListType(e) - case *ast.SelectorExpr: - return inferSelectorType(e) - case *ast.Ident: - return inferIdentType(e) - default: - return nil - } -} - -func inferBasicType(basic *ast.BasicLit) ast.Expr { - switch basic.Kind { - case token.INT: - return ast.NewIdent("int") - case token.FLOAT: - return ast.NewIdent("float64") - case token.IMAG: - return ast.NewIdent("imag") - case token.CHAR: - return ast.NewIdent("char") - case token.STRING: - return ast.NewIdent("string") - default: - return nil - } -} - -func inferBinaryType(binary *ast.BinaryExpr) ast.Expr { - switch binary.Op { - case token.EQL, token.NEQ, token.LSS, token.LEQ, token.GTR, token.GEQ: - return ast.NewIdent("bool") - default: - if x := inferExprType(binary.X); x != nil { - return x - } - return inferExprType(binary.Y) - } -} - -func inferStarType(star *ast.StarExpr) ast.Expr { - switch x := inferExprType(star.X).(type) { - case nil: - return nil - case *ast.StarExpr: - return inferExprType(x.X) - default: - return &ast.StarExpr{X: x} - } -} - -func inferUnaryType(unary *ast.UnaryExpr) ast.Expr { - if x := inferExprType(unary.X); x != nil { - switch unary.Op { - case token.AND: - return &ast.StarExpr{X: x} - case token.ARROW: - if ct, ok := x.(*ast.ChanType); ok { - return inferExprType(ct.Value) - } - return x - default: - return x - } - } - return nil -} - -func inferCallType(call *ast.CallExpr) ast.Expr { - if id, ok := call.Fun.(*ast.Ident); ok && id.Obj == nil { - switch id.Name { - case "len", "cap", "copy": - return ast.NewIdent("int") - case "real", "imag": - return ast.NewIdent("float64") - case "complex": - return ast.NewIdent("complex64") - case "recover": - return ast.NewIdent("any") - case "make", "min", "max": - if len(call.Args) > 0 { - return inferExprType(call.Args[0]) - } - case "new": - if len(call.Args) > 0 { - if arg := inferExprType(call.Args[0]); arg != nil { - return &ast.StarExpr{X: arg} - } - } - case "append": - if len(call.Args) > 0 { - if arg := inferExprType(call.Args[0]); arg != nil { - return arg - } - return &ast.ArrayType{} - } - } - } - - fun := inferExprType(call.Fun) - if ft, ok := fun.(*ast.FuncType); ok && len(ft.Results.List) > 0 { - return inferExprType(ft.Results.List[0].Type) - } - return fun -} - -func inferIndexType(index *ast.IndexExpr) ast.Expr { - if selector, ok := index.X.(*ast.SelectorExpr); ok && selector.Sel != nil && selector.Sel.Name == "Seq" { - if ident, ok := selector.X.(*ast.Ident); ok && ident.Name == "iter" { - return &ast.FuncType{ - Params: &ast.FieldList{List: []*ast.Field{{ - Names: []*ast.Ident{{Name: "yield"}}, - Type: &ast.FuncType{ - Params: &ast.FieldList{List: []*ast.Field{{Type: ast.NewIdent("V")}}}, - Results: &ast.FieldList{List: []*ast.Field{{Type: ast.NewIdent("bool")}}}, - }, - }}}, - } - } - } - - switch x := inferExprType(index.X).(type) { - case *ast.ArrayType: - return inferExprType(x.Elt) - case *ast.MapType: - return inferExprType(x.Value) - default: - return x - } -} - -func inferIndexListType(index *ast.IndexListExpr) ast.Expr { - if selector, ok := index.X.(*ast.SelectorExpr); ok && selector.Sel != nil && selector.Sel.Name == "Seq2" { - if ident, ok := selector.X.(*ast.Ident); ok && ident.Name == "iter" { - return &ast.FuncType{ - Params: &ast.FieldList{List: []*ast.Field{{ - Names: []*ast.Ident{{Name: "yield"}}, - Type: &ast.FuncType{ - Params: &ast.FieldList{List: []*ast.Field{ - {Type: ast.NewIdent("K")}, - {Type: ast.NewIdent("V")}, - }}, - Results: &ast.FieldList{List: []*ast.Field{{Type: ast.NewIdent("bool")}}}, - }, - }}}, - } - } - } - - x := inferExprType(index.X) - if at, ok := x.(*ast.ArrayType); ok { - return inferExprType(at.Elt) - } - return x -} - -func inferSelectorType(sel *ast.SelectorExpr) ast.Expr { - x := inferExprType(sel.X) - if se, ok := x.(*ast.StarExpr); ok { - x = se.X - } - switch x := x.(type) { - case *ast.StructType: - for _, field := range x.Fields.List { - for _, name := range field.Names { - if name.Name == sel.Sel.Name { - return inferExprType(field.Type) - } - } - } - case *ast.InterfaceType: - for _, method := range x.Methods.List { - for _, name := range method.Names { - if name.Name == sel.Sel.Name { - return inferExprType(method.Type) - } - } - } - } - return nil -} - -func inferIdentType(ident *ast.Ident) ast.Expr { - if ident.Obj == nil { - switch ident.Name { - case "bool", "byte", "comparable", "error", "rune", "string", "any", - "int", "int8", "int16", "int32", "int64", - "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", - "float32", "float64", "complex64", "complex128": - return ident - case "nil": - return ast.NewIdent("any") - case "true", "false": - return ast.NewIdent("bool") - case "iota": - return ast.NewIdent("int") - } - } else { - switch decl := ident.Obj.Decl.(type) { - case *ast.Field: - return inferExprType(decl.Type) - case *ast.FuncDecl: - return inferExprType(decl.Type) - case *ast.TypeSpec: - // abort when recursive pointer type detected - t := decl.Type - for { - if star, ok := t.(*ast.StarExpr); ok { - t = star.X - } else if t == ident { - return nil - } else { - break - } - } - return inferExprType(decl.Type) - case *ast.ValueSpec: - return inferValueType(decl, ident.Name) - case *ast.AssignStmt: - return inferAssignType(decl, ident.Name) - } - } - return nil -} - -func inferValueType(value *ast.ValueSpec, name string) ast.Expr { - if value.Type != nil { - return inferExprType(value.Type) - } - - index := -1 - for i := range value.Names { - if value.Names[i].Name == name { - index = i - } - } - if index < 0 { - return nil - } - - if len(value.Names) == len(value.Values) { - return inferExprType(value.Values[index]) - } - - return inferAssignMultiType(value.Values[0], index) -} - -func inferAssignType(assign *ast.AssignStmt, name string) ast.Expr { - index := -1 - for i := range assign.Lhs { - if id, ok := assign.Lhs[i].(*ast.Ident); ok && id.Name == name { - index = i - } - } - if index < 0 { - return nil - } - - if len(assign.Rhs) == 1 { - if ue, ok := assign.Rhs[0].(*ast.UnaryExpr); ok && ue.Op == token.RANGE { - switch rhs := inferExprType(assign.Rhs[0]).(type) { - case *ast.ArrayType: - switch index { - case 0: - return ast.NewIdent("int") - case 1: - return inferExprType(rhs.Elt) - } - case *ast.MapType: - switch index { - case 0: - return inferExprType(rhs.Key) - case 1: - return inferExprType(rhs.Value) - } - case *ast.Ident: - if rhs.Name == "string" { - switch index { - case 0: - return ast.NewIdent("int") - case 1: - return ast.NewIdent("rune") - } - } - case *ast.ChanType: - if index == 0 { - return inferExprType(rhs.Value) - } - } - } - } - - if len(assign.Lhs) == len(assign.Rhs) { - return inferExprType(assign.Rhs[index]) - } - - return inferAssignMultiType(assign.Rhs[0], index) -} - -func inferAssignMultiType(rhs ast.Expr, index int) ast.Expr { - switch rhs := rhs.(type) { - case *ast.TypeAssertExpr: - switch index { - case 0: - return inferExprType(rhs.Type) - case 1: - return ast.NewIdent("bool") - } - case *ast.CallExpr: - if fun, ok := inferExprType(rhs.Fun).(*ast.FuncType); ok { - for _, res := range fun.Results.List { - for range res.Names { - if index == 0 { - return inferExprType(res.Type) - } - index-- - } - } - } - case *ast.IndexExpr: - if mt, ok := inferExprType(rhs.X).(*ast.MapType); ok { - switch index { - case 0: - return inferExprType(mt.Value) - case 1: - return ast.NewIdent("bool") - } - } - case *ast.UnaryExpr: - if ct, ok := inferExprType(rhs.X).(*ast.ChanType); ok { - switch index { - case 0: - return inferExprType(ct.Value) - case 1: - return ast.NewIdent("bool") - } - } - } - - return nil -} diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go index e8fda9947..0d3fcdb9e 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_checker.go @@ -427,7 +427,7 @@ func (act *action) exportPackageFact(fact analysis.Fact) { // NOTE(ldez) altered: add receiver to handle logs. func (act *action) factType(fact analysis.Fact) reflect.Type { t := reflect.TypeOf(fact) - if t.Kind() != reflect.Ptr { + if t.Kind() != reflect.Pointer { act.runner.log.Fatalf("invalid Fact type: got %T, want pointer", fact) } return t diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go index 9737701d6..e01d3eaa2 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runner_loadingpackage.go @@ -513,7 +513,7 @@ func sizeOfValueTreeBytes(v any) int { func sizeOfReflectValueTreeBytes(rv reflect.Value, visitedPtrs map[uintptr]struct{}) int { switch rv.Kind() { - case reflect.Ptr: + case reflect.Pointer: ptrSize := int(rv.Type().Size()) if rv.IsNil() { return ptrSize diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runners_cache.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runners_cache.go index 7a78700b1..b74d4f94f 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runners_cache.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goanalysis/runners_cache.go @@ -25,7 +25,7 @@ func saveIssuesToCache(allPkgs []*packages.Package, pkgsFromCache map[*packages. perPkgIssues[issue.Pkg] = append(perPkgIssues[issue.Pkg], issue) } - var savedIssuesCount int64 = 0 + var savedIssuesCount int64 lintResKey := getIssuesCacheKey(analyzers) workerCount := runtime.GOMAXPROCS(-1) diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goformat/runner.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goformat/runner.go index 650fb8f5e..ac70dc70a 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goformat/runner.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/goformat/runner.go @@ -97,6 +97,9 @@ func (c *Runner) walk(root string, stdout *os.File) error { return err } + //nolint:gosec // See explanation below. + // `path` contains the `root` but when using `r, err := os.OpenRoot(root)`, this part is not inside the file tree of `r`. + // `filepath.Rel()` can be used but it seems overkill in the context and doesn't work well with a file. in, err := os.Open(path) if err != nil { return err diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/prealloc/prealloc.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/prealloc/prealloc.go index 3dbe3822a..cc209feff 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/prealloc/prealloc.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/prealloc/prealloc.go @@ -14,18 +14,10 @@ func New(settings *config.PreallocSettings) *goanalysis.Linter { Name: "prealloc", Doc: "Find slice declarations that could potentially be pre-allocated", Run: func(pass *analysis.Pass) (any, error) { - runPreAlloc(pass, settings) + pkg.Check(pass, settings.Simple, settings.RangeLoops, settings.ForLoops) return nil, nil }, }). - WithLoadMode(goanalysis.LoadModeSyntax) -} - -func runPreAlloc(pass *analysis.Pass, settings *config.PreallocSettings) { - hints := pkg.Check(pass.Files, settings.Simple, settings.RangeLoops, settings.ForLoops) - - for _, hint := range hints { - pass.Report(hint) - } + WithLoadMode(goanalysis.LoadModeTypesInfo) } diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/revive/revive.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/revive/revive.go index 63d710d32..9dc845371 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/revive/revive.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/golinters/revive/revive.go @@ -272,7 +272,7 @@ func safeTomlSlice(r []any) []any { } // This element is not exported by revive, so we need copy the code. -// Extracted from https://github.com/mgechev/revive/blob/v1.13.0/config/config.go#L16 +// Extracted from https://github.com/mgechev/revive/blob/v1.15.0/config/config.go#L16 var defaultRules = []lint.Rule{ &rule.VarDeclarationsRule{}, &rule.PackageCommentsRule{}, @@ -324,6 +324,7 @@ var allRules = append([]lint.Rule{ &rule.EnforceRepeatedArgTypeStyleRule{}, &rule.EnforceSliceStyleRule{}, &rule.EnforceSwitchStyleRule{}, + &rule.EpochNamingRule{}, &rule.FileHeaderRule{}, &rule.FileLengthLimitRule{}, &rule.FilenameFormatRule{}, @@ -350,6 +351,7 @@ var allRules = append([]lint.Rule{ &rule.NestedStructs{}, &rule.OptimizeOperandsOrderRule{}, &rule.PackageDirectoryMismatchRule{}, + &rule.PackageNamingRule{}, &rule.RangeValAddress{}, &rule.RangeValInClosureRule{}, &rule.RedundantBuildTagRule{}, @@ -374,6 +376,7 @@ var allRules = append([]lint.Rule{ &rule.UseFmtPrintRule{}, &rule.UselessBreak{}, &rule.UselessFallthroughRule{}, + &rule.UseSlicesSort{}, &rule.UseWaitGroupGoRule{}, &rule.WaitGroupByValueRule{}, }, defaultRules...) diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/lint/lintersdb/builder_linter.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/lint/lintersdb/builder_linter.go index 8748047a2..2581bb74e 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/lint/lintersdb/builder_linter.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/lint/lintersdb/builder_linter.go @@ -557,6 +557,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) { linter.NewConfig(prealloc.New(&cfg.Linters.Settings.Prealloc)). WithSince("v1.19.0"). + WithLoadForGoAnalysis(). WithURL("https://github.com/alexkohler/prealloc"), linter.NewConfig(predeclared.New(&cfg.Linters.Settings.Predeclared)). diff --git a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/result/processors/exclusion_rules.go b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/result/processors/exclusion_rules.go index 2b5221a89..2e29600f5 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/result/processors/exclusion_rules.go +++ b/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/result/processors/exclusion_rules.go @@ -32,7 +32,7 @@ func NewExclusionRules(log logutils.Log, lines *fsutils.LineCache, cfg *config.L skippedCounter: map[string]int{}, } - excludeRules := slices.Concat(slices.Clone(cfg.Rules), getLinterExclusionPresets(cfg.Presets)) + excludeRules := slices.Concat(cfg.Rules, getLinterExclusionPresets(cfg.Presets)) p.rules = parseRules(excludeRules, "", newExcludeRule) diff --git a/tools/vendor/github.com/jgautheron/goconst/parser.go b/tools/vendor/github.com/jgautheron/goconst/parser.go index 9505d463e..329cdd3de 100644 --- a/tools/vendor/github.com/jgautheron/goconst/parser.go +++ b/tools/vendor/github.com/jgautheron/goconst/parser.go @@ -881,4 +881,7 @@ const ( Return // Call represents a string passed as an argument to a function call (e.g., f("foo")) Call + // CompositeLit represents a string inside a composite literal + // (e.g., []string{"foo"}, map[string]string{"k": "v"}, MyStruct{Field: "foo"}) + CompositeLit ) diff --git a/tools/vendor/github.com/jgautheron/goconst/visitor.go b/tools/vendor/github.com/jgautheron/goconst/visitor.go index 350e3ae62..da21e7b5f 100644 --- a/tools/vendor/github.com/jgautheron/goconst/visitor.go +++ b/tools/vendor/github.com/jgautheron/goconst/visitor.go @@ -116,11 +116,37 @@ func (v *treeVisitor) Visit(node ast.Node) ast.Visitor { v.addString(lit.Value, lit.Pos(), Call) } } + + // []string{"foo"}, map[string]string{"k": "v"}, struct{A string}{A: "foo"} + case *ast.CompositeLit: + for _, item := range t.Elts { + v.addCompositeLiteralElement(item) + } } return v } +func (v *treeVisitor) addCompositeLiteralElement(node ast.Expr) { + if lit, ok := node.(*ast.BasicLit); ok && v.isSupported(lit.Kind) { + v.addString(lit.Value, lit.Pos(), CompositeLit) + return + } + + kv, ok := node.(*ast.KeyValueExpr) + if !ok { + return + } + + if keyLit, ok := kv.Key.(*ast.BasicLit); ok && v.isSupported(keyLit.Kind) { + v.addString(keyLit.Value, keyLit.Pos(), CompositeLit) + } + + if valueLit, ok := kv.Value.(*ast.BasicLit); ok && v.isSupported(valueLit.Kind) { + v.addString(valueLit.Value, valueLit.Pos(), CompositeLit) + } +} + // addString adds a string in the map along with its position in the tree. func (v *treeVisitor) addString(str string, pos token.Pos, typ Type) { // Early type exclusion check @@ -175,29 +201,21 @@ func (v *treeVisitor) addString(str string, pos token.Pos, typ Type) { // Use interned string to reduce memory usage - identical strings share the same memory internedStr := InternString(unquotedStr) - // Update the count first, this is faster than appending to slices - count := v.p.IncrementStringCount(internedStr) + // Update the count for fast threshold checks in ProcessResults + v.p.IncrementStringCount(internedStr) - // Only continue if we're still adding the position to the map - // or if count has reached threshold - if count == 1 || count == v.p.minOccurrences { - // Lock to safely update the shared map - v.p.stringMutex.Lock() - defer v.p.stringMutex.Unlock() - - _, exists := v.p.strs[internedStr] - if !exists { - v.p.strs[internedStr] = make([]ExtendedPos, 0, v.p.minOccurrences) // Preallocate with expected size - } + // Record every occurrence so that position lists and display counts stay accurate + v.p.stringMutex.Lock() + defer v.p.stringMutex.Unlock() - // Create an optimized position record - newPos := ExtendedPos{ - packageName: InternString(v.packageName), // Intern the package name to reduce memory - Position: v.fileSet.Position(pos), - } - - v.p.strs[internedStr] = append(v.p.strs[internedStr], newPos) + if _, exists := v.p.strs[internedStr]; !exists { + v.p.strs[internedStr] = make([]ExtendedPos, 0, v.p.minOccurrences) } + + v.p.strs[internedStr] = append(v.p.strs[internedStr], ExtendedPos{ + packageName: InternString(v.packageName), + Position: v.fileSet.Position(pos), + }) } // addConst adds a const in the map along with its position in the tree. diff --git a/tools/vendor/github.com/mgechev/revive/config/config.go b/tools/vendor/github.com/mgechev/revive/config/config.go index 1292c45bb..d01f409c5 100644 --- a/tools/vendor/github.com/mgechev/revive/config/config.go +++ b/tools/vendor/github.com/mgechev/revive/config/config.go @@ -1,4 +1,4 @@ -// Package config implements revive's configuration data structures and related methods +// Package config implements revive's configuration data structures and related methods. package config import ( @@ -118,6 +118,7 @@ var allRules = append([]lint.Rule{ &rule.UnnecessaryIfRule{}, &rule.EpochNamingRule{}, &rule.UseSlicesSort{}, + &rule.PackageNamingRule{}, }, defaultRules...) // allFormatters is a list of all available formatters to output the linting results. @@ -204,6 +205,13 @@ func parseConfig(data []byte, config *lint.Config) error { return nil } +func validateConfig(config *lint.Config) error { + if config.EnableAllRules && config.EnableDefaultRules { + return errors.New("config options enableAllRules and enableDefaultRules cannot be combined") + } + return nil +} + func normalizeConfig(config *lint.Config) { if len(config.Rules) == 0 { config.Rules = map[string]lint.RuleConfig{} @@ -262,6 +270,10 @@ func GetConfig(configPath string) (*lint.Config, error) { config = defaultConfig() } + if err := validateConfig(config); err != nil { + return nil, err + } + normalizeConfig(config) return config, nil } diff --git a/tools/vendor/github.com/mgechev/revive/formatter/checkstyle.go b/tools/vendor/github.com/mgechev/revive/formatter/checkstyle.go index 1fb17d4d9..1df1f5573 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/checkstyle.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/checkstyle.go @@ -8,7 +8,7 @@ import ( "github.com/mgechev/revive/lint" ) -// Checkstyle is an implementation of the Formatter interface +// Checkstyle is an implementation of the [lint.Formatter] interface // which formats the errors to Checkstyle-like format. type Checkstyle struct { Metadata lint.FormatterMetadata diff --git a/tools/vendor/github.com/mgechev/revive/formatter/default.go b/tools/vendor/github.com/mgechev/revive/formatter/default.go index ffb9d5f3f..b6a6af223 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/default.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/default.go @@ -7,7 +7,7 @@ import ( "github.com/mgechev/revive/lint" ) -// Default is an implementation of the Formatter interface +// Default is an implementation of the [lint.Formatter] interface // which formats the errors to text. type Default struct { Metadata lint.FormatterMetadata @@ -23,7 +23,10 @@ func (*Default) Format(failures <-chan lint.Failure, _ lint.Config) (string, err var buf bytes.Buffer prefix := "" for failure := range failures { - fmt.Fprintf(&buf, "%s%v: %s", prefix, failure.Position.Start, failure.Failure) + _, err := fmt.Fprintf(&buf, "%s%v: %s", prefix, failure.Position.Start, failure.Failure) + if err != nil { + return "", err + } prefix = "\n" } return buf.String(), nil diff --git a/tools/vendor/github.com/mgechev/revive/formatter/friendly.go b/tools/vendor/github.com/mgechev/revive/formatter/friendly.go index a9f0efa18..cb1afcb3d 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/friendly.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/friendly.go @@ -14,8 +14,8 @@ import ( "github.com/mgechev/revive/lint" ) -// Friendly is an implementation of the Formatter interface -// which formats the errors to JSON. +// Friendly is an implementation of the [lint.Formatter] interface +// which formats the errors to a friendly, human-readable format. type Friendly struct { Metadata lint.FormatterMetadata } @@ -32,9 +32,17 @@ func (f *Friendly) Format(failures <-chan lint.Failure, config lint.Config) (str warningMap := map[string]int{} totalErrors := 0 totalWarnings := 0 + warningEmoji := color.YellowString("⚠") + errorEmoji := color.RedString("✘") for failure := range failures { sev := severity(config, failure) - f.printFriendlyFailure(&buf, failure, sev) + firstCol := warningEmoji + if sev == lint.SeverityError { + firstCol = errorEmoji + } + if err := f.printFriendlyFailure(&buf, firstCol, failure); err != nil { + return "", err + } switch sev { case lint.SeverityWarning: warningMap[failure.RuleName]++ @@ -45,33 +53,38 @@ func (f *Friendly) Format(failures <-chan lint.Failure, config lint.Config) (str } } - f.printSummary(&buf, totalErrors, totalWarnings) - f.printStatistics(&buf, color.RedString("Errors:"), errorMap) - f.printStatistics(&buf, color.YellowString("Warnings:"), warningMap) + emoji := warningEmoji + if totalErrors > 0 { + emoji = errorEmoji + } + if err := f.printSummary(&buf, emoji, totalErrors, totalWarnings); err != nil { + return "", err + } + if err := f.printStatistics(&buf, color.RedString("Errors:"), errorMap); err != nil { + return "", err + } + if err := f.printStatistics(&buf, color.YellowString("Warnings:"), warningMap); err != nil { + return "", err + } return buf.String(), nil } -func (f *Friendly) printFriendlyFailure(sb *strings.Builder, failure lint.Failure, severity lint.Severity) { - f.printHeaderRow(sb, failure, severity) - f.printFilePosition(sb, failure) - sb.WriteString("\n\n") +func (f *Friendly) printFriendlyFailure(sb *strings.Builder, firstColumn string, failure lint.Failure) error { + f.printHeaderRow(sb, firstColumn, failure) + if err := f.printFilePosition(sb, failure); err != nil { + return err + } + _, err := sb.WriteString("\n\n") + return err } -var ( - errorEmoji = color.RedString("✘") - warningEmoji = color.YellowString("⚠") -) - -func (*Friendly) printHeaderRow(sb *strings.Builder, failure lint.Failure, severity lint.Severity) { - emoji := warningEmoji - if severity == lint.SeverityError { - emoji = errorEmoji - } - sb.WriteString(table([][]string{{emoji, ruleDescriptionURL(failure.RuleName), color.GreenString(failure.Failure)}})) +func (*Friendly) printHeaderRow(sb *strings.Builder, firstColumn string, failure lint.Failure) { + sb.WriteString(table([][]string{{firstColumn, ruleDescriptionURL(failure.RuleName), color.GreenString(failure.Failure)}})) } -func (*Friendly) printFilePosition(sb *strings.Builder, failure lint.Failure) { - fmt.Fprintf(sb, " %s:%d:%d", failure.Filename(), failure.Position.Start.Line, failure.Position.Start.Column) +func (*Friendly) printFilePosition(sb *strings.Builder, failure lint.Failure) error { + _, err := fmt.Fprintf(sb, " %s:%d:%d", failure.Filename(), failure.Position.Start.Line, failure.Position.Start.Column) + return err } type statEntry struct { @@ -79,11 +92,7 @@ type statEntry struct { failures int } -func (*Friendly) printSummary(w io.Writer, errors, warnings int) { - emoji := warningEmoji - if errors > 0 { - emoji = errorEmoji - } +func (*Friendly) printSummary(w io.Writer, firstColumn string, errors, warnings int) error { problemsLabel := "problems" if errors+warnings == 1 { problemsLabel = "problem" @@ -98,18 +107,19 @@ func (*Friendly) printSummary(w io.Writer, errors, warnings int) { } str := fmt.Sprintf("%d %s (%d %s, %d %s)", errors+warnings, problemsLabel, errors, errorsLabel, warnings, warningsLabel) if errors > 0 { - fmt.Fprintf(w, "%s %s\n\n", emoji, color.RedString(str)) - return + _, err := fmt.Fprintf(w, "%s %s\n\n", firstColumn, color.RedString(str)) + return err } if warnings > 0 { - fmt.Fprintf(w, "%s %s\n\n", emoji, color.YellowString(str)) - return + _, err := fmt.Fprintf(w, "%s %s\n\n", firstColumn, color.YellowString(str)) + return err } + return nil } -func (*Friendly) printStatistics(w io.Writer, header string, stats map[string]int) { +func (*Friendly) printStatistics(w io.Writer, header string, stats map[string]int) error { if len(stats) == 0 { - return + return nil } data := make([]statEntry, 0, len(stats)) for name, total := range stats { @@ -122,8 +132,13 @@ func (*Friendly) printStatistics(w io.Writer, header string, stats map[string]in for _, entry := range data { formatted = append(formatted, []string{color.GreenString(fmt.Sprintf("%d", entry.failures)), entry.name}) } - fmt.Fprintln(w, header) - fmt.Fprintln(w, table(formatted)) + if _, err := fmt.Fprintln(w, header); err != nil { + return err + } + if _, err := fmt.Fprintln(w, table(formatted)); err != nil { + return err + } + return nil } func table(rows [][]string) string { diff --git a/tools/vendor/github.com/mgechev/revive/formatter/json.go b/tools/vendor/github.com/mgechev/revive/formatter/json.go index 7c081f374..46a61980c 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/json.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/json.go @@ -6,7 +6,7 @@ import ( "github.com/mgechev/revive/lint" ) -// JSON is an implementation of the Formatter interface +// JSON is an implementation of the [lint.Formatter] interface // which formats the errors to JSON. type JSON struct { Metadata lint.FormatterMetadata diff --git a/tools/vendor/github.com/mgechev/revive/formatter/ndjson.go b/tools/vendor/github.com/mgechev/revive/formatter/ndjson.go index 66acff320..f80b5bcbc 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/ndjson.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/ndjson.go @@ -7,7 +7,7 @@ import ( "github.com/mgechev/revive/lint" ) -// NDJSON is an implementation of the Formatter interface +// NDJSON is an implementation of the [lint.Formatter] interface // which formats the errors to NDJSON stream. type NDJSON struct { Metadata lint.FormatterMetadata diff --git a/tools/vendor/github.com/mgechev/revive/formatter/plain.go b/tools/vendor/github.com/mgechev/revive/formatter/plain.go index 6c77926ea..80dede3a1 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/plain.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/plain.go @@ -7,8 +7,8 @@ import ( "github.com/mgechev/revive/lint" ) -// Plain is an implementation of the Formatter interface -// which formats the errors to JSON. +// Plain is an implementation of the [lint.Formatter] interface +// which formats the errors to plain text. type Plain struct { Metadata lint.FormatterMetadata } @@ -22,7 +22,10 @@ func (*Plain) Name() string { func (*Plain) Format(failures <-chan lint.Failure, _ lint.Config) (string, error) { var sb strings.Builder for failure := range failures { - sb.WriteString(fmt.Sprintf("%v: %s %s\n", failure.Position.Start, failure.Failure, ruleDescriptionURL(failure.RuleName))) + _, err := fmt.Fprintf(&sb, "%v: %s %s\n", failure.Position.Start, failure.Failure, ruleDescriptionURL(failure.RuleName)) + if err != nil { + return "", err + } } return sb.String(), nil } diff --git a/tools/vendor/github.com/mgechev/revive/formatter/sarif.go b/tools/vendor/github.com/mgechev/revive/formatter/sarif.go index 03069bb4a..cb1a97294 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/sarif.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/sarif.go @@ -10,7 +10,7 @@ import ( "github.com/mgechev/revive/lint" ) -// Sarif is an implementation of the Formatter interface +// Sarif is an implementation of the [lint.Formatter] interface // which formats revive failures into SARIF format. type Sarif struct { Metadata lint.FormatterMetadata diff --git a/tools/vendor/github.com/mgechev/revive/formatter/stylish.go b/tools/vendor/github.com/mgechev/revive/formatter/stylish.go index 573e5b0ac..100a7927b 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/stylish.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/stylish.go @@ -9,12 +9,14 @@ import ( "github.com/mgechev/revive/lint" ) -// Stylish is an implementation of the Formatter interface -// which formats the errors to JSON. +// Stylish is an implementation of the [lint.Formatter] interface +// which formats the errors to a stylish, human-readable format. type Stylish struct { Metadata lint.FormatterMetadata } +var _ lint.Formatter = (*Stylish)(nil) + // Name returns the name of the formatter. func (*Stylish) Name() string { return "stylish" diff --git a/tools/vendor/github.com/mgechev/revive/formatter/unix.go b/tools/vendor/github.com/mgechev/revive/formatter/unix.go index dd063a0d8..b79566859 100644 --- a/tools/vendor/github.com/mgechev/revive/formatter/unix.go +++ b/tools/vendor/github.com/mgechev/revive/formatter/unix.go @@ -7,8 +7,8 @@ import ( "github.com/mgechev/revive/lint" ) -// Unix is an implementation of the Formatter interface -// which formats the errors to a simple line based error format +// Unix is an implementation of the [lint.Formatter] interface +// which formats the errors to a simple line based error format: // // main.go:24:9: [errorf] should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) type Unix struct { @@ -24,7 +24,10 @@ func (*Unix) Name() string { func (*Unix) Format(failures <-chan lint.Failure, _ lint.Config) (string, error) { var sb strings.Builder for failure := range failures { - sb.WriteString(fmt.Sprintf("%v: [%s] %s\n", failure.Position.Start, failure.RuleName, failure.Failure)) + _, err := fmt.Fprintf(&sb, "%v: [%s] %s\n", failure.Position.Start, failure.RuleName, failure.Failure) + if err != nil { + return "", err + } } return sb.String(), nil } diff --git a/tools/vendor/github.com/mgechev/revive/internal/astutils/ast_utils.go b/tools/vendor/github.com/mgechev/revive/internal/astutils/ast_utils.go index 597742040..b0fbc5a0d 100644 --- a/tools/vendor/github.com/mgechev/revive/internal/astutils/ast_utils.go +++ b/tools/vendor/github.com/mgechev/revive/internal/astutils/ast_utils.go @@ -1,4 +1,4 @@ -// Package astutils provides utility functions for working with AST nodes +// Package astutils provides utility functions for working with AST nodes. package astutils import ( @@ -16,8 +16,13 @@ import ( // FuncSignatureIs returns true if the given func decl satisfies a signature characterized // by the given name, parameters types and return types; false otherwise. // -// Example: to check if a function declaration has the signature Foo(int, string) (bool,error) -// call to FuncSignatureIs(funcDecl,"Foo",[]string{"int","string"},[]string{"bool","error"}). +// Example: To check if a function declaration has the signature +// +// Foo(int, string) (bool, error) +// +// call to +// +// FuncSignatureIs(funcDecl, "Foo", []string{"int", "string"}, []string{"bool", "error"}) func FuncSignatureIs(funcDecl *ast.FuncDecl, wantName string, wantParametersTypes, wantResultsTypes []string) bool { if wantName != funcDecl.Name.String() { return false // func name doesn't match expected one diff --git a/tools/vendor/github.com/mgechev/revive/internal/ifelse/doc.go b/tools/vendor/github.com/mgechev/revive/internal/ifelse/doc.go index 7461b12aa..77d93cd00 100644 --- a/tools/vendor/github.com/mgechev/revive/internal/ifelse/doc.go +++ b/tools/vendor/github.com/mgechev/revive/internal/ifelse/doc.go @@ -1,6 +1,6 @@ // Package ifelse provides helpers for analyzing the control flow in if-else chains, // presently used by the following rules: -// - early-return -// - indent-error-flow -// - superfluous-else +// - early-return +// - indent-error-flow +// - superfluous-else package ifelse diff --git a/tools/vendor/github.com/mgechev/revive/internal/ifelse/func.go b/tools/vendor/github.com/mgechev/revive/internal/ifelse/func.go index 89e251129..cd27cc592 100644 --- a/tools/vendor/github.com/mgechev/revive/internal/ifelse/func.go +++ b/tools/vendor/github.com/mgechev/revive/internal/ifelse/func.go @@ -23,7 +23,7 @@ var DeviatingFuncs = map[Call]BranchKind{ {"log", "Panicln"}: Panic, } -// ExprCall gets the Call of an ExprStmt, if any. +// ExprCall gets the [Call] of an [ast.ExprStmt], if any. func ExprCall(expr *ast.ExprStmt) (Call, bool) { call, ok := expr.X.(*ast.CallExpr) if !ok { diff --git a/tools/vendor/github.com/mgechev/revive/internal/ifelse/rule.go b/tools/vendor/github.com/mgechev/revive/internal/ifelse/rule.go index 799f8b83d..347487661 100644 --- a/tools/vendor/github.com/mgechev/revive/internal/ifelse/rule.go +++ b/tools/vendor/github.com/mgechev/revive/internal/ifelse/rule.go @@ -15,7 +15,7 @@ type CheckFunc func(Chain) (string, bool) // Apply evaluates the given Rule on if-else chains found within the given AST, // and returns the failures. // -// Note that in if-else chain with multiple "if" blocks, only the *last* one is checked, +// Note that in if-else chain with multiple "if" blocks, only the "last" one is checked, // that is to say, given: // // if foo { diff --git a/tools/vendor/github.com/mgechev/revive/internal/syncset/syncset.go b/tools/vendor/github.com/mgechev/revive/internal/syncset/syncset.go new file mode 100644 index 000000000..8f20e91ca --- /dev/null +++ b/tools/vendor/github.com/mgechev/revive/internal/syncset/syncset.go @@ -0,0 +1,44 @@ +// Package syncset provides a simple, mutex-protected set for strings. +package syncset + +import ( + "maps" + "slices" + "sync" +) + +// Set is a concurrency-safe set of strings. +type Set struct { + mu sync.Mutex + elements map[string]struct{} +} + +// New returns an initialized, empty Set. +func New() *Set { + return &Set{elements: map[string]struct{}{}} +} + +// AddIfAbsent adds str to the set if it is not already present, and reports whether it was added. +func (s *Set) AddIfAbsent(str string) bool { + s.mu.Lock() + defer s.mu.Unlock() + + if s.elements == nil { + s.elements = map[string]struct{}{str: {}} + return true + } + + _, exists := s.elements[str] + if !exists { + s.elements[str] = struct{}{} + } + return !exists +} + +// Elements returns a slice of all elements in the set. +func (s *Set) Elements() []string { + s.mu.Lock() + defer s.mu.Unlock() + + return slices.Collect(maps.Keys(s.elements)) +} diff --git a/tools/vendor/github.com/mgechev/revive/lint/config.go b/tools/vendor/github.com/mgechev/revive/lint/config.go index 3047fd29d..533ce054c 100644 --- a/tools/vendor/github.com/mgechev/revive/lint/config.go +++ b/tools/vendor/github.com/mgechev/revive/lint/config.go @@ -15,9 +15,9 @@ type RuleConfig struct { Arguments Arguments Severity Severity Disabled bool - // Exclude - rule-level file excludes, TOML related (strings) + // Exclude is rule-level file excludes, TOML related (strings). Exclude []string - // excludeFilters - regex-based file filters, initialized from Exclude + // excludeFilters is regex-based file filters, initialized from Exclude. excludeFilters []*FileFilter } diff --git a/tools/vendor/github.com/mgechev/revive/lint/failure.go b/tools/vendor/github.com/mgechev/revive/lint/failure.go index c25df4836..01ed09115 100644 --- a/tools/vendor/github.com/mgechev/revive/lint/failure.go +++ b/tools/vendor/github.com/mgechev/revive/lint/failure.go @@ -72,19 +72,18 @@ type FailurePosition struct { // Failure defines a struct for a linting failure. type Failure struct { - Failure string `json:"Failure"` - RuleName string `json:"RuleName"` - Category FailureCategory `json:"Category"` - Position FailurePosition `json:"Position"` - Node ast.Node `json:"-"` - Confidence float64 `json:"Confidence"` - // For future use - ReplacementLine string `json:"ReplacementLine"` + Failure string `json:"Failure"` + RuleName string `json:"RuleName"` + Category FailureCategory `json:"Category"` + Position FailurePosition `json:"Position"` + Node ast.Node `json:"-"` + Confidence float64 `json:"Confidence"` + ReplacementLine string `json:"ReplacementLine"` } // GetFilename returns the filename. // -// Deprecated: Use [Filename]. +// Deprecated: Use [Failure.Filename] instead. func (f *Failure) GetFilename() string { return f.Filename() } diff --git a/tools/vendor/github.com/mgechev/revive/logging/logger.go b/tools/vendor/github.com/mgechev/revive/logging/logger.go index 2b4726de6..12fef0160 100644 --- a/tools/vendor/github.com/mgechev/revive/logging/logger.go +++ b/tools/vendor/github.com/mgechev/revive/logging/logger.go @@ -5,45 +5,46 @@ import ( "io" "log/slog" "os" + "sync" + "testing" ) -const logFile = "revive.log" - -var ( - logger *slog.Logger - loggerFile *os.File -) - -// GetLogger retrieves an instance of an application logger which outputs -// to a file if the debug flag is enabled. +// GetLogger retrieves an instance of an application logger. +// The log level can be configured via the REVIVE_LOG_LEVEL environment variable. +// If REVIVE_LOG_LEVEL is unset or empty, logging is disabled. +// If it is set to an invalid value, the log level defaults to WARN. +// +//nolint:unparam // err is always nil, but is included in the signature for future extensibility. func GetLogger() (*slog.Logger, error) { - if logger != nil { - return logger, nil - } + return getLogger(), nil +} - debugModeEnabled := os.Getenv("DEBUG") != "" - if !debugModeEnabled { - // by default, suppress all logging output - return slog.New(slog.DiscardHandler), nil - } +var getLogger = sync.OnceValue(initLogger(os.Stderr)) - var err error - loggerFile, err = os.Create(logFile) - if err != nil { - return nil, err - } +func initLogger(out io.Writer) func() *slog.Logger { + return func() *slog.Logger { + logLevel := os.Getenv("REVIVE_LOG_LEVEL") + if logLevel == "" { + return slog.New(slog.DiscardHandler) + } - logger = slog.New(slog.NewTextHandler(io.MultiWriter(os.Stderr, loggerFile), nil)) + leveler := &slog.LevelVar{} + opts := &slog.HandlerOptions{Level: leveler} - logger.Info("Logger initialized", "logFile", logFile) + level := slog.LevelWarn + _ = level.UnmarshalText([]byte(logLevel)) // Ignore error and default to WARN if invalid + leveler.Set(level) + logger := slog.New(slog.NewTextHandler(out, opts)) - return logger, nil -} + logger.Info("Logger initialized", "logLevel", logLevel) -// Close closes the logger file if it was opened. -func Close() error { - if loggerFile == nil { - return nil + return logger } - return loggerFile.Close() +} + +// InitForTesting initializes the logger singleton cache for testing purposes. +// This function should only be called in tests. +func InitForTesting(tb testing.TB, out io.Writer) { + tb.Helper() + getLogger = sync.OnceValue(initLogger(out)) } diff --git a/tools/vendor/github.com/mgechev/revive/rule/bool_literal_in_expr.go b/tools/vendor/github.com/mgechev/revive/rule/bool_literal_in_expr.go index ee713ae96..f6c8cbc61 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/bool_literal_in_expr.go +++ b/tools/vendor/github.com/mgechev/revive/rule/bool_literal_in_expr.go @@ -7,7 +7,7 @@ import ( "github.com/mgechev/revive/lint" ) -// BoolLiteralRule warns when logic expressions contains Boolean literals. +// BoolLiteralRule warns when logic expressions contain boolean literals. type BoolLiteralRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/comment_spacings.go b/tools/vendor/github.com/mgechev/revive/rule/comment_spacings.go index 0c35fe392..d28bce04f 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/comment_spacings.go +++ b/tools/vendor/github.com/mgechev/revive/rule/comment_spacings.go @@ -7,8 +7,8 @@ import ( "github.com/mgechev/revive/lint" ) -// CommentSpacingsRule check whether there is a space between -// the comment symbol( // ) and the start of the comment text. +// CommentSpacingsRule checks whether there is a space between +// the comment symbol // and the start of the comment text. type CommentSpacingsRule struct { allowList []string } diff --git a/tools/vendor/github.com/mgechev/revive/rule/context_as_argument.go b/tools/vendor/github.com/mgechev/revive/rule/context_as_argument.go index 5a3e2cf69..588bbabf0 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/context_as_argument.go +++ b/tools/vendor/github.com/mgechev/revive/rule/context_as_argument.go @@ -9,7 +9,7 @@ import ( "github.com/mgechev/revive/lint" ) -// ContextAsArgumentRule suggests that `context.Context` should be the first argument of a function. +// ContextAsArgumentRule suggests that [context.Context] should be the first argument of a function. type ContextAsArgumentRule struct { allowTypes map[string]struct{} } diff --git a/tools/vendor/github.com/mgechev/revive/rule/context_keys_type.go b/tools/vendor/github.com/mgechev/revive/rule/context_keys_type.go index 562f31b22..98f631ee9 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/context_keys_type.go +++ b/tools/vendor/github.com/mgechev/revive/rule/context_keys_type.go @@ -9,7 +9,7 @@ import ( "github.com/mgechev/revive/lint" ) -// ContextKeysType disallows the usage of basic types in `context.WithValue`. +// ContextKeysType disallows the usage of basic types in [context.WithValue]. type ContextKeysType struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/datarace.go b/tools/vendor/github.com/mgechev/revive/rule/datarace.go index de63c068d..fd2dcdf2b 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/datarace.go +++ b/tools/vendor/github.com/mgechev/revive/rule/datarace.go @@ -11,7 +11,8 @@ import ( //nolint:staticcheck // TODO: ast.Object is deprecated type nodeUID *ast.Object // type of the unique id for AST nodes -// DataRaceRule lints assignments to value method-receivers. +// DataRaceRule spots potential dataraces caused by goroutines capturing (by-reference) +// particular identifiers of the function from which goroutines are created. type DataRaceRule struct{} // Apply applies the rule to given file. @@ -65,7 +66,6 @@ func (*DataRaceRule) extractReturnIDs(fields []*ast.Field) map[nodeUID]struct{} } type lintFunctionForDataRaces struct { - _ struct{} onFailure func(failure lint.Failure) returnIDs map[nodeUID]struct{} rangeIDs map[nodeUID]struct{} diff --git a/tools/vendor/github.com/mgechev/revive/rule/deep_exit.go b/tools/vendor/github.com/mgechev/revive/rule/deep_exit.go index ed3e34b53..c1042a6aa 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/deep_exit.go +++ b/tools/vendor/github.com/mgechev/revive/rule/deep_exit.go @@ -11,7 +11,7 @@ import ( "github.com/mgechev/revive/lint" ) -// DeepExitRule lints program exit at functions other than main or init. +// DeepExitRule lints program exit in functions other than main or init. type DeepExitRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/dot_imports.go b/tools/vendor/github.com/mgechev/revive/rule/dot_imports.go index a5f2210c5..5252e716a 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/dot_imports.go +++ b/tools/vendor/github.com/mgechev/revive/rule/dot_imports.go @@ -8,7 +8,7 @@ import ( "github.com/mgechev/revive/lint" ) -// DotImportsRule forbids . imports. +// DotImportsRule forbids dot imports. type DotImportsRule struct { allowedPackages allowPackages } diff --git a/tools/vendor/github.com/mgechev/revive/rule/early_return.go b/tools/vendor/github.com/mgechev/revive/rule/early_return.go index 2c2b67f4d..7b158ccf1 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/early_return.go +++ b/tools/vendor/github.com/mgechev/revive/rule/early_return.go @@ -18,6 +18,8 @@ type EarlyReturnRule struct { allowJump bool } +var _ lint.ConfigurableRule = (*EarlyReturnRule)(nil) + // Configure validates the rule configuration, and configures the rule accordingly. // // Configuration implements the [lint.ConfigurableRule] interface. diff --git a/tools/vendor/github.com/mgechev/revive/rule/exported.go b/tools/vendor/github.com/mgechev/revive/rule/exported.go index ccc73162e..9d8ace8e5 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/exported.go +++ b/tools/vendor/github.com/mgechev/revive/rule/exported.go @@ -408,8 +408,8 @@ func (w *lintExported) checkGoDocStatus(comment *ast.CommentGroup, name string) } // firstCommentLine yields the first line of interest in comment group or "" if there is nothing of interest. -// An "interesting line" is a comment line that is neither a directive (e.g. //go:...) or a deprecation comment -// (lines from the first line with a prefix // Deprecated: to the end of the comment group) +// An "interesting line" is a comment line that is neither a directive (e.g. `//go:...`) or a deprecation comment +// (lines from the first line with a prefix `// Deprecated:` to the end of the comment group). // Empty or spaces-only lines are discarded. func (*lintExported) firstCommentLine(comment *ast.CommentGroup) (result string) { if comment == nil { diff --git a/tools/vendor/github.com/mgechev/revive/rule/filename_format.go b/tools/vendor/github.com/mgechev/revive/rule/filename_format.go index faa24b614..960ebb0c8 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/filename_format.go +++ b/tools/vendor/github.com/mgechev/revive/rule/filename_format.go @@ -38,7 +38,7 @@ func (*FilenameFormatRule) getMsgForNonASCIIChars(str string) string { continue } - result.WriteString(fmt.Sprintf(" Non ASCII character %c (%U) found.", c, c)) + fmt.Fprintf(&result, " Non ASCII character %c (%U) found.", c, c) } return result.String() diff --git a/tools/vendor/github.com/mgechev/revive/rule/forbidden_call_in_wg_go.go b/tools/vendor/github.com/mgechev/revive/rule/forbidden_call_in_wg_go.go index 63088e554..20a393621 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/forbidden_call_in_wg_go.go +++ b/tools/vendor/github.com/mgechev/revive/rule/forbidden_call_in_wg_go.go @@ -9,7 +9,7 @@ import ( "github.com/mgechev/revive/lint" ) -// ForbiddenCallInWgGoRule spots calls to panic or wg.Done when using WaitGroup.Go. +// ForbiddenCallInWgGoRule spots calls to panic or wg.Done when using [sync.WaitGroup.Go]. type ForbiddenCallInWgGoRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/increment_decrement.go b/tools/vendor/github.com/mgechev/revive/rule/increment_decrement.go index d8cebcf25..538bd9314 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/increment_decrement.go +++ b/tools/vendor/github.com/mgechev/revive/rule/increment_decrement.go @@ -8,7 +8,7 @@ import ( "github.com/mgechev/revive/lint" ) -// IncrementDecrementRule lints `i += 1` and `i -= 1` constructs. +// IncrementDecrementRule suggests replacing `i += 1` and `i -= 1` with `i++` and `i--`. type IncrementDecrementRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/indent_error_flow.go b/tools/vendor/github.com/mgechev/revive/rule/indent_error_flow.go index be4734bad..f900d8e22 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/indent_error_flow.go +++ b/tools/vendor/github.com/mgechev/revive/rule/indent_error_flow.go @@ -11,6 +11,8 @@ type IndentErrorFlowRule struct { preserveScope bool } +var _ lint.ConfigurableRule = (*IndentErrorFlowRule)(nil) + // Configure validates the rule configuration, and configures the rule accordingly. // // Configuration implements the [lint.ConfigurableRule] interface. diff --git a/tools/vendor/github.com/mgechev/revive/rule/line_length_limit.go b/tools/vendor/github.com/mgechev/revive/rule/line_length_limit.go index 5d0653975..f2c9a1467 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/line_length_limit.go +++ b/tools/vendor/github.com/mgechev/revive/rule/line_length_limit.go @@ -12,7 +12,7 @@ import ( "github.com/mgechev/revive/lint" ) -// LineLengthLimitRule lints number of characters in a line. +// LineLengthLimitRule lints the number of characters in a line. type LineLengthLimitRule struct { max int } diff --git a/tools/vendor/github.com/mgechev/revive/rule/package_naming.go b/tools/vendor/github.com/mgechev/revive/rule/package_naming.go new file mode 100644 index 000000000..642b16a13 --- /dev/null +++ b/tools/vendor/github.com/mgechev/revive/rule/package_naming.go @@ -0,0 +1,315 @@ +package rule + +import ( + "errors" + "fmt" + "go/ast" + "path/filepath" + "regexp" + "strings" + + gopackages "golang.org/x/tools/go/packages" + + "github.com/mgechev/revive/internal/syncset" + "github.com/mgechev/revive/lint" +) + +// defaultBadNames is the list of "bad" package names from https://go.dev/blog/package-names#bad-package-names. +var defaultBadNames = map[string]struct{}{ + "common": {}, + "interface": {}, + "interfaces": {}, + "misc": {}, + "type": {}, + "types": {}, + "util": {}, + "utils": {}, +} + +// extraBadNames is the list of additional "bad" package names that are not recommended. +var extraBadNames = map[string]struct{}{ + "api": {}, + "helpers": {}, + "miscellaneous": {}, + "models": {}, + "shared": {}, + "utilities": {}, +} + +// commonStdNames is the list of standard library package names that are commonly used in Go programs. +// This list is based on the most popular standard library packages according to importedby tab in pkg.go.dev. +// For example, "http" imported by 1,705,800 times https://pkg.go.dev/net/http?tab=importedby +var commonStdNames = map[string]string{ + "bytes": "bytes", + "bufio": "bufio", + "flag": "flag", + "context": "context", + "errors": "errors", + "filepath": "path/filepath", + "fmt": "fmt", + "http": "net/http", + "io": "io", + "ioutil": "io/ioutil", + "json": "encoding/json", + "log": "log", + "math": "math", + "net": "net", + "os": "os", + "strconv": "strconv", + "reflect": "reflect", + "regexp": "regexp", + "runtime": "runtime", + "sort": "sort", + "strings": "strings", + "sync": "sync", + "time": "time", + "url": "net/url", +} + +// nonPublicPackageSegments are package path segments that indicate the std package is not public. +var nonPublicPackageSegments = map[string]struct{}{ + "internal": {}, + "vendor": {}, +} + +// forbiddenTopLevelNames is the set of forbidden top level package names. +var forbiddenTopLevelNames = map[string]struct{}{ + "pkg": {}, +} + +// PackageNamingRule is a rule that checks package names. +type PackageNamingRule struct { + skipConventionNameCheck bool // if true - skip checks for package name conventions (e.g., no underscores, no MixedCaps etc.) + conventionNameCheckRegex *regexp.Regexp // the regex used to check package name conventions + + skipTopLevelCheck bool // if true - skip checks for top level package names (e.g., "pkg") + + skipDefaultBadNameCheck bool // if true - skip checks for default bad package names (e.g., "util", "misc" etc.) + checkExtraBadName bool // if true - enable check for extra bad package names (e.g., "helpers", "models" etc.) + userDefinedBadNames map[string]struct{} // set of user defined bad package names + + skipCollisionWithCommonStd bool // if true - skip checks for collisions with common Go standard library package names (e.g., "http", "json", "rand" etc.) + + checkCollisionWithAllStd bool // if true - enable checks for collisions with all Go standard library package names (including "version", "metrics" etc.) + // allStdNames holds name -> path of standard library packages excluding internal and vendor. + // Populated only if checkCollisionWithAllStd is true. `net/http` stored as `http`, `math/rand/v2` as `rand` etc. + allStdNames map[string]string + + // alreadyCheckedNames is keyed by fileDir (package directory path) to track which package directories + // have already been checked and avoid duplicate checks across files in the same package. + alreadyCheckedNames *syncset.Set +} + +// Configure validates the rule configuration, and configures the rule accordingly. +// +// Configuration implements the [lint.ConfigurableRule] interface. +func (r *PackageNamingRule) Configure(arguments lint.Arguments) error { + r.alreadyCheckedNames = syncset.New() + + if len(arguments) == 0 { + return nil + } + + if len(arguments) > 1 { + return fmt.Errorf("invalid arguments to the package-naming rule: expected at most 1 argument, but got %d", len(arguments)) + } + + args, ok := arguments[0].(map[string]any) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting a k,v map, but got %T", arguments[0]) + } + + for k, v := range args { + switch { + case isRuleOption(k, "skipConventionNameCheck"): + r.skipConventionNameCheck, ok = v.(bool) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting skipConventionNameCheck to be a boolean, but got %T", v) + } + case isRuleOption(k, "conventionNameCheckRegex"): + regexStr, ok := v.(string) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting conventionNameCheckRegex to be a string, but got %T", v) + } + if regexStr == "" { + return errors.New("invalid argument to the package-naming rule: conventionNameCheckRegex cannot be an empty string") + } + regex, err := regexp.Compile(regexStr) + if err != nil { + return fmt.Errorf("invalid argument to the package-naming rule: invalid regex for conventionNameCheckRegex: %w", err) + } + r.conventionNameCheckRegex = regex + case isRuleOption(k, "skipTopLevelCheck"): + r.skipTopLevelCheck, ok = v.(bool) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting skipTopLevelCheck to be a boolean, but got %T", v) + } + case isRuleOption(k, "skipDefaultBadNameCheck"): + r.skipDefaultBadNameCheck, ok = v.(bool) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting skipDefaultBadNameCheck to be a boolean, but got %T", v) + } + case isRuleOption(k, "checkExtraBadName"): + r.checkExtraBadName, ok = v.(bool) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting checkExtraBadName to be a boolean, but got %T", v) + } + case isRuleOption(k, "userDefinedBadNames"): + userDefinedBadNames, ok := v.([]any) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting userDefinedBadNames of type slice of strings, but got %T", v) + } + for i, name := range userDefinedBadNames { + if r.userDefinedBadNames == nil { + r.userDefinedBadNames = map[string]struct{}{} + } + n, ok := name.(string) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting element %d of userDefinedBadNames to be a string, but got %v(%T)", i, name, name) + } + if n == "" { + return fmt.Errorf("invalid argument to the package-naming rule: userDefinedBadNames cannot contain empty string (index %d)", i) + } + r.userDefinedBadNames[strings.ToLower(n)] = struct{}{} + } + case isRuleOption(k, "skipCollisionWithCommonStd"): + r.skipCollisionWithCommonStd, ok = v.(bool) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting skipCollisionWithCommonStd to be a boolean, but got %T", v) + } + case isRuleOption(k, "checkCollisionWithAllStd"): + r.checkCollisionWithAllStd, ok = v.(bool) + if !ok { + return fmt.Errorf("invalid argument to the package-naming rule: expecting checkCollisionWithAllStd to be a boolean, but got %T", v) + } + } + } + + if r.skipConventionNameCheck && r.conventionNameCheckRegex != nil { + return errors.New("invalid configuration for package-naming rule: skipConventionNameCheck and conventionNameCheckRegex cannot be both set") + } + + if r.skipCollisionWithCommonStd && r.checkCollisionWithAllStd { + return errors.New("invalid configuration for package-naming rule: skipCollisionWithCommonStd and checkCollisionWithAllStd cannot be both set") + } + + if r.checkCollisionWithAllStd && r.allStdNames == nil { + pkgs, err := gopackages.Load(nil, "std") + if err != nil { + return fmt.Errorf("load std packages: %w", err) + } + + r.allStdNames = map[string]string{} + for _, pkg := range pkgs { + if isNonPublicPackage(pkg.PkgPath) { + continue + } + if existingPath, ok := r.allStdNames[pkg.Name]; !ok || pkg.PkgPath < existingPath { + r.allStdNames[pkg.Name] = pkg.PkgPath + } + } + } + + return nil +} + +// isNonPublicPackage reports whether the path represents an internal or vendor directory. +func isNonPublicPackage(path string) bool { + for p := range strings.SplitSeq(path, "/") { + if _, ok := nonPublicPackageSegments[p]; ok { + return true + } + } + return false +} + +// Apply applies the rule to given file. +func (r *PackageNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure { + var failures []lint.Failure + onFailure := func(failure lint.Failure) { + failures = append(failures, failure) + } + + fileDir := filepath.Dir(file.Name) + + if !r.alreadyCheckedNames.AddIfAbsent(fileDir) { + return failures + } + + node := file.AST.Name + pkgName := node.Name + pkgNameWithoutTestSuffix := strings.TrimSuffix(pkgName, "_test") + + if r.conventionNameCheckRegex != nil { + if !r.conventionNameCheckRegex.MatchString(pkgNameWithoutTestSuffix) { + onFailure(r.pkgNameFailure(node, "package name %q doesn't match the convention defined by conventionNameCheckRegex", pkgName)) + return failures + } + } else if !r.skipConventionNameCheck { + // Package names need slightly different handling than other names. + if strings.Contains(pkgNameWithoutTestSuffix, "_") { + onFailure(r.pkgNameFailure(node, "don't use package name %q that contains an underscore", pkgName)) + return failures + } + if hasUpperCaseLetter(pkgNameWithoutTestSuffix) { + onFailure(r.pkgNameFailure(node, "don't use package name %q that contains MixedCaps", pkgName)) + return failures + } + } + + pkgNameLower := strings.ToLower(pkgName) + if !r.skipTopLevelCheck { + if _, ok := forbiddenTopLevelNames[pkgNameLower]; ok && filepath.Base(fileDir) != pkgName { + onFailure(r.pkgNameFailure(node, "don't use %q as a root level package name", pkgName)) + return failures + } + } + + if !r.skipDefaultBadNameCheck { + if _, ok := defaultBadNames[pkgNameLower]; ok { + onFailure(r.pkgNameFailure(node, "don't use %q because it is a bad package name according to https://go.dev/blog/package-names#bad-package-names", pkgName)) + return failures + } + } + + if r.checkExtraBadName { + if _, ok := extraBadNames[pkgNameLower]; ok { + onFailure(r.pkgNameFailure(node, "don't use %q because it is a bad package name (extra)", pkgName)) + return failures + } + } + + if r.userDefinedBadNames != nil { + if _, ok := r.userDefinedBadNames[pkgNameLower]; ok { + onFailure(r.pkgNameFailure(node, "don't use %q because it is a bad package name (user-defined)", pkgName)) + return failures + } + } + + if r.checkCollisionWithAllStd { + // all std names are also common std names, so no need to check separately + if std, ok := r.allStdNames[pkgNameLower]; ok { + onFailure(r.pkgNameFailure(node, "don't use %q because it conflicts with Go standard library package %q", pkgName, std)) + } + } else if !r.skipCollisionWithCommonStd { + if std, ok := commonStdNames[pkgNameLower]; ok { + onFailure(r.pkgNameFailure(node, "don't use %q because it conflicts with common Go standard library package %q", pkgName, std)) + } + } + + return failures +} + +// Name returns the rule name. +func (*PackageNamingRule) Name() string { + return "package-naming" +} + +func (*PackageNamingRule) pkgNameFailure(node ast.Node, msg string, args ...any) lint.Failure { + return lint.Failure{ + Failure: fmt.Sprintf(msg, args...), + Confidence: 1, + Node: node, + Category: lint.FailureCategoryNaming, + } +} diff --git a/tools/vendor/github.com/mgechev/revive/rule/redundant_test_main_exit.go b/tools/vendor/github.com/mgechev/revive/rule/redundant_test_main_exit.go index cd1da59aa..04e643e5f 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/redundant_test_main_exit.go +++ b/tools/vendor/github.com/mgechev/revive/rule/redundant_test_main_exit.go @@ -7,7 +7,7 @@ import ( "github.com/mgechev/revive/lint" ) -// RedundantTestMainExitRule suggests removing Exit call in TestMain function for test files. +// RedundantTestMainExitRule suggests removing redundant [os.Exit] or [syscall.Exit] calls in TestMain function. type RedundantTestMainExitRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/string_format.go b/tools/vendor/github.com/mgechev/revive/rule/string_format.go index 4c7c86554..0cf05e37a 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/string_format.go +++ b/tools/vendor/github.com/mgechev/revive/rule/string_format.go @@ -11,7 +11,7 @@ import ( "github.com/mgechev/revive/lint" ) -// StringFormatRule lints strings and/or comments according to a set of regular expressions given as Arguments. +// StringFormatRule lints strings and/or comments according to a set of regular expressions given as arguments. type StringFormatRule struct { rules []stringFormatSubrule } @@ -87,6 +87,7 @@ const identRegex = "[_A-Za-z][_A-Za-z0-9]*" var parseStringFormatScope = regexp.MustCompile( fmt.Sprintf("^(%s(?:\\.%s)?)(?:\\[([0-9]+)\\](?:\\.(%s))?)?$", identRegex, identRegex, identRegex)) +//revive:disable-next-line:function-result-limit func (r *StringFormatRule) parseArgument(argument any, ruleNum int) (scopes stringFormatSubruleScopes, regex *regexp.Regexp, negated bool, errorMessage string, err error) { g, ok := argument.([]any) // Cast to generic slice first if !ok { diff --git a/tools/vendor/github.com/mgechev/revive/rule/string_of_int.go b/tools/vendor/github.com/mgechev/revive/rule/string_of_int.go index 3bec1d6ac..839d0dfd5 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/string_of_int.go +++ b/tools/vendor/github.com/mgechev/revive/rule/string_of_int.go @@ -7,7 +7,7 @@ import ( "github.com/mgechev/revive/lint" ) -// StringOfIntRule warns when logic expressions contains Boolean literals. +// StringOfIntRule warns when an integer is converted to a string using a string cast. type StringOfIntRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/superfluous_else.go b/tools/vendor/github.com/mgechev/revive/rule/superfluous_else.go index dfa8a2fab..68bbd7815 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/superfluous_else.go +++ b/tools/vendor/github.com/mgechev/revive/rule/superfluous_else.go @@ -13,6 +13,8 @@ type SuperfluousElseRule struct { preserveScope bool } +var _ lint.ConfigurableRule = (*SuperfluousElseRule)(nil) + // Configure validates the rule configuration, and configures the rule accordingly. // // Configuration implements the [lint.ConfigurableRule] interface. diff --git a/tools/vendor/github.com/mgechev/revive/rule/time_equal.go b/tools/vendor/github.com/mgechev/revive/rule/time_equal.go index b7a0bef04..db9758c5b 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/time_equal.go +++ b/tools/vendor/github.com/mgechev/revive/rule/time_equal.go @@ -9,7 +9,7 @@ import ( "github.com/mgechev/revive/lint" ) -// TimeEqualRule shows where "==" and "!=" used for equality check [time.Time]. +// TimeEqualRule flags where "==" and "!=" are used for equality checks on [time.Time]. type TimeEqualRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/unconditional_recursion.go b/tools/vendor/github.com/mgechev/revive/rule/unconditional_recursion.go index b6288e08e..738a9e71d 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/unconditional_recursion.go +++ b/tools/vendor/github.com/mgechev/revive/rule/unconditional_recursion.go @@ -79,7 +79,7 @@ type lintUnconditionalRecursionRule struct { } // Visit will traverse function's body we search for calls to the function itself. -// We do not search inside conditional control structures (if, for, switch, ...) +// We do not search inside conditional control structures (if, for, switch etc.) // because any recursive call inside them is conditioned. // We do search inside conditional control structures are statements // that will take the control out of the function (return, exit, panic). diff --git a/tools/vendor/github.com/mgechev/revive/rule/unexported_return.go b/tools/vendor/github.com/mgechev/revive/rule/unexported_return.go index e82dcff09..dc567eee3 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/unexported_return.go +++ b/tools/vendor/github.com/mgechev/revive/rule/unexported_return.go @@ -9,7 +9,7 @@ import ( "github.com/mgechev/revive/lint" ) -// UnexportedReturnRule warns when a public return is from unexported type. +// UnexportedReturnRule warns when a public function returns an unexported type. type UnexportedReturnRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/unsecure_url_scheme.go b/tools/vendor/github.com/mgechev/revive/rule/unsecure_url_scheme.go index 09b4771b5..1aa095b47 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/unsecure_url_scheme.go +++ b/tools/vendor/github.com/mgechev/revive/rule/unsecure_url_scheme.go @@ -11,7 +11,7 @@ import ( ) // UnsecureURLSchemeRule checks if a file contains string literals with unsecure URL schemes. -// For example: http://... in place of https://.... +// For example: "http://" in place of "https://". type UnsecureURLSchemeRule struct{} // Apply applied the rule to the given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/use_fmt_print.go b/tools/vendor/github.com/mgechev/revive/rule/use_fmt_print.go index e5697ea50..3da85ff7f 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/use_fmt_print.go +++ b/tools/vendor/github.com/mgechev/revive/rule/use_fmt_print.go @@ -9,7 +9,8 @@ import ( "github.com/mgechev/revive/lint" ) -// UseFmtPrintRule lints calls to print and println. +// UseFmtPrintRule proposes to replace calls to built-in `print` and `println` +// with their equivalents from [fmt] package. type UseFmtPrintRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/use_slices_sort.go b/tools/vendor/github.com/mgechev/revive/rule/use_slices_sort.go index 3690672cf..a0f460baa 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/use_slices_sort.go +++ b/tools/vendor/github.com/mgechev/revive/rule/use_slices_sort.go @@ -8,7 +8,7 @@ import ( "github.com/mgechev/revive/lint" ) -// UseSlicesSort spots calls to sort.* that can be replaced by slices package methods. +// UseSlicesSort spots calls to sort.* that can be replaced by [slices] package methods. type UseSlicesSort struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/use_waitgroup_go.go b/tools/vendor/github.com/mgechev/revive/rule/use_waitgroup_go.go index 7daeb645f..6f04fd65c 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/use_waitgroup_go.go +++ b/tools/vendor/github.com/mgechev/revive/rule/use_waitgroup_go.go @@ -7,7 +7,7 @@ import ( "github.com/mgechev/revive/lint" ) -// UseWaitGroupGoRule spots Go idioms that might be rewritten using WaitGroup.Go. +// UseWaitGroupGoRule spots Go idioms that might be rewritten using [sync.WaitGroup.Go]. type UseWaitGroupGoRule struct{} // Apply applies the rule to given file. diff --git a/tools/vendor/github.com/mgechev/revive/rule/var_naming.go b/tools/vendor/github.com/mgechev/revive/rule/var_naming.go index ef27594c4..1c0b949f0 100644 --- a/tools/vendor/github.com/mgechev/revive/rule/var_naming.go +++ b/tools/vendor/github.com/mgechev/revive/rule/var_naming.go @@ -4,15 +4,12 @@ import ( "fmt" "go/ast" "go/token" - "path/filepath" "strings" - "sync" - - gopackages "golang.org/x/tools/go/packages" "github.com/mgechev/revive/internal/astutils" "github.com/mgechev/revive/internal/rule" "github.com/mgechev/revive/lint" + "github.com/mgechev/revive/logging" ) var knownNameExceptions = map[string]bool{ @@ -20,49 +17,19 @@ var knownNameExceptions = map[string]bool{ "kWh": true, } -// defaultBadPackageNames is the list of "bad" package names from https://go.dev/wiki/CodeReviewComments#package-names -// and https://go.dev/blog/package-names#bad-package-names. -// The rule warns about the usage of any package name in this list if skipPackageNameChecks is false. -// Values in the list should be lowercased. -var defaultBadPackageNames = map[string]struct{}{ - "api": {}, - "common": {}, - "interface": {}, - "interfaces": {}, - "misc": {}, - "miscellaneous": {}, - "shared": {}, - "type": {}, - "types": {}, - "util": {}, - "utilities": {}, - "utils": {}, -} - // VarNamingRule lints the name of a variable. type VarNamingRule struct { allowList []string blockList []string - allowUpperCaseConst bool // if true - allows to use UPPER_SOME_NAMES for constants - skipInitialismNameChecks bool // if true - disable enforcing capitals for common initialisms - skipPackageNameChecks bool // if true - disable check for meaningless and user-defined bad package names - extraBadPackageNames map[string]struct{} // inactive if skipPackageNameChecks is false - pkgNameAlreadyChecked syncSet // set of packages names already checked - - skipPackageNameCollisionWithGoStd bool // if true - disable checks for collisions with Go standard library package names - // stdPackageNames holds the names of standard library packages excluding internal and vendor. - // populated only if skipPackageNameCollisionWithGoStd is false. - // E.g., `net/http` stored as `http`, `math/rand/v2` - `rand` etc. - stdPackageNames map[string]struct{} + allowUpperCaseConst bool // if true - allows to use UPPER_SOME_NAMES for constants + skipInitialismNameChecks bool // if true - disable enforcing capitals for common initialisms } // Configure validates the rule configuration, and configures the rule accordingly. // // Configuration implements the [lint.ConfigurableRule] interface. func (r *VarNamingRule) Configure(arguments lint.Arguments) error { - r.pkgNameAlreadyChecked = syncSet{elements: map[string]struct{}{}} - if len(arguments) >= 1 { list, err := getList(arguments[0], "allowlist") if err != nil { @@ -100,58 +67,28 @@ func (r *VarNamingRule) Configure(arguments lint.Arguments) error { case isRuleOption(k, "upperCaseConst"): r.allowUpperCaseConst = fmt.Sprint(v) == "true" case isRuleOption(k, "skipPackageNameChecks"): - r.skipPackageNameChecks = fmt.Sprint(v) == "true" - case isRuleOption(k, "extraBadPackageNames"): - extraBadPackageNames, ok := v.([]any) - if !ok { - return fmt.Errorf("invalid third argument to the var-naming rule. Expecting extraBadPackageNames of type slice of strings, but %T", v) + logger, err := logging.GetLogger() + if err == nil { + logger.Warn("The option var-naming.skipPackageNameChecks is no longer supported and will be ignored; use package-naming rule instead") } - for i, name := range extraBadPackageNames { - if r.extraBadPackageNames == nil { - r.extraBadPackageNames = map[string]struct{}{} - } - n, ok := name.(string) - if !ok { - return fmt.Errorf("invalid third argument to the var-naming rule: expected element %d of extraBadPackageNames to be a string, but got %v(%T)", i, name, name) - } - r.extraBadPackageNames[strings.ToLower(n)] = struct{}{} + case isRuleOption(k, "extraBadPackageNames"): + logger, err := logging.GetLogger() + if err == nil { + logger.Warn("The option var-naming.extraBadPackageNames is no longer supported and will be ignored; use package-naming.userDefinedBadNames instead") } case isRuleOption(k, "skipPackageNameCollisionWithGoStd"): - r.skipPackageNameCollisionWithGoStd = fmt.Sprint(v) == "true" - } - } - } - if !r.skipPackageNameCollisionWithGoStd && r.stdPackageNames == nil { - pkgs, err := gopackages.Load(nil, "std") - if err != nil { - return fmt.Errorf("load std packages: %w", err) - } - - r.stdPackageNames = map[string]struct{}{} - for _, pkg := range pkgs { - if isInternalOrVendorPackage(pkg.PkgPath) { - continue + logger, err := logging.GetLogger() + if err == nil { + logger.Warn("The option var-naming.skipPackageNameCollisionWithGoStd is no longer supported and will be ignored; " + + "use package-naming.skipCollisionWithCommonStd instead (or package-naming.checkCollisionWithAllStd for the old 'all std' behavior)") + } } - r.stdPackageNames[pkg.Name] = struct{}{} } } return nil } -// isInternalOrVendorPackage reports whether the path represents an internal or vendor directory. -// -// Borrowed and modified from -// https://github.com/golang/pkgsite/blob/84333735ffe124f7bd904805fd488b93841de49f/internal/postgres/search.go#L1009-L1016 -func isInternalOrVendorPackage(path string) bool { - for p := range strings.SplitSeq(path, "/") { - if p == "internal" || p == "vendor" { - return true - } - } - return false -} - // Apply applies the rule to given file. func (r *VarNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure { var failures []lint.Failure @@ -159,10 +96,6 @@ func (r *VarNamingRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure failures = append(failures, failure) } - if !r.skipPackageNameChecks { - r.applyPackageCheckRules(file, onFailure) - } - fileAst := file.AST walker := lintNames{ file: file, @@ -184,61 +117,6 @@ func (*VarNamingRule) Name() string { return "var-naming" } -func (r *VarNamingRule) applyPackageCheckRules(file *lint.File, onFailure func(failure lint.Failure)) { - fileDir := filepath.Dir(file.Name) - - // Protect pkgsWithNameFailure from concurrent modifications - r.pkgNameAlreadyChecked.Lock() - defer r.pkgNameAlreadyChecked.Unlock() - if r.pkgNameAlreadyChecked.has(fileDir) { - return - } - r.pkgNameAlreadyChecked.add(fileDir) // mark this package as already checked - - pkgNameNode := file.AST.Name - pkgName := pkgNameNode.Name - pkgNameLower := strings.ToLower(pkgName) - - // Check if top level package - if pkgNameLower == "pkg" && filepath.Base(fileDir) != pkgName { - onFailure(r.pkgNameFailure(pkgNameNode, "should not have a root level package called pkg")) - return - } - - if _, ok := r.extraBadPackageNames[pkgNameLower]; ok { - onFailure(r.pkgNameFailure(pkgNameNode, "avoid bad package names")) - return - } - - if _, ok := defaultBadPackageNames[pkgNameLower]; ok { - onFailure(r.pkgNameFailure(pkgNameNode, "avoid meaningless package names")) - return - } - - if !r.skipPackageNameCollisionWithGoStd { - if _, ok := r.stdPackageNames[pkgNameLower]; ok { - onFailure(r.pkgNameFailure(pkgNameNode, "avoid package names that conflict with Go standard library package names")) - } - } - - // Package names need slightly different handling than other names. - if strings.Contains(pkgName, "_") && !strings.HasSuffix(pkgName, "_test") { - onFailure(r.pkgNameFailure(pkgNameNode, "don't use an underscore in package name")) - } - if hasUpperCaseLetter(pkgName) { - onFailure(r.pkgNameFailure(pkgNameNode, "don't use MixedCaps in package names; %s should be %s", pkgName, pkgNameLower)) - } -} - -func (*VarNamingRule) pkgNameFailure(node ast.Node, msg string, args ...any) lint.Failure { - return lint.Failure{ - Failure: fmt.Sprintf(msg, args...), - Confidence: 1, - Node: node, - Category: lint.FailureCategoryNaming, - } -} - type lintNames struct { file *lint.File fileAst *ast.File @@ -485,18 +363,3 @@ func getList(arg any, argName string) ([]string, error) { } return list, nil } - -type syncSet struct { - sync.Mutex - - elements map[string]struct{} -} - -func (sm *syncSet) has(s string) bool { - _, result := sm.elements[s] - return result -} - -func (sm *syncSet) add(s string) { - sm.elements[s] = struct{}{} -} diff --git a/tools/vendor/golang.org/x/sys/unix/ztypes_linux.go b/tools/vendor/golang.org/x/sys/unix/ztypes_linux.go index c1a467017..45476a73c 100644 --- a/tools/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/tools/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -593,110 +593,115 @@ const ( ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFAL_LABEL = 0x2 - IFAL_ADDRESS = 0x1 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofIfAddrlblmsg = 0xc - SizeofIfaCacheinfo = 0x10 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFAL_LABEL = 0x2 + IFAL_ADDRESS = 0x1 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + PREFIX_UNSPEC = 0x0 + PREFIX_ADDRESS = 0x1 + PREFIX_CACHEINFO = 0x2 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofPrefixmsg = 0xc + SizeofPrefixCacheinfo = 0x8 + SizeofIfAddrmsg = 0x8 + SizeofIfAddrlblmsg = 0xc + SizeofIfaCacheinfo = 0x10 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -735,6 +740,22 @@ type IfInfomsg struct { Change uint32 } +type Prefixmsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + Type uint8 + Len uint8 + Flags uint8 + Pad3 uint8 +} + +type PrefixCacheinfo struct { + Preferred_time uint32 + Valid_time uint32 +} + type IfAddrmsg struct { Family uint8 Prefixlen uint8 diff --git a/tools/vendor/golang.org/x/sys/windows/aliases.go b/tools/vendor/golang.org/x/sys/windows/aliases.go index 16f90560a..96317966e 100644 --- a/tools/vendor/golang.org/x/sys/windows/aliases.go +++ b/tools/vendor/golang.org/x/sys/windows/aliases.go @@ -8,5 +8,6 @@ package windows import "syscall" +type Signal = syscall.Signal type Errno = syscall.Errno type SysProcAttr = syscall.SysProcAttr diff --git a/tools/vendor/golang.org/x/sys/windows/syscall_windows.go b/tools/vendor/golang.org/x/sys/windows/syscall_windows.go index 738a9f212..d76643658 100644 --- a/tools/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/tools/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -1490,20 +1490,6 @@ func Getgid() (gid int) { return -1 } func Getegid() (egid int) { return -1 } func Getgroups() (gids []int, err error) { return nil, syscall.EWINDOWS } -type Signal int - -func (s Signal) Signal() {} - -func (s Signal) String() string { - if 0 <= s && int(s) < len(signals) { - str := signals[s] - if str != "" { - return str - } - } - return "signal " + itoa(int(s)) -} - func LoadCreateSymbolicLink() error { return procCreateSymbolicLinkW.Find() } diff --git a/tools/vendor/modules.txt b/tools/vendor/modules.txt index 50bf02e50..879a72e0f 100644 --- a/tools/vendor/modules.txt +++ b/tools/vendor/modules.txt @@ -82,7 +82,7 @@ github.com/alecthomas/go-check-sumtype # github.com/alexkohler/nakedret/v2 v2.0.6 ## explicit; go 1.23.0 github.com/alexkohler/nakedret/v2 -# github.com/alexkohler/prealloc v1.0.2 +# github.com/alexkohler/prealloc v1.1.0 ## explicit; go 1.24.0 github.com/alexkohler/prealloc/pkg # github.com/alfatraining/structtag v1.0.0 @@ -317,7 +317,7 @@ github.com/golangci/go-printf-func-name/pkg/analyzer # github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d ## explicit; go 1.22.0 github.com/golangci/gofmt/gofmt -# github.com/golangci/golangci-lint/v2 v2.10.1 +# github.com/golangci/golangci-lint/v2 v2.11.2 ## explicit; go 1.25.0 github.com/golangci/golangci-lint/v2/cmd/golangci-lint github.com/golangci/golangci-lint/v2/internal/cache @@ -550,8 +550,8 @@ github.com/hexops/gotextdiff/span # github.com/inconshreveable/mousetrap v1.1.0 ## explicit; go 1.18 github.com/inconshreveable/mousetrap -# github.com/jgautheron/goconst v1.8.2 -## explicit; go 1.16 +# github.com/jgautheron/goconst v1.9.0 +## explicit; go 1.23 github.com/jgautheron/goconst # github.com/jingyugao/rowserrcheck v1.1.1 ## explicit; go 1.13 @@ -639,13 +639,14 @@ github.com/mattn/go-isatty # github.com/mattn/go-runewidth v0.0.21 ## explicit; go 1.20 github.com/mattn/go-runewidth -# github.com/mgechev/revive v1.14.0 -## explicit; go 1.24.0 +# github.com/mgechev/revive v1.15.0 +## explicit; go 1.25.0 github.com/mgechev/revive/config github.com/mgechev/revive/formatter github.com/mgechev/revive/internal/astutils github.com/mgechev/revive/internal/ifelse github.com/mgechev/revive/internal/rule +github.com/mgechev/revive/internal/syncset github.com/mgechev/revive/internal/typeparams github.com/mgechev/revive/lint github.com/mgechev/revive/logging @@ -952,12 +953,12 @@ golang.org/x/mod/modfile golang.org/x/mod/module golang.org/x/mod/semver golang.org/x/mod/sumdb/dirhash -# golang.org/x/sync v0.19.0 -## explicit; go 1.24.0 +# golang.org/x/sync v0.20.0 +## explicit; go 1.25.0 golang.org/x/sync/errgroup golang.org/x/sync/semaphore -# golang.org/x/sys v0.41.0 -## explicit; go 1.24.0 +# golang.org/x/sys v0.42.0 +## explicit; go 1.25.0 golang.org/x/sys/unix golang.org/x/sys/windows # golang.org/x/text v0.34.0 diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential/confidential.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential/confidential.go index 29c004320..1b3e599b1 100644 --- a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential/confidential.go +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/confidential/confidential.go @@ -359,7 +359,7 @@ func New(authority, clientID string, cred Credential, options ...Option) (Client // authCodeURLOptions contains options for AuthCodeURL type authCodeURLOptions struct { - claims, loginHint, tenantID, domainHint string + claims, loginHint, tenantID, domainHint, prompt string } // AuthCodeURLOption is implemented by options for AuthCodeURL @@ -369,7 +369,7 @@ type AuthCodeURLOption interface { // AuthCodeURL creates a URL used to acquire an authorization code. Users need to call CreateAuthorizationCodeURLParameters and pass it in. // -// Options: [WithClaims], [WithDomainHint], [WithLoginHint], [WithTenantID] +// Options: [WithClaims], [WithDomainHint], [WithLoginHint], [WithTenantID], [WithPrompt] func (cca Client) AuthCodeURL(ctx context.Context, clientID, redirectURI string, scopes []string, opts ...AuthCodeURLOption) (string, error) { o := authCodeURLOptions{} if err := options.ApplyOptions(&o, opts); err != nil { @@ -382,6 +382,7 @@ func (cca Client) AuthCodeURL(ctx context.Context, clientID, redirectURI string, ap.Claims = o.claims ap.LoginHint = o.loginHint ap.DomainHint = o.domainHint + ap.Prompt = o.prompt return cca.base.AuthCodeURL(ctx, clientID, redirectURI, scopes, ap) } @@ -431,6 +432,29 @@ func WithDomainHint(domain string) interface { } } +// WithPrompt adds prompt query parameter in the auth url. +func WithPrompt(prompt shared.Prompt) interface { + AuthCodeURLOption + options.CallOption +} { + return struct { + AuthCodeURLOption + options.CallOption + }{ + CallOption: options.NewCallOption( + func(a any) error { + switch t := a.(type) { + case *authCodeURLOptions: + t.prompt = prompt.String() + default: + return fmt.Errorf("unexpected options type %T", a) + } + return nil + }, + ), + } +} + // WithClaims sets additional claims to request for the token, such as those required by conditional access policies. // Use this option when Azure AD returned a claims challenge for a prior request. The argument must be decoded. // This option is valid for any token acquisition method. diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/base.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/base.go index abf54f7e5..9bd96090e 100644 --- a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/base.go +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/base/base.go @@ -302,13 +302,10 @@ func (b Client) AuthCodeURL(ctx context.Context, clientID, redirectURI string, s if authParams.DomainHint != "" { v.Add("domain_hint", authParams.DomainHint) } - // There were left over from an implementation that didn't use any of these. We may - // need to add them later, but as of now aren't needed. - /* - if p.ResponseMode != "" { - urlParams.Add("response_mode", p.ResponseMode) - } - */ + // Use form_post response mode for interactive auth to avoid exposing the auth code in the URL + if authParams.AuthorizationType == authority.ATInteractive { + v.Add("response_mode", "form_post") + } baseURL.RawQuery = v.Encode() return baseURL.String(), nil } diff --git a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go index c6baf2094..1fb012fea 100644 --- a/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go +++ b/vendor/github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/local/server.go @@ -24,6 +24,7 @@ var okPage = []byte(`
Authentication complete. You can return to the application. Feel free to close this browser tab.
+For your security: Do not share the contents of this page, the address bar, or take screenshots.