Skip to content

Commit ed5250d

Browse files
committed
fixed by the golangci-lint
1 parent eabbb17 commit ed5250d

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,17 @@ build_sdks:: export PULUMI_SKIP_MISSING_MAPPING_ERROR := ${PULUMI_SKIP_ERROR}
6868
build_sdks:: install_plugins provider build_nodejs build_python build_go build_dotnet # build all the sdks
6969

7070
build_nodejs:: VERSION := $(shell pulumictl get version --language javascript)
71+
build_nodejs:: export PULUMI_SKIP_MISSING_MAPPING_ERROR := ${PULUMI_SKIP_ERROR}
7172
build_nodejs:: install_plugins tfgen # build the node sdk
7273
$(WORKING_DIR)/bin/$(TFGEN) nodejs --overlays provider/overlays/nodejs --out sdk/nodejs/
7374
cd sdk/nodejs/ && \
7475
yarn install && \
7576
yarn run tsc && \
76-
cp -R scripts/ bin && \
7777
cp ../../README.md ../../LICENSE package.json yarn.lock ./bin/ && \
7878
sed -i.bak -e "s/\$${VERSION}/$(VERSION)/g" ./bin/package.json
7979

8080
build_python:: PYPI_VERSION := $(shell pulumictl get version --language python)
81+
build_python:: export PULUMI_SKIP_MISSING_MAPPING_ERROR := ${PULUMI_SKIP_ERROR}
8182
build_python:: install_plugins tfgen # build the python sdk
8283
$(WORKING_DIR)/bin/$(TFGEN) python --overlays provider/overlays/python --out sdk/python/
8384
cd sdk/python/ && \
@@ -89,6 +90,7 @@ build_python:: install_plugins tfgen # build the python sdk
8990
cd ./bin && python3 setup.py build sdist
9091

9192
build_dotnet:: DOTNET_VERSION := $(shell pulumictl get version --language dotnet)
93+
build_dotnet:: export PULUMI_SKIP_MISSING_MAPPING_ERROR := ${PULUMI_SKIP_ERROR}
9294
build_dotnet:: install_plugins tfgen # build the dotnet sdk
9395
@echo "PULUMI_SKIP_MISSING_MAPPING_ERROR: ${PULUMI_SKIP_MISSING_MAPPING_ERROR}"
9496
pulumictl get version --language dotnet
@@ -97,6 +99,7 @@ build_dotnet:: install_plugins tfgen # build the dotnet sdk
9799
echo "${DOTNET_VERSION}" >version.txt && \
98100
dotnet build /p:Version=${DOTNET_VERSION}
99101

102+
build_go:: export PULUMI_SKIP_MISSING_MAPPING_ERROR := ${PULUMI_SKIP_ERROR}
100103
build_go:: install_plugins tfgen # build the go sdk
101104
$(WORKING_DIR)/bin/$(TFGEN) go --overlays provider/overlays/go --out sdk/go/
102105

provider/cmd/pulumi-info-tencentcloud/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ package main
44
import "github.com/tencentcloudstack/pulumi-tencentcloud/provider/info"
55

66
func main() {
7-
info.WriteInfos()
7+
err := info.WriteInfos()
8+
if err != nil {
9+
panic(err)
10+
}
811
}

provider/cmd/pulumi-tfgen-tencentcloud/main.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ package main
1616

1717
import (
1818
"encoding/json"
19-
"io/ioutil"
2019
"log"
20+
"os"
2121
"regexp"
2222
"strings"
2323

@@ -36,7 +36,7 @@ func main() {
3636
// This function takes NO effect to example of `sdk/nodejs`
3737
func temporaryReplaceCodeExampleImportStatement() {
3838
schemaPath := "./provider/cmd/pulumi-resource-tencentcloud/schema.json"
39-
schemaContents, err := ioutil.ReadFile(schemaPath)
39+
schemaContents, err := os.ReadFile(schemaPath)
4040
if err != nil {
4141
log.Fatal(err)
4242
}
@@ -53,20 +53,28 @@ func temporaryReplaceCodeExampleImportStatement() {
5353
f := packageSpec.Functions[i]
5454
desc := f.Description
5555
f.Description = mismatchImportPathRE.ReplaceAllString(desc, "")
56-
f.Description = strings.ReplaceAll(desc, "\nimport * as tencentcloud from \"@pulumi/tencentcloud\";", "\nimport * as tencentcloud from \"@tencentcloud_iac/pulumi\";")
56+
f.Description = strings.ReplaceAll(desc,
57+
"\nimport * as tencentcloud from \"@pulumi/tencentcloud\";",
58+
"\nimport * as tencentcloud from \"@tencentcloud_iac/pulumi\";")
5759
packageSpec.Functions[i] = f
5860
}
5961

6062
for i := range packageSpec.Resources {
6163
r := packageSpec.Resources[i]
6264
desc := r.Description
6365
r.Description = mismatchImportPathRE.ReplaceAllString(desc, "")
64-
r.Description = strings.ReplaceAll(desc, "\nimport * as tencentcloud from \"@pulumi/tencentcloud\";", "\nimport * as tencentcloud from \"@tencentcloud_iac/pulumi\";")
66+
r.Description = strings.ReplaceAll(desc,
67+
"\nimport * as tencentcloud from \"@pulumi/tencentcloud\";",
68+
"\nimport * as tencentcloud from \"@tencentcloud_iac/pulumi\";")
6569
packageSpec.Resources[i] = r
6670
}
6771

6872
b, err := json.MarshalIndent(packageSpec, "", " ")
69-
if err := ioutil.WriteFile(schemaPath, b, 0600); err != nil {
73+
if err != nil {
74+
log.Fatal(err) // Check the error returned by json.MarshalIndent
75+
}
76+
77+
if err := os.WriteFile(schemaPath, b, 0600); err != nil {
7078
log.Fatal(err)
7179
}
7280
}

provider/info/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ func WriteInfos() error {
1919
log.Printf("marshal datasource error: %s", err.Error())
2020
return err
2121
}
22-
err = os.WriteFile("./resources.json", rContent, 0622)
22+
err = os.WriteFile("./resources.json", rContent, 0600)
2323
if err != nil {
2424
log.Printf("write resources error: %s", err.Error())
2525
return err
2626
}
27-
err = os.WriteFile("./datasouroces.json", dContent, 0622)
27+
err = os.WriteFile("./datasouroces.json", dContent, 0600)
2828
if err != nil {
2929
log.Printf("write datasouroces error: %s", err.Error())
3030
return err

0 commit comments

Comments
 (0)