diff --git a/CHANGELOG.md b/CHANGELOG.md
index f8e137917f48..f039a5cdf1e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,74 @@
- [sdkgen/{go,python}] Revert 10738, fixing python class generation
[#11033](https://github.com/pulumi/pulumi/pull/11033)
+## 3.43.0 (2022-10-14)
+
+
+### Features
+
+- [auto/nodejs] Adds support for parallel programs in NodeJS Automation API
+ [#10568](https://github.com/pulumi/pulumi/pull/10568)
+
+- [backend/service] Implements diff-based snapshot saving protocol that reduces bandwidth on large stacks. To opt into this feature, set the environment variable and value `PULUMI_OPTIMIZED_CHECKPOINT_PATCH=true`.
+ [#10788](https://github.com/pulumi/pulumi/pull/10788)
+
+- [engine] Adds structured alias support to the engine
+ [#10819](https://github.com/pulumi/pulumi/pull/10819)
+
+- [cli/display] Displays time elapsed when modifying a resource.
+ [#10953](https://github.com/pulumi/pulumi/pull/10953)
+
+- [sdk/go] Modifies built-in As-ArrayOutput methods to attempt to convert []interface{} to []T.
+ [#10991](https://github.com/pulumi/pulumi/pull/10991)
+
+- [sdkgen/go] Add `modulePath` to go, allowing accurate `go.mod` files for prerelease packages
+ [#10944](https://github.com/pulumi/pulumi/pull/10944)
+
+- [cli/new] Add --remove flag to`pulumi destroy`
+ [#10943](https://github.com/pulumi/pulumi/pull/10943)
+
+
+### Bug Fixes
+
+- [cli] Project path is included in error messages when a project can't be loaded.
+ [#10973](https://github.com/pulumi/pulumi/pull/10973)
+
+- [cli/display] Fix gocloud unconditonally writing to stderr.
+ [#11007](https://github.com/pulumi/pulumi/pull/11007)
+
+- [cli/{display,engine}] Use of unsupported ResourceOptions on components will no longer raise resource warnings, instead they are just logged to the diagnostic error stream.
+ [#11010](https://github.com/pulumi/pulumi/pull/11010)
+
+- [cli/import] Handle importing resource properties that are typed as a union
+ [#10995](https://github.com/pulumi/pulumi/pull/10995)
+
+- [cli/package] Require a path separator for path based binaries. This allows us to distinguish between ./myProvider (execute the binary at path) and myProvider (execute the installed plugin).
+ [#11015](https://github.com/pulumi/pulumi/pull/11015)
+
+- [programgen/dotnet] Annotate deeply nested objects with their schema types and apply property name overrides
+ [#10976](https://github.com/pulumi/pulumi/pull/10976)
+
+- [programgen/go] Fixes int constant range expressions for go
+ [#10979](https://github.com/pulumi/pulumi/pull/10979)
+
+- [programgen/go] Missing default case handling when generating local variables
+ [#10978](https://github.com/pulumi/pulumi/pull/10978)
+
+- [sdk/go] Avoid backfilling property deps for Go
+ [#11021](https://github.com/pulumi/pulumi/pull/11021)
+
+- [sdkgen] Re-enables caching the schemas of versioned provider plugins.
+ [#10971](https://github.com/pulumi/pulumi/pull/10971)
+
+- [programgen/python] Recursively annotate expressions under invoke calls with their associated schema types
+ [#10958](https://github.com/pulumi/pulumi/pull/10958)
+
+
+### Miscellaneous
+
+- [yaml] "[Updates Pulumi YAML to v0.5.10](https://github.com/pulumi/pulumi-yaml/releases/tag/v0.5.10) containing bug fixes and improvements primarily for `pulumi convert` from YAML."
+ [#11018](https://github.com/pulumi/pulumi/pull/11018)
+
## 3.42.0 (2022-10-07)
diff --git a/changelog/pending/20221010--sdk-go--update-deprecated-things.yaml b/changelog/pending/20221010--sdk-go--update-deprecated-things.yaml
new file mode 100644
index 000000000000..5a856c4ce93a
--- /dev/null
+++ b/changelog/pending/20221010--sdk-go--update-deprecated-things.yaml
@@ -0,0 +1,4 @@
+changes:
+- type: chore
+ scope: sdk/go
+ description: Update notes, update the deprecated functions, make some lint.
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/aws-eks-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/aws-eks-pp/program.pp
new file mode 100644
index 000000000000..84ca69daf568
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/aws-eks-pp/program.pp
@@ -0,0 +1,21 @@
+vpcId = invoke("aws:ec2/getVpc:getVpc", {
+ default = true
+}).id
+subnetIds = invoke("aws:ec2/getSubnetIds:getSubnetIds", {
+ vpcId = vpcId
+}).ids
+
+resource cluster "eks:index:Cluster" {
+ __logicalName = "cluster"
+ vpcId = vpcId
+ subnetIds = subnetIds
+ instanceType = "t2.medium"
+ desiredCapacity = 2
+ minSize = 1
+ maxSize = 2
+}
+
+output kubeconfig {
+ __logicalName = "kubeconfig"
+ value = cluster.kubeconfig
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/aws-static-website-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/aws-static-website-pp/program.pp
new file mode 100644
index 000000000000..01f1954cbece
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/aws-static-website-pp/program.pp
@@ -0,0 +1,38 @@
+resource siteBucket "aws-native:s3:Bucket" {
+ __logicalName = "site-bucket"
+ websiteConfiguration = {
+ indexDocument = "index.html"
+ }
+}
+
+resource indexHtml "aws:s3/bucketObject:BucketObject" {
+ __logicalName = "index.html"
+ bucket = siteBucket.id
+ source = fileAsset("./www/index.html")
+ acl = "public-read"
+ contentType = "text/html"
+}
+
+resource faviconPng "aws:s3/bucketObject:BucketObject" {
+ __logicalName = "favicon.png"
+ bucket = siteBucket.id
+ source = fileAsset("./www/favicon.png")
+ acl = "public-read"
+ contentType = "image/png"
+}
+
+resource bucketPolicy "aws:s3/bucketPolicy:BucketPolicy" {
+ __logicalName = "bucketPolicy"
+ bucket = siteBucket.id
+ policy = "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": [\"s3:GetObject\"],\n \"Resource\": [\"${siteBucket.arn}/*\"]\n }\n ]\n}\n"
+}
+
+output bucketName {
+ __logicalName = "bucketName"
+ value = siteBucket.bucketName
+}
+
+output websiteUrl {
+ __logicalName = "websiteUrl"
+ value = siteBucket.websiteURL
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate-pp/program.pp
new file mode 100644
index 000000000000..cf98c6f9ade1
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/awsx-fargate-pp/program.pp
@@ -0,0 +1,28 @@
+resource cluster "aws:ecs/cluster:Cluster" {
+ __logicalName = "cluster"
+}
+
+resource lb "awsx:lb:ApplicationLoadBalancer" {
+ __logicalName = "lb"
+}
+
+resource nginx "awsx:ecs:FargateService" {
+ __logicalName = "nginx"
+ cluster = cluster.arn
+ taskDefinitionArgs = {
+ container = {
+ image = "nginx:latest",
+ cpu = 512,
+ memory = 128,
+ portMappings = [{
+ containerPort = 80,
+ targetGroup = lb.defaultTargetGroup
+ }]
+ }
+ }
+}
+
+output url {
+ __logicalName = "url"
+ value = lb.loadBalancer.dnsName
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/azure-app-service-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/azure-app-service-pp/program.pp
new file mode 100644
index 000000000000..f01122887941
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/azure-app-service-pp/program.pp
@@ -0,0 +1,123 @@
+config sqlAdmin string {
+ default = "pulumi"
+}
+
+blobAccessToken = secret(invoke("azure-native:storage:listStorageAccountServiceSAS", {
+ accountName = sa.name,
+ protocols = "https",
+ sharedAccessStartTime = "2022-01-01",
+ sharedAccessExpiryTime = "2030-01-01",
+ resource = "c",
+ resourceGroupName = appservicegroup.name,
+ permissions = "r",
+ canonicalizedResource = "/blob/${sa.name}/${container.name}",
+ contentType = "application/json",
+ cacheControl = "max-age=5",
+ contentDisposition = "inline",
+ contentEncoding = "deflate"
+}).serviceSasToken)
+
+resource appservicegroup "azure-native:resources:ResourceGroup" {
+ __logicalName = "appservicegroup"
+}
+
+resource sa "azure-native:storage:StorageAccount" {
+ __logicalName = "sa"
+ resourceGroupName = appservicegroup.name
+ kind = "StorageV2"
+ sku = {
+ name = "Standard_LRS"
+ }
+}
+
+resource appserviceplan "azure-native:web:AppServicePlan" {
+ __logicalName = "appserviceplan"
+ resourceGroupName = appservicegroup.name
+ kind = "App"
+ sku = {
+ name = "B1",
+ tier = "Basic"
+ }
+}
+
+resource container "azure-native:storage:BlobContainer" {
+ __logicalName = "container"
+ resourceGroupName = appservicegroup.name
+ accountName = sa.name
+ publicAccess = "None"
+}
+
+resource blob "azure-native:storage:Blob" {
+ __logicalName = "blob"
+ resourceGroupName = appservicegroup.name
+ accountName = sa.name
+ containerName = container.name
+ type = "Block"
+ source = fileArchive("./www")
+}
+
+resource appInsights "azure-native:insights:Component" {
+ __logicalName = "appInsights"
+ resourceGroupName = appservicegroup.name
+ applicationType = "web"
+ kind = "web"
+}
+
+resource sqlPassword "random:index/randomPassword:RandomPassword" {
+ __logicalName = "sqlPassword"
+ length = 16
+ special = true
+}
+
+resource sqlServer "azure-native:sql:Server" {
+ __logicalName = "sqlServer"
+ resourceGroupName = appservicegroup.name
+ administratorLogin = sqlAdmin
+ administratorLoginPassword = sqlPassword.result
+ version = "12.0"
+}
+
+resource db "azure-native:sql:Database" {
+ __logicalName = "db"
+ resourceGroupName = appservicegroup.name
+ serverName = sqlServer.name
+ sku = {
+ name = "S0"
+ }
+}
+
+resource app "azure-native:web:WebApp" {
+ __logicalName = "app"
+ resourceGroupName = appservicegroup.name
+ serverFarmId = appserviceplan.id
+ siteConfig = {
+ appSettings = [
+ {
+ name = "WEBSITE_RUN_FROM_PACKAGE",
+ value = "https://${sa.name}.blob.core.windows.net/${container.name}/${blob.name}?${blobAccessToken}"
+ },
+ {
+ name = "APPINSIGHTS_INSTRUMENTATIONKEY",
+ value = appInsights.instrumentationKey
+ },
+ {
+ name = "APPLICATIONINSIGHTS_CONNECTION_STRING",
+ value = "InstrumentationKey=${appInsights.instrumentationKey}"
+ },
+ {
+ name = "ApplicationInsightsAgent_EXTENSION_VERSION",
+ value = "~2"
+ }
+ ],
+ connectionStrings = [{
+ name = "db",
+ type = "SQLAzure",
+ connectionString = "Server= tcp:${sqlServer.name}.database.windows.net;initial catalog=${db.name};userID=${sqlAdmin};password=${sqlPassword.result};Min Pool Size=0;Max Pool Size=30;Persist Security Info=true;"
+ }]
+ }
+}
+
+output endpoint {
+ __logicalName = "endpoint"
+ value = app.defaultHostName
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/azure-container-apps-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/azure-container-apps-pp/program.pp
new file mode 100644
index 000000000000..0efa9997517d
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/azure-container-apps-pp/program.pp
@@ -0,0 +1,106 @@
+config sqlAdmin string {
+ default = "pulumi"
+}
+
+config retentionInDays int {
+ default = 30
+}
+
+sharedKey = secret(invoke("azure-native:operationalinsights:getSharedKeys", {
+ resourceGroupName = resourceGroup.name,
+ workspaceName = workspace.name
+}).primarySharedKey)
+adminRegistryCreds = invoke("azure-native:containerregistry:listRegistryCredentials", {
+ resourceGroupName = resourceGroup.name,
+ registryName = registry.name
+})
+adminUsername = adminRegistryCreds.username
+adminPasswords = secret(adminRegistryCreds.passwords)
+
+resource resourceGroup "azure-native:resources:ResourceGroup" {
+ __logicalName = "resourceGroup"
+}
+
+resource workspace "azure-native:operationalinsights:Workspace" {
+ __logicalName = "workspace"
+ resourceGroupName = resourceGroup.name
+ sku = {
+ name = "PerGB2018"
+ }
+ retentionInDays = retentionInDays
+}
+
+resource kubeEnv "azure-native:web:KubeEnvironment" {
+ __logicalName = "kubeEnv"
+ resourceGroupName = resourceGroup.name
+ environmentType = "Managed"
+ appLogsConfiguration = {
+ destination = "log-analytics",
+ logAnalyticsConfiguration = {
+ customerId = workspace.customerId,
+ sharedKey = sharedKey
+ }
+ }
+}
+
+resource registry "azure-native:containerregistry:Registry" {
+ __logicalName = "registry"
+ resourceGroupName = resourceGroup.name
+ sku = {
+ name = "Basic"
+ }
+ adminUserEnabled = true
+}
+
+resource provider "pulumi:providers:docker" {
+ __logicalName = "provider"
+ registryAuth = [{
+ address = registry.loginServer,
+ username = adminUsername,
+ password = adminPasswords[0].value
+ }]
+}
+
+resource myImage "docker:index/registryImage:RegistryImage" {
+ __logicalName = "myImage"
+ name = "${registry.loginServer}/node-app:v1.0.0"
+ build = {
+ context = "${cwd()}/node-app"
+ }
+
+ options {
+ provider = provider
+ }
+}
+
+resource containerapp "azure-native:web:ContainerApp" {
+ __logicalName = "containerapp"
+ resourceGroupName = resourceGroup.name
+ kubeEnvironmentId = kubeEnv.id
+ configuration = {
+ ingress = {
+ external = true,
+ targetPort = 80
+ },
+ registries = [{
+ server = registry.loginServer,
+ username = adminUsername,
+ passwordSecretRef = "pwd"
+ }],
+ secrets = [{
+ name = "pwd",
+ value = adminPasswords[0].value
+ }]
+ }
+ template = {
+ containers = [{
+ name = "myapp",
+ image = myImage.name
+ }]
+ }
+}
+
+output endpoint {
+ __logicalName = "endpoint"
+ value = "https://${containerapp.configuration.ingress.fqdn}"
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/azure-static-website-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/azure-static-website-pp/program.pp
new file mode 100644
index 000000000000..c73a579472db
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/azure-static-website-pp/program.pp
@@ -0,0 +1,55 @@
+resource staticsitegroup "azure-native:resources:ResourceGroup" {
+ __logicalName = "staticsitegroup"
+}
+
+resource storageaccount "azure-native:storage:StorageAccount" {
+ __logicalName = "storageaccount"
+ resourceGroupName = staticsitegroup.name
+ kind = "StorageV2"
+ sku = {
+ name = "Standard_LRS"
+ }
+}
+
+resource staticwebsite "azure-native:storage:StorageAccountStaticWebsite" {
+ __logicalName = "staticwebsite"
+ resourceGroupName = staticsitegroup.name
+ accountName = storageaccount.name
+ indexDocument = "index.html"
+ error404Document = "404.html"
+}
+
+resource indexHtml "azure-native:storage:Blob" {
+ __logicalName = "index.html"
+ resourceGroupName = staticsitegroup.name
+ accountName = storageaccount.name
+ containerName = staticwebsite.containerName
+ contentType = "text/html"
+ type = "Block"
+ source = fileAsset("./www/index.html")
+}
+
+resource faviconPng "azure-native:storage:Blob" {
+ __logicalName = "favicon.png"
+ resourceGroupName = staticsitegroup.name
+ accountName = storageaccount.name
+ containerName = staticwebsite.containerName
+ contentType = "image/png"
+ type = "Block"
+ source = fileAsset("./www/favicon.png")
+}
+
+resource "404Html" "azure-native:storage:Blob" {
+ __logicalName = "404.html"
+ resourceGroupName = staticsitegroup.name
+ accountName = storageaccount.name
+ containerName = staticwebsite.containerName
+ contentType = "text/html"
+ type = "Block"
+ source = fileAsset("./www/404.html")
+}
+
+output endpoint {
+ __logicalName = "endpoint"
+ value = storageaccount.primaryEndpoints.web
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/cue-eks-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/cue-eks-pp/program.pp
new file mode 100644
index 000000000000..e25b0fcdaaf2
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/cue-eks-pp/program.pp
@@ -0,0 +1,15 @@
+resource rawkode "eks:index:Cluster" {
+ __logicalName = "rawkode"
+ instanceType = "t2.medium"
+ desiredCapacity = 2
+ minSize = 1
+ maxSize = 2
+}
+
+resource stack72 "eks:index:Cluster" {
+ __logicalName = "stack72"
+ instanceType = "t2.medium"
+ desiredCapacity = 4
+ minSize = 1
+ maxSize = 8
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/cue-random-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/cue-random-pp/program.pp
new file mode 100644
index 000000000000..3bd1c5cdf81f
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/cue-random-pp/program.pp
@@ -0,0 +1,11 @@
+resource randomPassword "random:index/randomPassword:RandomPassword" {
+ __logicalName = "randomPassword"
+ length = 16
+ special = true
+ overrideSpecial = "_%@"
+}
+
+output password {
+ __logicalName = "password"
+ value = randomPassword.result
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/cue-static-web-app-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/cue-static-web-app-pp/program.pp
new file mode 100644
index 000000000000..738347d89d5c
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/cue-static-web-app-pp/program.pp
@@ -0,0 +1,63 @@
+resource rawkodeGroup "azure-native:resources:ResourceGroup" {
+ __logicalName = "rawkode-group"
+ location = "WestUs"
+}
+
+resource rawkodeStorage "azure-native:storage:StorageAccount" {
+ __logicalName = "rawkode-storage"
+ resourceGroupName = rawkodeGroup.name
+ kind = "StorageV2"
+ sku = {
+ name = "Standard_LRS"
+ }
+}
+
+resource rawkodeWebsite "azure-native:storage:StorageAccountStaticWebsite" {
+ __logicalName = "rawkode-website"
+ resourceGroupName = rawkodeGroup.name
+ accountName = rawkodeStorage.name
+ indexDocument = "index.html"
+ error404Document = "404.html"
+}
+
+resource rawkodeIndexHtml "azure-native:storage:Blob" {
+ __logicalName = "rawkode-index.html"
+ resourceGroupName = rawkodeGroup.name
+ accountName = rawkodeStorage.name
+ containerName = rawkodeWebsite.containerName
+ contentType = "text/html"
+ type = "Block"
+ source = fileAsset("./website/index.html")
+}
+
+resource stack72Group "azure-native:resources:ResourceGroup" {
+ __logicalName = "stack72-group"
+ location = "WestUs"
+}
+
+resource stack72Storage "azure-native:storage:StorageAccount" {
+ __logicalName = "stack72-storage"
+ resourceGroupName = stack72Group.name
+ kind = "StorageV2"
+ sku = {
+ name = "Standard_LRS"
+ }
+}
+
+resource stack72Website "azure-native:storage:StorageAccountStaticWebsite" {
+ __logicalName = "stack72-website"
+ resourceGroupName = stack72Group.name
+ accountName = stack72Storage.name
+ indexDocument = "index.html"
+ error404Document = "404.html"
+}
+
+resource stack72IndexHtml "azure-native:storage:Blob" {
+ __logicalName = "stack72-index.html"
+ resourceGroupName = stack72Group.name
+ accountName = stack72Storage.name
+ containerName = stack72Website.containerName
+ contentType = "text/html"
+ type = "Block"
+ source = fileAsset("./website/index.html")
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/getting-started-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/getting-started-pp/program.pp
new file mode 100644
index 000000000000..3a0afa284e2a
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/getting-started-pp/program.pp
@@ -0,0 +1,16 @@
+resource mybucket "aws:s3/bucket:Bucket" {
+ website = {
+ indexDocument = "index.html"
+ }
+}
+
+resource indexhtml "aws:s3/bucketObject:BucketObject" {
+ bucket = mybucket.id
+ source = stringAsset("
Hello, world!
")
+ acl = "public-read"
+ contentType = "text/html"
+}
+
+output bucketEndpoint {
+ value = "http://${mybucket.websiteEndpoint}"
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/kubernetes-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/kubernetes-pp/program.pp
new file mode 100644
index 000000000000..a243565cba82
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/kubernetes-pp/program.pp
@@ -0,0 +1,82 @@
+config hostname string {
+ default = "example.com"
+}
+
+resource nginxDemo "kubernetes:core/v1:Namespace" {
+ __logicalName = "nginx-demo"
+}
+
+resource app "kubernetes:apps/v1:Deployment" {
+ __logicalName = "app"
+ metadata = {
+ namespace = nginxDemo.metadata.name
+ }
+ spec = {
+ selector = {
+ matchLabels = {
+ "app.kubernetes.io/name" = "nginx-demo"
+ }
+ },
+ replicas = 1,
+ template = {
+ metadata = {
+ labels = {
+ "app.kubernetes.io/name" = "nginx-demo"
+ }
+ },
+ spec = {
+ containers = [{
+ name = "app",
+ image = "nginx:1.15-alpine"
+ }]
+ }
+ }
+ }
+}
+
+resource service "kubernetes:core/v1:Service" {
+ __logicalName = "service"
+ metadata = {
+ namespace = nginxDemo.metadata.name,
+ labels = {
+ "app.kubernetes.io/name" = "nginx-demo"
+ }
+ }
+ spec = {
+ type = "ClusterIP",
+ ports = [{
+ port = 80,
+ targetPort = 80,
+ protocol = "TCP"
+ }],
+ selector = {
+ "app.kubernetes.io/name" = "nginx-demo"
+ }
+ }
+}
+
+resource ingress "kubernetes:networking.k8s.io/v1:Ingress" {
+ __logicalName = "ingress"
+ metadata = {
+ namespace = nginxDemo.metadata.name
+ }
+ spec = {
+ rules = [{
+ host = hostname,
+ http = {
+ paths = [{
+ path = "/",
+ pathType = "Prefix",
+ backend = {
+ service = {
+ name = service.metadata.name,
+ port = {
+ number = 80
+ }
+ }
+ }
+ }]
+ }
+ }]
+ }
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/pulumi-variable-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/pulumi-variable-pp/program.pp
new file mode 100644
index 000000000000..46ac1b3d5d5e
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/pulumi-variable-pp/program.pp
@@ -0,0 +1,14 @@
+output cwd0 {
+ __logicalName = "cwd"
+ value = cwd()
+}
+
+output stack0 {
+ __logicalName = "stack"
+ value = stack()
+}
+
+output project0 {
+ __logicalName = "project"
+ value = project()
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/random-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/random-pp/program.pp
new file mode 100644
index 000000000000..3bd1c5cdf81f
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/random-pp/program.pp
@@ -0,0 +1,11 @@
+resource randomPassword "random:index/randomPassword:RandomPassword" {
+ __logicalName = "randomPassword"
+ length = 16
+ special = true
+ overrideSpecial = "_%@"
+}
+
+output password {
+ __logicalName = "password"
+ value = randomPassword.result
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/readme-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/readme-pp/program.pp
new file mode 100644
index 000000000000..9550599ee08c
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/readme-pp/program.pp
@@ -0,0 +1,17 @@
+output strVar {
+ __logicalName = "strVar"
+ value = "foo"
+}
+
+output arrVar {
+ __logicalName = "arrVar"
+ value = [
+ "fizz",
+ "buzz"
+ ]
+}
+
+output readme {
+ __logicalName = "readme"
+ value = readFile("./Pulumi.README.md")
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/stackreference-consumer-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/stackreference-consumer-pp/program.pp
new file mode 100644
index 000000000000..88f15e92b989
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/stackreference-consumer-pp/program.pp
@@ -0,0 +1,7 @@
+resource stackRef "pulumi:pulumi:StackReference" {
+ name = "PLACEHOLDER_ORG_NAME/stackreference-producer/PLACEHOLDER_STACK_NAME"
+}
+
+output referencedImageName {
+ value = "${stackRef.outputs["imageName"]}"
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/stackreference-producer-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/stackreference-producer-pp/program.pp
new file mode 100644
index 000000000000..6c055783d525
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/stackreference-producer-pp/program.pp
@@ -0,0 +1,4 @@
+output imageName {
+ __logicalName = "imageName"
+ value = "pulumi/pulumi:latest"
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/webserver-json-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/webserver-json-pp/program.pp
new file mode 100644
index 000000000000..4ea8408a094c
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/webserver-json-pp/program.pp
@@ -0,0 +1,55 @@
+config instanceType string {
+ default = "t3.micro"
+}
+
+resource webSecGrp "aws:ec2/securityGroup:SecurityGroup" {
+ __logicalName = "WebSecGrp"
+ ingress = [{
+ protocol = "tcp",
+ fromPort = 80,
+ toPort = 80,
+ cidrBlocks = ["0.0.0.0/0"]
+ }]
+
+ options {
+ version = "4.37.1"
+ }
+}
+
+resource webServer "aws:ec2/instance:Instance" {
+ __logicalName = "WebServer"
+ instanceType = instanceType
+ ami = invoke("aws:index/getAmi:getAmi", {
+ filters = [{
+ name = "name",
+ values = ["amzn-ami-hvm-*-x86_64-ebs"]
+ }],
+ owners = ["137112412989"],
+ mostRecent = true
+ }).id
+ userData = join("\n", [
+ "#!/bin/bash",
+ "echo 'Hello, World from ${webSecGrp.arn}!' > index.html",
+ "nohup python -m SimpleHTTPServer 80 &"
+ ])
+ vpcSecurityGroupIds = [webSecGrp.id]
+
+ options {
+ version = "4.37.1"
+ }
+}
+
+output instanceId {
+ __logicalName = "InstanceId"
+ value = webServer.id
+}
+
+output publicIp {
+ __logicalName = "PublicIp"
+ value = webServer.publicIp
+}
+
+output publicHostName {
+ __logicalName = "PublicHostName"
+ value = webServer.publicDns
+}
diff --git a/pkg/codegen/testing/test/testdata/transpiled_examples/webserver-pp/program.pp b/pkg/codegen/testing/test/testdata/transpiled_examples/webserver-pp/program.pp
new file mode 100644
index 000000000000..233a861db526
--- /dev/null
+++ b/pkg/codegen/testing/test/testdata/transpiled_examples/webserver-pp/program.pp
@@ -0,0 +1,58 @@
+config instanceType string {
+ default = "t3.micro"
+}
+
+ec2Ami = invoke("aws:index/getAmi:getAmi", {
+ filters = [{
+ name = "name",
+ values = ["amzn-ami-hvm-*-x86_64-ebs"]
+ }],
+ owners = ["137112412989"],
+ mostRecent = true
+}).id
+
+resource webSecGrp "aws:ec2/securityGroup:SecurityGroup" {
+ __logicalName = "WebSecGrp"
+ ingress = [{
+ protocol = "tcp",
+ fromPort = 80,
+ toPort = 80,
+ cidrBlocks = ["0.0.0.0/0"]
+ }]
+}
+
+resource webServer "aws:ec2/instance:Instance" {
+ __logicalName = "WebServer"
+ instanceType = instanceType
+ ami = ec2Ami
+ userData = "#!/bin/bash\necho 'Hello, World from ${webSecGrp.arn}!' > index.html\nnohup python -m SimpleHTTPServer 80 &"
+ vpcSecurityGroupIds = [webSecGrp.id]
+}
+
+resource usEast2Provider "pulumi:providers:aws" {
+ __logicalName = "UsEast2Provider"
+ region = "us-east-2"
+}
+
+resource myBucket "aws:s3/bucket:Bucket" {
+ __logicalName = "MyBucket"
+
+ options {
+ provider = usEast2Provider
+ }
+}
+
+output instanceId {
+ __logicalName = "InstanceId"
+ value = webServer.id
+}
+
+output publicIp {
+ __logicalName = "PublicIp"
+ value = webServer.publicIp
+}
+
+output publicHostName {
+ __logicalName = "PublicHostName"
+ value = webServer.publicDns
+}
diff --git a/sdk/dotnet/cmd/pulumi-language-dotnet/main.go b/sdk/dotnet/cmd/pulumi-language-dotnet/main.go
index 7dbac0e40a1a..0eba102f29d5 100644
--- a/sdk/dotnet/cmd/pulumi-language-dotnet/main.go
+++ b/sdk/dotnet/cmd/pulumi-language-dotnet/main.go
@@ -372,7 +372,7 @@ func DeterminePluginDependency(packageDir, packageName, packageVersion string) (
case os.IsNotExist(err):
break
case err != nil:
- return nil, fmt.Errorf("Failed to read version file: %w", err)
+ return nil, fmt.Errorf("failed to read version file: %w", err)
}
defaultName := strings.ToLower(strings.TrimPrefix(packageName, "Pulumi."))
@@ -403,7 +403,7 @@ func DeterminePluginDependency(packageDir, packageName, packageVersion string) (
_, err = semver.ParseTolerant(version)
if err != nil {
- return nil, fmt.Errorf("Invalid package version: %w", err)
+ return nil, fmt.Errorf("invalid package version: %w", err)
}
result := &pulumirpc.PluginDependency{
@@ -545,7 +545,7 @@ func (w *logWriter) LogToUser(val string) (int, error) {
return len(val), nil
}
-// RPC endpoint for LanguageRuntimeServer::Run
+// Run is the RPC endpoint for LanguageRuntimeServer::Run
func (host *dotnetLanguageHost) Run(ctx context.Context, req *pulumirpc.RunRequest) (*pulumirpc.RunResponse, error) {
config, err := host.constructConfig(req)
if err != nil {
@@ -769,7 +769,7 @@ func (host *dotnetLanguageHost) GetProgramDependencies(
}
cmd := exec.Command(ex, cmdArgs...)
if out, err = cmd.Output(); err != nil {
- return nil, fmt.Errorf("Failed to call \"%s\": %w", ex, err)
+ return nil, fmt.Errorf("failed to call \"%s\": %w", ex, err)
}
lines := strings.Split(strings.ReplaceAll(string(out), "\r\n", "\n"), "\n")
var packages []*pulumirpc.DependencyInfo
@@ -793,7 +793,7 @@ func (host *dotnetLanguageHost) GetProgramDependencies(
// Transitive package => name version
version = 1
} else {
- return nil, fmt.Errorf("Failed to parse \"%s\"", p)
+ return nil, fmt.Errorf("failed to parse \"%s\"", p)
}
packages = append(packages, &pulumirpc.DependencyInfo{
Name: nameRequiredVersion[0],
diff --git a/sdk/go/auto/local_workspace.go b/sdk/go/auto/local_workspace.go
index 15aae0f6c44c..bd8b15534159 100644
--- a/sdk/go/auto/local_workspace.go
+++ b/sdk/go/auto/local_workspace.go
@@ -462,7 +462,7 @@ func (l *LocalWorkspace) ImportStack(ctx context.Context, stackName string, stat
return nil
}
-// Outputs get the current set of Stack outputs from the last Stack.Up().
+// StackOutputs gets the current set of Stack outputs from the last Stack.Up().
func (l *LocalWorkspace) StackOutputs(ctx context.Context, stackName string) (OutputMap, error) {
// standard outputs
outStdout, outStderr, code, err := l.runPulumiCmdSync(ctx, "stack", "output", "--json", "--stack", stackName)
diff --git a/sdk/go/auto/optdestroy/optdestroy.go b/sdk/go/auto/optdestroy/optdestroy.go
index 4bb139cbc578..6e67aaa44204 100644
--- a/sdk/go/auto/optdestroy/optdestroy.go
+++ b/sdk/go/auto/optdestroy/optdestroy.go
@@ -87,7 +87,7 @@ func UserAgent(agent string) Option {
})
}
-// Show config secrets when they appear.
+// ShowSecrets configures whether to show config secrets when they appear.
func ShowSecrets(show bool) Option {
return optionFunc(func(opts *Options) {
opts.ShowSecrets = &show
diff --git a/sdk/go/auto/opthistory/opthistory.go b/sdk/go/auto/opthistory/opthistory.go
index d3f1ec1be1bf..24ed94949108 100644
--- a/sdk/go/auto/opthistory/opthistory.go
+++ b/sdk/go/auto/opthistory/opthistory.go
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package optup contains functional options to be used with stack history operations
+// Package opthistory contains functional options to be used with stack history operations
// github.com/sdk/v3/go/x/auto Stack.History(ctx, pageSize, page, ...opthistory.Option)
package opthistory
-// Show config secrets when they appear.
+// ShowSecrets configures whether to show config secrets when they appear.
func ShowSecrets(show bool) Option {
return optionFunc(func(opts *Options) {
opts.ShowSecrets = &show
diff --git a/sdk/go/auto/optrefresh/optrefresh.go b/sdk/go/auto/optrefresh/optrefresh.go
index 4d9d09af4b49..9aa7d1af51a2 100644
--- a/sdk/go/auto/optrefresh/optrefresh.go
+++ b/sdk/go/auto/optrefresh/optrefresh.go
@@ -87,7 +87,7 @@ func UserAgent(agent string) Option {
})
}
-// Show config secrets when they appear in the config.
+// ShowSecrets configures whether to show config secrets when they appear in the config.
func ShowSecrets(show bool) Option {
return optionFunc(func(opts *Options) {
opts.ShowSecrets = &show
diff --git a/sdk/go/auto/optup/optup.go b/sdk/go/auto/optup/optup.go
index 30bd46506a20..01ea585c8bdc 100644
--- a/sdk/go/auto/optup/optup.go
+++ b/sdk/go/auto/optup/optup.go
@@ -115,7 +115,7 @@ func Plan(path string) Option {
})
}
-// Show config secrets when they appear.
+// ShowSecrets configures whether to show config secrets when they appear.
func ShowSecrets(show bool) Option {
return optionFunc(func(opts *Options) {
opts.ShowSecrets = &show
diff --git a/sdk/go/auto/workspace.go b/sdk/go/auto/workspace.go
index 201f2a437bb7..5dd6238e203f 100644
--- a/sdk/go/auto/workspace.go
+++ b/sdk/go/auto/workspace.go
@@ -107,7 +107,7 @@ type Workspace interface {
// ImportStack imports the specified deployment state into a pre-existing stack.
// This can be combined with ExportStack to edit a stack's state (such as recovery from failed deployments).
ImportStack(context.Context, string, apitype.UntypedDeployment) error
- // Outputs get the current set of Stack outputs from the last Stack.Up().
+ // StackOutputs gets the current set of Stack outputs from the last Stack.Up().
StackOutputs(context.Context, string) (OutputMap, error)
}
diff --git a/sdk/go/common/diag/sink.go b/sdk/go/common/diag/sink.go
index 07112ea11505..e4bf4bf82a65 100644
--- a/sdk/go/common/diag/sink.go
+++ b/sdk/go/common/diag/sink.go
@@ -17,12 +17,10 @@ package diag
import (
"bytes"
"fmt"
- "io"
- "io/ioutil"
-
"github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/logging"
+ "io"
)
// Sink facilitates pluggable diagnostics messages.
@@ -67,7 +65,7 @@ func DefaultSink(stdout io.Writer, stderr io.Writer, opts FormatOptions) Sink {
contract.Require(stdout != nil, "stdout")
contract.Require(stderr != nil, "stderr")
// Discard debug output by default unless requested.
- debug := ioutil.Discard
+ debug := io.Discard
if opts.Debug {
debug = stdout
}
diff --git a/sdk/go/common/diag/sink_test.go b/sdk/go/common/diag/sink_test.go
index 0087db6a1a61..3713a141cd65 100644
--- a/sdk/go/common/diag/sink_test.go
+++ b/sdk/go/common/diag/sink_test.go
@@ -16,7 +16,6 @@ package diag
import (
"io"
- "io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
@@ -27,11 +26,11 @@ import (
func discardSink() Sink {
// Create a new default sink with /dev/null writers to avoid spamming the test log.
return newDefaultSink(FormatOptions{Color: colors.Never}, map[Severity]io.Writer{
- Debug: ioutil.Discard,
- Info: ioutil.Discard,
- Infoerr: ioutil.Discard,
- Error: ioutil.Discard,
- Warning: ioutil.Discard,
+ Debug: io.Discard,
+ Info: io.Discard,
+ Infoerr: io.Discard,
+ Error: io.Discard,
+ Warning: io.Discard,
})
}
diff --git a/sdk/go/common/resource/asset.go b/sdk/go/common/resource/asset.go
index 2187a63f690d..8d4c38609d6b 100644
--- a/sdk/go/common/resource/asset.go
+++ b/sdk/go/common/resource/asset.go
@@ -23,7 +23,6 @@ import (
"encoding/hex"
"fmt"
"io"
- "io/ioutil"
"net/http"
"net/url"
"os"
@@ -303,7 +302,7 @@ func (a *Asset) Bytes() ([]byte, error) {
if err != nil {
return nil, err
}
- return ioutil.ReadAll(blob)
+ return io.ReadAll(blob)
}
// Read begins reading an asset.
@@ -352,11 +351,11 @@ func (a *Asset) readPath() (*Blob, error) {
}
func (a *Asset) readURI() (*Blob, error) {
- url, isurl, err := a.GetURIURL()
+ url, isURL, err := a.GetURIURL()
if err != nil {
return nil, err
}
- contract.Assertf(isurl, "Expected a URI-based asset")
+ contract.Assertf(isURL, "Expected a URI-based asset")
switch s := url.Scheme; s {
case "http", "https":
resp, err := httputil.GetWithRetry(url.String(), http.DefaultClient)
@@ -416,7 +415,7 @@ func (blob *Blob) Size() int64 { return blob.sz }
// NewByteBlob creates a new byte blob.
func NewByteBlob(data []byte) *Blob {
return &Blob{
- rd: ioutil.NopCloser(bytes.NewReader(data)),
+ rd: io.NopCloser(bytes.NewReader(data)),
sz: int64(len(data)),
}
}
@@ -441,7 +440,7 @@ func NewReadCloserBlob(r io.ReadCloser) (*Blob, error) {
}
// Otherwise, read it all in, and create a blob out of that.
defer contract.IgnoreClose(r)
- data, err := ioutil.ReadAll(r)
+ data, err := io.ReadAll(r)
if err != nil {
return nil, err
}
@@ -886,11 +885,11 @@ func (a *Archive) readPath() (ArchiveReader, error) {
func (a *Archive) readURI() (ArchiveReader, error) {
// To read a URI-based archive, fetch the contents remotely and use the extension to pick the format to use.
- url, isurl, err := a.GetURIURL()
+ url, isURL, err := a.GetURIURL()
if err != nil {
return nil, err
}
- contract.Assertf(isurl, "Expected a URI-based asset")
+ contract.Assertf(isURL, "Expected a URI-based asset")
format := detectArchiveFormat(url.Path)
if format == NotArchive {
@@ -1052,7 +1051,7 @@ func addNextFileToZIP(r ArchiveReader, zw *zip.Writer, seenFiles map[string]bool
// the ZIP format includes a date representation that starts at 1980. Use `SetModTime` to
// remain compatible with Go 1.9.
// nolint: megacheck
- fh.SetModTime(time.Date(1990, time.January, 1, 0, 0, 0, 0, time.UTC))
+ fh.Modified = time.Date(1990, time.January, 1, 0, 0, 0, 0, time.UTC)
fw, err := zw.CreateHeader(fh)
if err != nil {
@@ -1188,7 +1187,7 @@ func readArchive(ar io.ReadCloser, format ArchiveFormat) (ArchiveReader, error)
}
ra = f
sz = stat.Size()
- } else if data, err := ioutil.ReadAll(ar); err != nil {
+ } else if data, err := io.ReadAll(ar); err != nil {
return nil, err
} else {
ra = bytes.NewReader(data)
@@ -1220,7 +1219,7 @@ func (r *tarArchiveReader) Next() (string, *Blob, error) {
case tar.TypeReg:
// Return the tar reader for this file's contents.
data := &Blob{
- rd: ioutil.NopCloser(r.tr),
+ rd: io.NopCloser(r.tr),
sz: file.Size,
}
name := filepath.Clean(file.Name)
diff --git a/sdk/go/common/resource/asset_test.go b/sdk/go/common/resource/asset_test.go
index 512216077753..67665f9e4dee 100644
--- a/sdk/go/common/resource/asset_test.go
+++ b/sdk/go/common/resource/asset_test.go
@@ -20,7 +20,6 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"math/rand"
"os"
"path/filepath"
@@ -120,7 +119,7 @@ func TestAssetSerialize(t *testing.T) {
t.Run("path asset", func(t *testing.T) {
t.Parallel()
- f, err := ioutil.TempFile("", "")
+ f, err := os.CreateTemp("", "")
assert.Nil(t, err)
file := f.Name()
asset, err := NewPathAsset(file)
@@ -422,7 +421,7 @@ func TestArchiveTarFiles(t *testing.T) {
arch, err := NewPathArchive(repoRoot)
assert.Nil(t, err)
- err = arch.Archive(TarArchive, ioutil.Discard)
+ err = arch.Archive(TarArchive, io.Discard)
assert.Nil(t, err)
}
@@ -436,7 +435,7 @@ func TestArchiveZipFiles(t *testing.T) {
arch, err := NewPathArchive(repoRoot)
assert.Nil(t, err)
- err = arch.Archive(ZIPArchive, ioutil.Discard)
+ err = arch.Archive(ZIPArchive, io.Discard)
assert.Nil(t, err)
}
@@ -445,12 +444,12 @@ func TestNestedArchive(t *testing.T) {
t.Parallel()
// Create temp dir and place some files.
- dirName, err := ioutil.TempDir("", "")
+ dirName, err := os.MkdirTemp("", "")
assert.Nil(t, err)
assert.NoError(t, os.MkdirAll(filepath.Join(dirName, "foo", "bar"), 0777))
- assert.NoError(t, ioutil.WriteFile(filepath.Join(dirName, "foo", "a.txt"), []byte("a"), 0777))
- assert.NoError(t, ioutil.WriteFile(filepath.Join(dirName, "foo", "bar", "b.txt"), []byte("b"), 0777))
- assert.NoError(t, ioutil.WriteFile(filepath.Join(dirName, "c.txt"), []byte("c"), 0777))
+ assert.NoError(t, os.WriteFile(filepath.Join(dirName, "foo", "a.txt"), []byte("a"), 0777))
+ assert.NoError(t, os.WriteFile(filepath.Join(dirName, "foo", "bar", "b.txt"), []byte("b"), 0777))
+ assert.NoError(t, os.WriteFile(filepath.Join(dirName, "c.txt"), []byte("c"), 0777))
// Construct an AssetArchive with a nested PathArchive.
innerArch, err := NewPathArchive(filepath.Join(dirName, "./foo"))
@@ -464,7 +463,7 @@ func TestNestedArchive(t *testing.T) {
assert.Nil(t, err)
// Write a ZIP of the AssetArchive to disk.
- tmpFile, err := ioutil.TempFile("", "")
+ tmpFile, err := os.CreateTemp("", "")
fileName := tmpFile.Name()
assert.Nil(t, err)
err = arch.Archive(ZIPArchive, tmpFile)
@@ -488,10 +487,10 @@ func TestFileReferencedThroughMultiplePaths(t *testing.T) {
t.Parallel()
// Create temp dir and place some files.
- dirName, err := ioutil.TempDir("", "")
+ dirName, err := os.MkdirTemp("", "")
assert.Nil(t, err)
assert.NoError(t, os.MkdirAll(filepath.Join(dirName, "foo", "bar"), 0777))
- assert.NoError(t, ioutil.WriteFile(filepath.Join(dirName, "foo", "bar", "b.txt"), []byte("b"), 0777))
+ assert.NoError(t, os.WriteFile(filepath.Join(dirName, "foo", "bar", "b.txt"), []byte("b"), 0777))
// Construct an AssetArchive with a nested PathArchive.
outerArch, err := NewPathArchive(filepath.Join(dirName, "./foo"))
@@ -505,7 +504,7 @@ func TestFileReferencedThroughMultiplePaths(t *testing.T) {
assert.Nil(t, err)
// Write a ZIP of the AssetArchive to disk.
- tmpFile, err := ioutil.TempFile("", "")
+ tmpFile, err := os.CreateTemp("", "")
fileName := tmpFile.Name()
assert.Nil(t, err)
err = arch.Archive(ZIPArchive, tmpFile)
@@ -545,7 +544,7 @@ func TestInvalidPathArchive(t *testing.T) {
t.Parallel()
// Create a temp file that is not an asset.
- tmpFile, err := ioutil.TempFile("", "")
+ tmpFile, err := os.CreateTemp("", "")
fileName := tmpFile.Name()
assert.NoError(t, err)
fmt.Fprintf(tmpFile, "foo\n")
diff --git a/sdk/go/common/resource/config/key.go b/sdk/go/common/resource/config/key.go
index c1bfb061ac30..a7d287b9b84c 100644
--- a/sdk/go/common/resource/config/key.go
+++ b/sdk/go/common/resource/config/key.go
@@ -49,7 +49,7 @@ func ParseKey(s string) (Key, error) {
return Key{namespace: s[:idx], name: s[idx+1:]}, nil
case 2:
if mm, err := tokens.ParseModuleMember(s); err == nil {
- if mm.Module().Name() == tokens.ModuleName("config") {
+ if mm.Module().Name() == "config" {
return Key{
namespace: mm.Module().Package().String(),
name: mm.Name().String(),
@@ -62,11 +62,11 @@ func ParseKey(s string) (Key, error) {
"(configuration keys should be of the form `:`)", s)
}
-func (k Key) Namespace() string {
+func (k *Key) Namespace() string {
return k.namespace
}
-func (k Key) Name() string {
+func (k *Key) Name() string {
return k.name
}
diff --git a/sdk/go/common/resource/plugin/analyzer_plugin.go b/sdk/go/common/resource/plugin/analyzer_plugin.go
index c8b3344847ff..c40904786e73 100644
--- a/sdk/go/common/resource/plugin/analyzer_plugin.go
+++ b/sdk/go/common/resource/plugin/analyzer_plugin.go
@@ -222,7 +222,7 @@ func (a *analyzer) AnalyzeStack(resources []AnalyzerStackResource) ([]AnalyzeDia
continue
}
- pdeps := []string{}
+ pdeps := make([]string, 0, 1)
for _, d := range pd {
pdeps = append(pdeps, string(d))
}
@@ -604,7 +604,7 @@ func convertEnforcementLevel(el pulumirpc.EnforcementLevel) (apitype.Enforcement
return apitype.Disabled, nil
default:
- return "", fmt.Errorf("Invalid enforcement level %d", el)
+ return "", fmt.Errorf("invalid enforcement level %d", el)
}
}
@@ -615,8 +615,7 @@ func convertConfigSchema(schema *pulumirpc.PolicyConfigSchema) *AnalyzerPolicyCo
props := make(map[string]JSONSchema)
for k, v := range unmarshalMap(schema.GetProperties()) {
- s := v.(map[string]interface{})
- props[k] = JSONSchema(s)
+ props[k] = v.(JSONSchema)
}
return &AnalyzerPolicyConfigSchema{
diff --git a/sdk/go/common/resource/plugin/context.go b/sdk/go/common/resource/plugin/context.go
index 65656eeec483..7f5d671183af 100644
--- a/sdk/go/common/resource/plugin/context.go
+++ b/sdk/go/common/resource/plugin/context.go
@@ -16,7 +16,7 @@ package plugin
import (
"context"
- "io/ioutil"
+ "io"
"github.com/opentracing/opentracing-go"
@@ -67,16 +67,16 @@ func NewContext(d, statusD diag.Sink, host Host, _ ConfigSource,
disableProviderPreview, parentSpan, plugins)
}
-// Variation of NewContext that also sets known project Root. Additionally accepts Plugins
+// NewContextWithRoot is a variation of NewContext that also sets known project Root. Additionally accepts Plugins
func NewContextWithRoot(d, statusD diag.Sink, host Host,
pwd, root string, runtimeOptions map[string]interface{}, disableProviderPreview bool,
parentSpan opentracing.Span, plugins *workspace.Plugins) (*Context, error) {
if d == nil {
- d = diag.DefaultSink(ioutil.Discard, ioutil.Discard, diag.FormatOptions{Color: colors.Never})
+ d = diag.DefaultSink(io.Discard, io.Discard, diag.FormatOptions{Color: colors.Never})
}
if statusD == nil {
- statusD = diag.DefaultSink(ioutil.Discard, ioutil.Discard, diag.FormatOptions{Color: colors.Never})
+ statusD = diag.DefaultSink(io.Discard, io.Discard, diag.FormatOptions{Color: colors.Never})
}
ctx := &Context{
diff --git a/sdk/go/common/resource/plugin/host_server.go b/sdk/go/common/resource/plugin/host_server.go
index 8428df67254a..b2b32bf783c9 100644
--- a/sdk/go/common/resource/plugin/host_server.go
+++ b/sdk/go/common/resource/plugin/host_server.go
@@ -112,7 +112,7 @@ func (eng *hostServer) GetRootResource(ctx context.Context,
return &response, nil
}
-// SetRootResources sets the current root resource's URN. Generally only called on startup when the Stack resource is
+// SetRootResource sets the current root resource's URN. Generally only called on startup when the Stack resource is
// registered.
func (eng *hostServer) SetRootResource(ctx context.Context,
req *lumirpc.SetRootResourceRequest) (*lumirpc.SetRootResourceResponse, error) {
diff --git a/sdk/go/common/resource/plugin/provider.go b/sdk/go/common/resource/plugin/provider.go
index 317b0058ba4e..446f8f23daf4 100644
--- a/sdk/go/common/resource/plugin/provider.go
+++ b/sdk/go/common/resource/plugin/provider.go
@@ -227,7 +227,7 @@ type DiffResult struct {
DeleteBeforeReplace bool // if true, this resource must be deleted before recreating it.
}
-// Computes the detailed diff of Updated, Added and Deleted keys.
+// NewDetailedDiffFromObjectDiff computes the detailed diff of Updated, Added and Deleted keys.
func NewDetailedDiffFromObjectDiff(diff *resource.ObjectDiff) map[string]PropertyDiff {
if diff == nil {
return map[string]PropertyDiff{}
diff --git a/sdk/go/common/resource/plugin/provider_plugin.go b/sdk/go/common/resource/plugin/provider_plugin.go
index 1ad4d0dc808d..3f67cca0aa75 100644
--- a/sdk/go/common/resource/plugin/provider_plugin.go
+++ b/sdk/go/common/resource/plugin/provider_plugin.go
@@ -154,7 +154,7 @@ func NewProvider(host Host, ctx *Context, pkg tokens.Package, version *semver.Ve
return p, nil
}
-// Create a new provider by loading the plugin binary located at `path`.
+// NewProviderFromPath creates a new provider by loading the plugin binary located at `path`.
func NewProviderFromPath(host Host, ctx *Context, path string) (Provider, error) {
env := os.Environ()
plug, err := newPlugin(ctx, ctx.Pwd, path, "",
diff --git a/sdk/go/common/resource/plugin/rpc_test.go b/sdk/go/common/resource/plugin/rpc_test.go
index c2002c3959e5..ed3131de5fea 100644
--- a/sdk/go/common/resource/plugin/rpc_test.go
+++ b/sdk/go/common/resource/plugin/rpc_test.go
@@ -1656,7 +1656,7 @@ func walkValueSelfWithDescendants(
visit func(path string, v *structpb.Value) error) error {
if v == nil {
- return fmt.Errorf("Bad *structpb.Value nil at %s", path)
+ return fmt.Errorf("bad *structpb.Value nil at %s", path)
}
err := visit(path, v)
if err != nil {
@@ -1688,7 +1688,7 @@ func walkValueSelfWithDescendants(
case *structpb.Value_NullValue:
return nil
default:
- return fmt.Errorf("Bad *structpb.Value of unknown type at %s: %v", path, v)
+ return fmt.Errorf("bad *structpb.Value of unknown type at %s: %v", path, v)
}
return nil
}
diff --git a/sdk/go/common/resource/properties.go b/sdk/go/common/resource/properties.go
index cc6105bbc199..90950acaab0f 100644
--- a/sdk/go/common/resource/properties.go
+++ b/sdk/go/common/resource/properties.go
@@ -142,14 +142,14 @@ func (err *ReqError) Error() string {
// HasValue returns true if the slot associated with the given property key contains a real value. It returns false
// if a value is null or an output property that is awaiting a value to be assigned. That is to say, HasValue indicates
// a semantically meaningful value is present (even if it's a computed one whose concrete value isn't yet evaluated).
-func (m PropertyMap) HasValue(k PropertyKey) bool {
- v, has := m[k]
+func (props PropertyMap) HasValue(k PropertyKey) bool {
+ v, has := props[k]
return has && v.HasValue()
}
// ContainsUnknowns returns true if the property map contains at least one unknown value.
-func (m PropertyMap) ContainsUnknowns() bool {
- for _, v := range m {
+func (props PropertyMap) ContainsUnknowns() bool {
+ for _, v := range props {
if v.ContainsUnknowns() {
return true
}
@@ -158,8 +158,8 @@ func (m PropertyMap) ContainsUnknowns() bool {
}
// ContainsSecrets returns true if the property map contains at least one secret value.
-func (m PropertyMap) ContainsSecrets() bool {
- for _, v := range m {
+func (props PropertyMap) ContainsSecrets() bool {
+ for _, v := range props {
if v.ContainsSecrets() {
return true
}
@@ -168,40 +168,40 @@ func (m PropertyMap) ContainsSecrets() bool {
}
// Mappable returns a mapper-compatible object map, suitable for deserialization into structures.
-func (m PropertyMap) Mappable() map[string]interface{} {
- return m.MapRepl(nil, nil)
+func (props PropertyMap) Mappable() map[string]interface{} {
+ return props.MapRepl(nil, nil)
}
// MapRepl returns a mapper-compatible object map, suitable for deserialization into structures. A key and/or value
// replace function, replk/replv, may be passed that will replace elements using custom logic if appropriate.
-func (m PropertyMap) MapRepl(replk func(string) (string, bool),
+func (props PropertyMap) MapRepl(replk func(string) (string, bool),
replv func(PropertyValue) (interface{}, bool)) map[string]interface{} {
obj := make(map[string]interface{})
- for _, k := range m.StableKeys() {
+ for _, k := range props.StableKeys() {
key := string(k)
if replk != nil {
if rk, repk := replk(key); repk {
key = rk
}
}
- obj[key] = m[k].MapRepl(replk, replv)
+ obj[key] = props[k].MapRepl(replk, replv)
}
return obj
}
// Copy makes a shallow copy of the map.
-func (m PropertyMap) Copy() PropertyMap {
+func (props PropertyMap) Copy() PropertyMap {
new := make(PropertyMap)
- for k, v := range m {
+ for k, v := range props {
new[k] = v
}
return new
}
// StableKeys returns all of the map's keys in a stable order.
-func (m PropertyMap) StableKeys() []PropertyKey {
- sorted := make([]PropertyKey, 0, len(m))
- for k := range m {
+func (props PropertyMap) StableKeys() []PropertyKey {
+ sorted := make([]PropertyKey, 0, len(props))
+ for k := range props {
sorted = append(sorted, k)
}
sort.Slice(sorted, func(i, j int) bool { return sorted[i] < sorted[j] })
diff --git a/sdk/go/common/resource/properties_diff.go b/sdk/go/common/resource/properties_diff.go
index b2cc5b0f6ada..c10219ea28a5 100644
--- a/sdk/go/common/resource/properties_diff.go
+++ b/sdk/go/common/resource/properties_diff.go
@@ -55,7 +55,7 @@ func (diff *ObjectDiff) Same(k PropertyKey) bool {
return !diff.Changed(k)
}
-// Returns true if there are no changes (adds, deletes, updates) in the diff. Also returns true if
+// AnyChanges returns true if there are no changes (adds, deletes, updates) in the diff. Also returns true if
// diff is nil. Otherwise returns false.
func (diff *ObjectDiff) AnyChanges() bool {
return diff != nil && len(diff.Adds)+len(diff.Deletes)+len(diff.Updates) > 0
@@ -393,7 +393,7 @@ func (v PropertyValue) DeepEquals(other PropertyValue) bool {
return v.V == other.V
}
-// Diff returns a diffset by comparing the property map to another; it returns nil if there are no diffs.
+// DiffIncludeUnknowns returns a diffset by comparing the property map to another; it returns nil if there are no diffs.
func (props PropertyMap) DiffIncludeUnknowns(other PropertyMap, ignoreKeys ...IgnoreKeyFunc) *ObjectDiff {
adds := make(PropertyMap)
deletes := make(PropertyMap)
diff --git a/sdk/go/common/resource/resource_id.go b/sdk/go/common/resource/resource_id.go
index b46410b08b38..29da8693c712 100644
--- a/sdk/go/common/resource/resource_id.go
+++ b/sdk/go/common/resource/resource_id.go
@@ -90,27 +90,27 @@ func NewUniqueHexID(prefix string, randlen, maxlen int) (ID, error) {
return ID(u), err
}
-// NewFixedUniqueHex generates a new "random" hex string for use by resource providers. It will take the optional prefix
-// and append randlen random characters (defaulting to 8 if not > 0). The result must not exceed maxlen total
-// characterss (if > 0). Note that capping to maxlen necessarily increases the risk of collisions.
+// NewUniqueHexV2 generates a new "random" hex string for use by resource providers. It will take the optional prefix
+// and append randLen random characters (defaulting to 8 if not > 0). The result must not exceed maxLen total
+// characters (if > 0). Note that capping to maxLen necessarily increases the risk of collisions.
// The randomness for this method is a function of urn and sequenceNumber iff sequenceNUmber > 0, else it falls back to
// a non-deterministic source of randomness.
-func NewUniqueHexV2(urn URN, sequenceNumber int, prefix string, randlen, maxlen int) (string, error) {
- if randlen <= 0 {
- randlen = 8
+func NewUniqueHexV2(urn URN, sequenceNumber int, prefix string, randLen, maxLen int) (string, error) {
+ if randLen <= 0 {
+ randLen = 8
}
- if maxlen > 0 && len(prefix)+randlen > maxlen {
+ if maxLen > 0 && len(prefix)+randLen > maxLen {
return "", errors.Errorf(
- "name '%s' plus %d random chars is longer than maximum length %d", prefix, randlen, maxlen)
+ "name '%s' plus %d random chars is longer than maximum length %d", prefix, randLen, maxLen)
}
if sequenceNumber == 0 {
// No sequence number fallback to old logic
- return NewUniqueHex(prefix, randlen, maxlen)
+ return NewUniqueHex(prefix, randLen, maxLen)
}
- if randlen > 32 {
- return "", errors.Errorf("randLen is longer than 32, %d", randlen)
+ if randLen > 32 {
+ return "", errors.Errorf("randLen is longer than 32, %d", randLen)
}
// TODO(seqnum) This is seeded by urn and sequence number, and urn has the stack and project names in it.
@@ -127,7 +127,7 @@ func NewUniqueHexV2(urn URN, sequenceNumber int, prefix string, randlen, maxlen
bs := hasher.Sum(nil)
contract.Assert(len(bs) == 64)
- return prefix + hex.EncodeToString(bs)[:randlen], nil
+ return prefix + hex.EncodeToString(bs)[:randLen], nil
}
// NewUniqueName generates a new "random" string primarily intended for use by resource providers for
diff --git a/sdk/go/common/testing/environment.go b/sdk/go/common/testing/environment.go
index 6b10bec563c6..53e7bb0f96ff 100644
--- a/sdk/go/common/testing/environment.go
+++ b/sdk/go/common/testing/environment.go
@@ -245,7 +245,7 @@ func (e *Environment) WriteTestFile(filename string, contents string) {
e.T.Fatalf("error making directories for test file (%v): %v", filename, err)
}
- if err := ioutil.WriteFile(filename, []byte(contents), os.ModePerm); err != nil {
+ if err := os.WriteFile(filename, []byte(contents), os.ModePerm); err != nil {
e.T.Fatalf("writing test file (%v): %v", filename, err)
}
}
diff --git a/sdk/go/common/util/archive/archive_test.go b/sdk/go/common/util/archive/archive_test.go
index 04ba04ad0d9e..187cfe4b86a0 100644
--- a/sdk/go/common/util/archive/archive_test.go
+++ b/sdk/go/common/util/archive/archive_test.go
@@ -138,7 +138,7 @@ func doArchiveTest(t *testing.T, path string, files ...fileContents) {
}
func archiveContents(prefixPathInsideTar, path string, files ...fileContents) ([]byte, error) {
- dir, err := ioutil.TempDir("", "archive-test")
+ dir, err := os.MkdirTemp("", "archive-test")
if err != nil {
return nil, err
}
diff --git a/sdk/go/common/util/ciutil/github_actions.go b/sdk/go/common/util/ciutil/github_actions.go
index 1ff18ec7932a..9b4de9cb5fd9 100644
--- a/sdk/go/common/util/ciutil/github_actions.go
+++ b/sdk/go/common/util/ciutil/github_actions.go
@@ -17,7 +17,6 @@ package ciutil
import (
"encoding/json"
"fmt"
- "io/ioutil"
"os"
"strconv"
)
@@ -74,7 +73,7 @@ func (t githubActionsCI) DetectVars() Vars {
return v
}
-// TryGetEvent returns the GitHub webhook payload found in the GitHub Actions environment.
+// GetPREvent returns the GitHub webhook payload found in the GitHub Actions environment.
// GitHub stores the JSON payload of the webhook that triggered the workflow in a path.
// The path is set as the value of the env var GITHUB_EVENT_PATH. Returns nil if an error
// is encountered or the GITHUB_EVENT_PATH is not set.
@@ -84,7 +83,7 @@ func (t githubActionsCI) GetPREvent() *githubActionsPullRequestEvent {
return nil
}
- b, err := ioutil.ReadFile(eventPath)
+ b, err := os.ReadFile(eventPath)
if err != nil {
return nil
}
diff --git a/sdk/go/common/util/cmdutil/spinner.go b/sdk/go/common/util/cmdutil/spinner.go
index 64d405f6cd50..7df00753f04f 100644
--- a/sdk/go/common/util/cmdutil/spinner.go
+++ b/sdk/go/common/util/cmdutil/spinner.go
@@ -54,11 +54,11 @@ func NewSpinnerAndTicker(prefix string, ttyFrames []string,
// Spinner represents a very simple progress reporter.
type Spinner interface {
- // Print the next frame of the spinner. After Tick() has been called, there should be no writes to Stdout before
+ // Tick prints the next frame of the spinner. After Tick() has been called, there should be no writes to Stdout before
// calling Reset().
Tick()
- // Called to release ownership of stdout, so others may write to it.
+ // Reset is called to release ownership of stdout, so others may write to it.
Reset()
}
diff --git a/sdk/go/common/util/cmdutil/trace.go b/sdk/go/common/util/cmdutil/trace.go
index d7162c17071f..fbb84887edc6 100644
--- a/sdk/go/common/util/cmdutil/trace.go
+++ b/sdk/go/common/util/cmdutil/trace.go
@@ -17,7 +17,6 @@ package cmdutil
import (
"fmt"
"io"
- "io/ioutil"
"log"
"net"
"net/url"
@@ -37,11 +36,11 @@ import (
// TracingEndpoint is the Zipkin-compatible tracing endpoint where tracing data will be sent.
var TracingEndpoint string
-// Deprecated. TracingToFile=true if pulumi was called with a file://
-// scheme URL (--tracing=file:///...). Even in this case
-// TracingEndpoint will now have the tcp:// scheme and will point to a
-// proxy server that will append traces to the user-specified file.
-// Plugins should respect TracingEndpoint and ignore TracingToFile.
+// TracingToFile indicates if pulumi was called with a file:// scheme URL (--tracing=file:///...).
+//
+// Deprecated: Even in this case TracingEndpoint will now have the tcp:// scheme and will point to a
+// proxy server that will append traces to the user-specified file. Plugins should respect
+// TracingEndpoint and ignore TracingToFile.
var TracingToFile bool
var TracingRootSpan opentracing.Span
@@ -195,7 +194,7 @@ func startProxyAppDashServer(collector appdash.Collector) (string, error) {
// The default sends to stderr, which is unfortunate for
// end-users. Discard for now.
- cs.Log = log.New(ioutil.Discard, "appdash", 0)
+ cs.Log = log.New(io.Discard, "appdash", 0)
return fmt.Sprintf("tcp://127.0.0.1:%d", collectorPort), nil
}
diff --git a/sdk/go/common/util/gitutil/git.go b/sdk/go/common/util/gitutil/git.go
index f51b0d80d58a..37348fcaa551 100644
--- a/sdk/go/common/util/gitutil/git.go
+++ b/sdk/go/common/util/gitutil/git.go
@@ -43,13 +43,13 @@ type VCSKind = string
const (
defaultGitCloudRepositorySuffix = ".git"
- // The host name for GitLab.
+ // GitLabHostName The host name for GitLab.
GitLabHostName VCSKind = "gitlab.com"
- // The host name for GitHub.
+ // GitHubHostName The host name for GitHub.
GitHubHostName VCSKind = "github.com"
- // The host name for Azure DevOps
+ // AzureDevOpsHostName The host name for Azure DevOps
AzureDevOpsHostName VCSKind = "dev.azure.com"
- // The host name for Bitbucket
+ // BitbucketHostName The host name for Bitbucket
BitbucketHostName VCSKind = "bitbucket.org"
)
diff --git a/sdk/go/common/util/httputil/http.go b/sdk/go/common/util/httputil/http.go
index fde493b78aef..6803deef37f7 100644
--- a/sdk/go/common/util/httputil/http.go
+++ b/sdk/go/common/util/httputil/http.go
@@ -41,7 +41,7 @@ func DoWithRetry(req *http.Request, client *http.Client) (*http.Response, error)
return doWithRetry(req, client, opts)
}
-// DoWithRetry calls client.Do, but retrying 500s (even for POSTs). Using the provided delays.
+// DoWithRetryOpts calls client.Do, but retrying 500s (even for POSTs). Using the provided delays.
func DoWithRetryOpts(req *http.Request, client *http.Client, opts RetryOpts) (*http.Response, error) {
return doWithRetry(req, client, opts)
}
diff --git a/sdk/go/common/util/mapper/mapper.go b/sdk/go/common/util/mapper/mapper.go
index 8a409509a3a2..052c3b0c1757 100644
--- a/sdk/go/common/util/mapper/mapper.go
+++ b/sdk/go/common/util/mapper/mapper.go
@@ -25,7 +25,7 @@ import (
type Mapper interface {
// Decode decodes a JSON-like object into the target pointer to a structure.
Decode(obj map[string]interface{}, target interface{}) MappingError
- // DecodeField decodes a single JSON-like value (with a given type and name) into a target pointer to a structure.
+ // DecodeValue decodes a single JSON-like value (with a given type and name) into a target pointer to a structure.
DecodeValue(obj map[string]interface{}, ty reflect.Type, key string, target interface{}, optional bool) FieldError
// Encode encodes an object into a JSON-like in-memory object.
Encode(source interface{}) (map[string]interface{}, MappingError)
diff --git a/sdk/go/common/util/rpcutil/interceptor.go b/sdk/go/common/util/rpcutil/interceptor.go
index 636e2c031813..48b20e037229 100644
--- a/sdk/go/common/util/rpcutil/interceptor.go
+++ b/sdk/go/common/util/rpcutil/interceptor.go
@@ -36,7 +36,7 @@ func OpenTracingServerInterceptor(parentSpan opentracing.Span, options ...otgrpc
return otgrpc.OpenTracingServerInterceptor(tracer, options...)
}
-// Like OpenTracingServerInterceptor but for instrumenting streaming gRPC calls.
+// OpenTracingStreamServerInterceptor is OpenTracingServerInterceptor for instrumenting streaming gRPC calls.
func OpenTracingStreamServerInterceptor(parentSpan opentracing.Span,
options ...otgrpc.Option) grpc.StreamServerInterceptor {
@@ -61,7 +61,7 @@ func OpenTracingClientInterceptor(options ...otgrpc.Option) grpc.UnaryClientInte
return otgrpc.OpenTracingClientInterceptor(opentracing.GlobalTracer(), options...)
}
-// Like OpenTracingClientInterceptor but for streaming gRPC calls.
+// OpenTracingStreamClientInterceptor is OpenTracingClientInterceptor for streaming gRPC calls.
func OpenTracingStreamClientInterceptor(options ...otgrpc.Option) grpc.StreamClientInterceptor {
options = append(append(options,
// Do not trace calls to the empty method
diff --git a/sdk/go/common/util/rpcutil/writer.go b/sdk/go/common/util/rpcutil/writer.go
index 2a0adc067bd5..caba6258a2bb 100644
--- a/sdk/go/common/util/rpcutil/writer.go
+++ b/sdk/go/common/util/rpcutil/writer.go
@@ -88,7 +88,7 @@ func (w *pipeWriter) Write(p []byte) (int, error) {
return len(p), nil
}
-// Returns a pair of streams for use with the language runtimes InstallDependencies method
+// MakeStreams returns a pair of streams for use with the language runtimes InstallDependencies method
func MakeStreams(
server pulumirpc.LanguageRuntime_InstallDependenciesServer,
isTerminal bool) (io.Closer, io.Writer, io.Writer, error) {
diff --git a/sdk/go/common/workspace/plugins.go b/sdk/go/common/workspace/plugins.go
index 152a2f482fa1..37f160f6ed5e 100644
--- a/sdk/go/common/workspace/plugins.go
+++ b/sdk/go/common/workspace/plugins.go
@@ -516,7 +516,7 @@ func (source *checksumSource) Download(
}, length, nil
}
-// Information about a locally installed plugin specified by the project.
+// ProjectPlugin Information about a locally installed plugin specified by the project.
type ProjectPlugin struct {
Name string // the simple name of the plugin.
Kind PluginKind // the kind of the plugin (language, resource, etc).
@@ -524,7 +524,7 @@ type ProjectPlugin struct {
Path string // the path that a plugin is to be loaded from (this will always be a directory)
}
-// Return a PluginSpec object for this project plugin.
+// Spec Return a PluginSpec object for this project plugin.
func (pp ProjectPlugin) Spec() PluginSpec {
return PluginSpec{
Name: pp.Name,
@@ -618,7 +618,7 @@ type PluginInfo struct {
}
// Spec returns the PluginSpec for this PluginInfo
-func (info PluginInfo) Spec() PluginSpec {
+func (info *PluginInfo) Spec() PluginSpec {
return PluginSpec{Name: info.Name, Kind: info.Kind, Version: info.Version}
}
@@ -632,7 +632,7 @@ func (info PluginInfo) String() string {
// Delete removes the plugin from the cache. It also deletes any supporting files in the cache, which includes
// any files that contain the same prefix as the plugin itself.
-func (info PluginInfo) Delete() error {
+func (info *PluginInfo) Delete() error {
dir := info.Path
if err := os.RemoveAll(dir); err != nil {
return err
@@ -1094,17 +1094,18 @@ func (p dirPlugin) writeToDir(dstRoot string) error {
})
}
-// Install installs a plugin's tarball into the cache. It validates that plugin names are in the expected format.
-// Previous versions of Pulumi extracted the tarball to a temp directory first, and then renamed the temp directory
-// to the final directory. The rename operation fails often enough on Windows due to aggressive virus scanners opening
-// files in the temp directory. To address this, we now extract the tarball directly into the final directory, and use
-// file locks to prevent concurrent installs.
+// InstallWithContext installs a plugin's tarball into the cache. It validates that plugin names are in the expected
+// format. Previous versions of Pulumi extracted the tarball to a temp directory first, and then renamed the temp
+// directory to the final directory. The rename operation fails often enough on Windows due to aggressive virus scanners
+// opening files in the temp directory. To address this, we now extract the tarball directly into the final directory,
+// and use file locks to prevent concurrent installs.
+//
// Each plugin has its own file lock, with the same name as the plugin directory, with a `.lock` suffix.
// During installation an empty file with a `.partial` suffix is created, indicating that installation is in-progress.
// The `.partial` file is deleted when installation is complete, indicating that the plugin has finished installing.
// If a failure occurs during installation, the `.partial` file will remain, indicating the plugin wasn't fully
// installed. The next time the plugin is installed, the old installation directory will be removed and replaced with
-// a fresh install.
+// a fresh installation.
func (spec PluginSpec) InstallWithContext(ctx context.Context, content PluginContent, reinstall bool) error {
defer contract.IgnoreClose(content)
diff --git a/sdk/go/common/workspace/project.go b/sdk/go/common/workspace/project.go
index 1739ad3005f6..cfdd6e2c64be 100644
--- a/sdk/go/common/workspace/project.go
+++ b/sdk/go/common/workspace/project.go
@@ -19,7 +19,6 @@ import (
"encoding/json"
"fmt"
"io"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -237,7 +236,7 @@ func (proj *Project) Validate() error {
return nil
}
-// TrustResourceDependencies returns whether or not this project's runtime can be trusted to accurately report
+// TrustResourceDependencies returns whether this project's runtime can be trusted to accurately report
// dependencies. All languages supported by Pulumi today do this correctly. This option remains useful when bringing
// up new Pulumi languages.
func (proj *Project) TrustResourceDependencies() bool {
@@ -440,5 +439,5 @@ func save(path string, value interface{}, mkDirAll bool) error {
}
//nolint: gosec
- return ioutil.WriteFile(path, b, 0644)
+ return os.WriteFile(path, b, 0644)
}
diff --git a/sdk/go/common/workspace/templates.go b/sdk/go/common/workspace/templates.go
index 13a73629f570..802c4dee22ce 100644
--- a/sdk/go/common/workspace/templates.go
+++ b/sdk/go/common/workspace/templates.go
@@ -288,7 +288,7 @@ func retrieveURLTemplates(rawurl string, offline bool, templateKind TemplateKind
var fullPath string
if fullPath, err = RetrieveGitFolder(rawurl, temp); err != nil {
- return TemplateRepository{}, fmt.Errorf("Failed to retrieve git folder: %w", err)
+ return TemplateRepository{}, fmt.Errorf("failed to retrieve git folder: %w", err)
}
return TemplateRepository{
diff --git a/sdk/go/pulumi-language-go/main.go b/sdk/go/pulumi-language-go/main.go
index 4d1d5e54b669..7ea60660873a 100644
--- a/sdk/go/pulumi-language-go/main.go
+++ b/sdk/go/pulumi-language-go/main.go
@@ -232,7 +232,7 @@ func normalizeVersion(version string) (string, error) {
func (m *modInfo) getPlugin() (*pulumirpc.PluginDependency, error) {
pulumiPlugin, err := m.readPulumiPluginJSON()
if err != nil {
- return nil, fmt.Errorf("Failed to load pulumi-plugin.json: %w", err)
+ return nil, fmt.Errorf("failed to load pulumi-plugin.json: %w", err)
}
if (!strings.HasPrefix(m.Path, "github.com/pulumi/pulumi-") && pulumiPlugin == nil) ||
@@ -396,7 +396,7 @@ func runProgram(bin string, env []string) *pulumirpc.RunResponse {
}
}
-// RPC endpoint for LanguageRuntimeServer::Run
+// Run is RPC endpoint for LanguageRuntimeServer::Run
func (host *goLanguageHost) Run(ctx context.Context, req *pulumirpc.RunRequest) (*pulumirpc.RunResponse, error) {
// Create the environment we'll use to run the process. This is how we pass the RunInfo to the actual
// Go program runtime, to avoid needing any sort of program interface other than just a main entrypoint.
@@ -628,7 +628,7 @@ func (host *goLanguageHost) GetProgramDependencies(
cmd := exec.Command(ex, cmdArgs...)
var out []byte
if out, err = cmd.Output(); err != nil {
- return nil, fmt.Errorf("Failed to get modules: %w", err)
+ return nil, fmt.Errorf("failed to get modules: %w", err)
}
dec := json.NewDecoder(bytes.NewReader(out))
@@ -639,7 +639,7 @@ func (host *goLanguageHost) GetProgramDependencies(
if err == io.EOF {
break
}
- return nil, fmt.Errorf("Failed to parse \"%s %s\" output: %w", ex, strings.Join(cmdArgs, " "), err)
+ return nil, fmt.Errorf("failed to parse \"%s %s\" output: %w", ex, strings.Join(cmdArgs, " "), err)
}
parsed = append(parsed, m)
diff --git a/sdk/go/pulumi-language-go/main_test.go b/sdk/go/pulumi-language-go/main_test.go
index 712c70f54539..476852e8fd78 100644
--- a/sdk/go/pulumi-language-go/main_test.go
+++ b/sdk/go/pulumi-language-go/main_test.go
@@ -211,7 +211,7 @@ func TestGetPlugin(t *testing.T) {
}
path := filepath.Join(cwd, c.JSONPath)
err := os.MkdirAll(path, 0700)
- assert.NoErrorf(t, err, "Failed to setup test folder", path)
+ assert.NoErrorf(t, err, "Failed to setup test folder %s", path)
bytes, err := c.JSON.JSON()
assert.NoError(t, err, "Failed to setup test pulumi-plugin.json")
err = os.WriteFile(filepath.Join(path, "pulumi-plugin.json"), bytes, 0600)
diff --git a/sdk/go/pulumi/config/config_test.go b/sdk/go/pulumi/config/config_test.go
index 30136d525bc7..0f4f599d90cf 100644
--- a/sdk/go/pulumi/config/config_test.go
+++ b/sdk/go/pulumi/config/config_test.go
@@ -214,7 +214,7 @@ func TestSecretConfig(t *testing.T) {
if val == "a string value" {
result <- val.(string)
} else {
- errChan <- fmt.Errorf("Invalid result: %v", val)
+ errChan <- fmt.Errorf("invalid result: %v", val)
}
}
@@ -251,7 +251,7 @@ func TestSecretConfig(t *testing.T) {
if reflect.DeepEqual(expectedTestStruct, *ts) {
objResult <- *ts
} else {
- errChan <- fmt.Errorf("Invalid result: %v", val)
+ errChan <- fmt.Errorf("invalid result: %v", val)
}
}
return v, nil
@@ -281,7 +281,7 @@ func TestSecretConfig(t *testing.T) {
if val == true {
resultBool <- val.(bool)
} else {
- errChan <- fmt.Errorf("Invalid result: %v", val)
+ errChan <- fmt.Errorf("invalid result: %v", val)
}
}
@@ -312,7 +312,7 @@ func TestSecretConfig(t *testing.T) {
if val == 42 {
resultInt <- val.(int)
} else {
- errChan <- fmt.Errorf("Invalid result: %v", val)
+ errChan <- fmt.Errorf("invalid result: %v", val)
}
}
diff --git a/sdk/go/pulumi/context.go b/sdk/go/pulumi/context.go
index 483fcdd137c3..bd3bab4c1d42 100644
--- a/sdk/go/pulumi/context.go
+++ b/sdk/go/pulumi/context.go
@@ -716,7 +716,7 @@ func (ctx *Context) getResource(urn string) (*pulumirpc.RegisterResourceResponse
Args: rpcArgs,
})
if err != nil {
- return nil, fmt.Errorf("Invoke(%s, ...): error: %v", tok, err)
+ return nil, fmt.Errorf("invoke(%s, ...): error: %v", tok, err)
}
// If there were any failures from the provider, return them.
diff --git a/sdk/go/pulumi/log.go b/sdk/go/pulumi/log.go
index 08d322bbcfb7..f1f249dbea83 100644
--- a/sdk/go/pulumi/log.go
+++ b/sdk/go/pulumi/log.go
@@ -60,12 +60,12 @@ func (log *logState) Debug(msg string, args *LogArgs) error {
return log._log(pulumirpc.LogSeverity_DEBUG, msg, args)
}
-// Logs an informational message that is generally printed to stdout during resource
+// Info logs an informational message that is generally printed to stdout during resource
func (log *logState) Info(msg string, args *LogArgs) error {
return log._log(pulumirpc.LogSeverity_INFO, msg, args)
}
-// Logs a warning to indicate that something went wrong, but not catastrophically so.
+// Warn logs a warning to indicate that something went wrong, but not catastrophically so.
func (log *logState) Warn(msg string, args *LogArgs) error {
return log._log(pulumirpc.LogSeverity_WARNING, msg, args)
}
diff --git a/sdk/go/pulumi/mocks.go b/sdk/go/pulumi/mocks.go
index bbf4d3248169..1da0b1b6a2c5 100644
--- a/sdk/go/pulumi/mocks.go
+++ b/sdk/go/pulumi/mocks.go
@@ -32,7 +32,7 @@ func WithMocksWithOrganization(organization, project, stack string, mocks MockRe
}
}
-// MockResourceArgs is used to construct call Mock
+// MockCallArgs is used to construct a call Mock
type MockCallArgs struct {
// Token indicates which function is being called. This token is of the form "package:module:function".
Token string
diff --git a/sdk/go/pulumi/types.go b/sdk/go/pulumi/types.go
index c07be0e96d35..19b4157ec35f 100644
--- a/sdk/go/pulumi/types.go
+++ b/sdk/go/pulumi/types.go
@@ -543,7 +543,7 @@ func ToSecret(input interface{}) Output {
return ToSecretWithContext(context.Background(), input)
}
-// Creates an unknown output. This is a low level API and should not be used in programs as this
+// UnsafeUnknownOutput Creates an unknown output. This is a low level API and should not be used in programs as this
// will cause "pulumi up" to fail if called and used during a non-dryrun deployment.
func UnsafeUnknownOutput(deps []Resource) Output {
output, _, _ := NewOutput()
@@ -1096,8 +1096,8 @@ func convert(v interface{}, to reflect.Type) interface{} {
return rv.Convert(to).Interface()
}
-// TODO: ResourceOutput and the init() should probably be code generated.
// ResourceOutput is an Output that returns Resource values.
+// TODO: ResourceOutput and the init() should probably be code generated.
type ResourceOutput struct{ *OutputState }
// ElementType returns the element type of this Output (Resource).
@@ -1113,7 +1113,7 @@ func (o ResourceOutput) ToResourceOutputWithContext(ctx context.Context) Resourc
return o
}
-// An Input type carrying Resource values.
+// ResourceInput is an Input type carrying Resource values.
//
// Unfortunately `Resource` values do not implement `ResourceInput` in
// the current version. Use `NewResourceInput` instead.
diff --git a/sdk/go/pulumi/types_test.go b/sdk/go/pulumi/types_test.go
index 5cea61ae83a0..1114c53504ee 100644
--- a/sdk/go/pulumi/types_test.go
+++ b/sdk/go/pulumi/types_test.go
@@ -514,7 +514,7 @@ func TestUnsecret(t *testing.T) {
// validate the value
resultChan <- val
} else {
- errChan <- fmt.Errorf("Invalid result: %v", val)
+ errChan <- fmt.Errorf("invalid result: %v", val)
}
return val, nil
})
@@ -554,7 +554,7 @@ func TestSecrets(t *testing.T) {
// validate the value
resultChan <- val
} else {
- errChan <- fmt.Errorf("Invalid result: %v", val)
+ errChan <- fmt.Errorf("invalid result: %v", val)
}
return val, nil
})
@@ -600,7 +600,7 @@ func TestSecretApply(t *testing.T) {
// validate the value
resultChan <- val
} else {
- errChan <- fmt.Errorf("Invalid result: %v", val)
+ errChan <- fmt.Errorf("invalid result: %v", val)
}
return val, nil
})
diff --git a/sdk/nodejs/cmd/pulumi-language-nodejs/main.go b/sdk/nodejs/cmd/pulumi-language-nodejs/main.go
index bc01eb236b25..be36a7cb3eef 100644
--- a/sdk/nodejs/cmd/pulumi-language-nodejs/main.go
+++ b/sdk/nodejs/cmd/pulumi-language-nodejs/main.go
@@ -434,7 +434,7 @@ func getPluginVersion(info packageJSON) (string, error) {
// nodejs, we have no problem calling this synchronously, and can block until we get the
// response which we can then synchronously send to nodejs.
-// RPC endpoint for LanguageRuntimeServer::Run
+// Run is the RPC endpoint for LanguageRuntimeServer::Run
func (host *nodeLanguageHost) Run(ctx context.Context, req *pulumirpc.RunRequest) (*pulumirpc.RunResponse, error) {
tracingSpan := opentracing.SpanFromContext(ctx)
@@ -789,18 +789,18 @@ type yarnLockTree struct {
func parseYarnLockFile(path string) ([]*pulumirpc.DependencyInfo, error) {
ex, err := executable.FindExecutable("yarn")
if err != nil {
- return nil, fmt.Errorf("Found %s but no yarn executable: %w", path, err)
+ return nil, fmt.Errorf("found %s but no yarn executable: %w", path, err)
}
cmdArgs := []string{"list", "--json"}
cmd := exec.Command(ex, cmdArgs...)
out, err := cmd.Output()
if err != nil {
- return nil, fmt.Errorf("Failed to run \"%s %s\": %w", ex, strings.Join(cmdArgs, " "), err)
+ return nil, fmt.Errorf("failed to run \"%s %s\": %w", ex, strings.Join(cmdArgs, " "), err)
}
var lock yarnLock
if err = json.Unmarshal(out, &lock); err != nil {
- return nil, fmt.Errorf("Failed to parse\"%s %s\": %w", ex, strings.Join(cmdArgs, " "), err)
+ return nil, fmt.Errorf("failed to parse\"%s %s\": %w", ex, strings.Join(cmdArgs, " "), err)
}
leafs := lock.Data.Trees
@@ -809,11 +809,11 @@ func parseYarnLockFile(path string) ([]*pulumirpc.DependencyInfo, error) {
// Has the form name@version
splitName := func(index int, nameVersion string) (string, string, error) {
if nameVersion == "" {
- return "", "", fmt.Errorf("Expected \"name\" in dependency %d", index)
+ return "", "", fmt.Errorf("expected \"name\" in dependency %d", index)
}
split := strings.LastIndex(nameVersion, "@")
if split == -1 {
- return "", "", fmt.Errorf("Failed to parse name and version from %s", nameVersion)
+ return "", "", fmt.Errorf("failed to parse name and version from %s", nameVersion)
}
return nameVersion[:split], nameVersion[split+1:], nil
}
@@ -849,17 +849,17 @@ type npmPackage struct {
func parseNpmLockFile(path string) ([]*pulumirpc.DependencyInfo, error) {
ex, err := executable.FindExecutable("npm")
if err != nil {
- return nil, fmt.Errorf("Found %s but not npm: %w", path, err)
+ return nil, fmt.Errorf("found %s but not npm: %w", path, err)
}
cmdArgs := []string{"ls", "--json", "--depth=0"}
cmd := exec.Command(ex, cmdArgs...)
out, err := cmd.Output()
if err != nil {
- return nil, fmt.Errorf(`Failed to run "%s %s": %w`, ex, strings.Join(cmdArgs, " "), err)
+ return nil, fmt.Errorf(`failed to run "%s %s": %w`, ex, strings.Join(cmdArgs, " "), err)
}
file := npmFile{}
if err = json.Unmarshal(out, &file); err != nil {
- return nil, fmt.Errorf(`Failed to parse \"%s %s": %w`, ex, strings.Join(cmdArgs, " "), err)
+ return nil, fmt.Errorf(`failed to parse \"%s %s": %w`, ex, strings.Join(cmdArgs, " "), err)
}
result := make([]*pulumirpc.DependencyInfo, len(file.Dependencies))
var i int
@@ -880,7 +880,7 @@ func crossCheckPackageJSONFile(path string, file []byte,
var body packageJSON
if err := json.Unmarshal(file, &body); err != nil {
- return nil, fmt.Errorf("Could not parse %s: %w", path, err)
+ return nil, fmt.Errorf("could not parse %s: %w", path, err)
}
dependencies := make(map[string]string)
for k, v := range body.Dependencies {
@@ -939,19 +939,19 @@ func (host *nodeLanguageHost) GetProgramDependencies(
return nil, err
}
} else if os.IsNotExist(err) {
- return nil, fmt.Errorf("Could not find either %s or %s", yarnFile, npmFile)
+ return nil, fmt.Errorf("could not find either %s or %s", yarnFile, npmFile)
} else {
- return nil, fmt.Errorf("Could not get node dependency data: %w", err)
+ return nil, fmt.Errorf("could not get node dependency data: %w", err)
}
if !req.TransitiveDependencies {
file, err := ioutil.ReadFile(packageFile)
if os.IsNotExist(err) {
- return nil, fmt.Errorf("Could not find %s. "+
+ return nil, fmt.Errorf("could not find %s. "+
"Please include this in your report and run "+
`pulumi about --transitive" to get a list of used packages`,
packageFile)
} else if err != nil {
- return nil, fmt.Errorf("Could not read %s: %w", packageFile, err)
+ return nil, fmt.Errorf("could not read %s: %w", packageFile, err)
}
result, err = crossCheckPackageJSONFile(packageFile, file, result)
if err != nil {
diff --git a/sdk/python/cmd/pulumi-language-python/main.go b/sdk/python/cmd/pulumi-language-python/main.go
index c4a897256def..d25b8ef1b254 100644
--- a/sdk/python/cmd/pulumi-language-python/main.go
+++ b/sdk/python/cmd/pulumi-language-python/main.go
@@ -348,10 +348,10 @@ var packagesWithoutPlugins = map[string]struct{}{
}
type pythonPackage struct {
- Name string `json:"name"`
- Version string `json:"version"`
- Location string `json:"location"`
- plugin *plugin.PulumiPluginJSON `json:"-"`
+ Name string `json:"name"`
+ Version string `json:"version"`
+ Location string `json:"location"`
+ plugin *plugin.PulumiPluginJSON
}
// Returns if pkg is a pulumi package.
@@ -513,7 +513,7 @@ func determinePluginDependency(
// Reference on PEP440: https://www.python.org/dev/peps/pep-0440/
func determinePluginVersion(packageVersion string) (string, error) {
if len(packageVersion) == 0 {
- return "", fmt.Errorf("Cannot parse empty string")
+ return "", fmt.Errorf("cannot parse empty string")
}
// Verify ASCII
for i := 0; i < len(packageVersion); i++ {
@@ -536,7 +536,7 @@ func determinePluginVersion(packageVersion string) (string, error) {
// Explicitly err on epochs
if num, maybeEpoch := parseNumber(packageVersion); num != "" && strings.HasPrefix(maybeEpoch, "!") {
- return "", fmt.Errorf("Epochs are not supported")
+ return "", fmt.Errorf("epochs are not supported")
}
segments := []string{}
@@ -644,7 +644,7 @@ func runPythonCommand(ctx context.Context, virtualenv, cwd string, arg ...string
return output, err
}
-// RPC endpoint for LanguageRuntimeServer::Run
+// Run is RPC endpoint for LanguageRuntimeServer::Run
func (host *pythonLanguageHost) Run(ctx context.Context, req *pulumirpc.RunRequest) (*pulumirpc.RunResponse, error) {
args := []string{host.exec}
args = append(args, host.constructArguments(req)...)
@@ -937,7 +937,7 @@ func (host *pythonLanguageHost) GetProgramDependencies(
var result []pipDependency
err = json.Unmarshal([]byte(out), &result)
if err != nil {
- return nil, fmt.Errorf("Failed to parse \"python %s\" result: %w", strings.Join(cmdArgs, " "), err)
+ return nil, fmt.Errorf("failed to parse \"python %s\" result: %w", strings.Join(cmdArgs, " "), err)
}
dependencies := make([]*pulumirpc.DependencyInfo, len(result))
diff --git a/sdk/python/cmd/pulumi-language-python/main_test.go b/sdk/python/cmd/pulumi-language-python/main_test.go
index ae0bcacd80de..7299dc5d8fce 100644
--- a/sdk/python/cmd/pulumi-language-python/main_test.go
+++ b/sdk/python/cmd/pulumi-language-python/main_test.go
@@ -48,7 +48,7 @@ func TestDeterminePluginVersion(t *testing.T) {
},
{
input: "",
- err: fmt.Errorf("Cannot parse empty string"),
+ err: fmt.Errorf("cannot parse empty string"),
},
{
input: "4.3.2.1",
@@ -96,7 +96,7 @@ func TestDeterminePluginVersion(t *testing.T) {
},
{
input: "10!3.2.1",
- err: fmt.Errorf("Epochs are not supported"),
+ err: fmt.Errorf("epochs are not supported"),
},
{
input: "3.2.post1.dev0",
diff --git a/sdk/python/python.go b/sdk/python/python.go
index 726f6149d172..bfb918f3cac6 100644
--- a/sdk/python/python.go
+++ b/sdk/python/python.go
@@ -33,7 +33,7 @@ const (
pythonShimCmdFormat = "pulumi-%s-shim.cmd"
)
-// Find the correct path and command for Python. If the `PULUMI_PYTHON_CMD`
+// CommandPath finds the correct path and command for Python. If the `PULUMI_PYTHON_CMD`
// variable is set it will be looked for on `PATH`, otherwise, `python3` and
// `python` will be looked for.
func CommandPath() (string /*pythonPath*/, string /*pythonCmd*/, error) {