diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index c78065957..22200b8bc 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -4,6 +4,7 @@ env: ALT_AWS_PROFILE: ${{ secrets.ALT_AWS_PROFILE }} AWS_REGION: us-west-2 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GOLANGCI_LINT_VERSION: v1.59.0 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} @@ -49,8 +50,14 @@ jobs: run: | echo "$HOME/.yarn/bin" >> $GITHUB_PATH echo "$HOME/.config/yarn/global/node_modules/.bin" >> $GITHUB_PATH - - name: Run lint + - name: Run nodejs linter run: make lint + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: ${{ env.GOLANGCI_LINT_VERSION }} + args: -c ../.golangci.yml + working-directory: provider - name: Run unit tests run: make test_unit_tests prerequisites: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 2d8020eae..0895cfe9f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -4,6 +4,7 @@ env: ALT_AWS_PROFILE: ${{ secrets.ALT_AWS_PROFILE }} AWS_REGION: us-west-2 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GOLANGCI_LINT_VERSION: v1.59.0 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} @@ -49,8 +50,14 @@ jobs: run: | echo "$HOME/.yarn/bin" >> $GITHUB_PATH echo "$HOME/.config/yarn/global/node_modules/.bin" >> $GITHUB_PATH - - name: Run lint + - name: Run nodejs linter run: make lint + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: ${{ env.GOLANGCI_LINT_VERSION }} + args: -c ../.golangci.yml + working-directory: provider - name: Run unit tests run: make test_unit_tests prerequisites: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c5238234..eddd62619 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ env: ALT_AWS_PROFILE: ${{ secrets.ALT_AWS_PROFILE }} AWS_REGION: us-west-2 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GOLANGCI_LINT_VERSION: v1.59.0 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} @@ -50,8 +51,14 @@ jobs: run: | echo "$HOME/.yarn/bin" >> $GITHUB_PATH echo "$HOME/.config/yarn/global/node_modules/.bin" >> $GITHUB_PATH - - name: Run lint + - name: Run nodejs linter run: make lint + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: ${{ env.GOLANGCI_LINT_VERSION }} + args: -c ../.golangci.yml + working-directory: provider - name: Run unit tests run: make test_unit_tests build_sdk: diff --git a/.github/workflows/run-acceptance-tests.yml b/.github/workflows/run-acceptance-tests.yml index 030b846f8..15a39713d 100644 --- a/.github/workflows/run-acceptance-tests.yml +++ b/.github/workflows/run-acceptance-tests.yml @@ -10,6 +10,7 @@ env: ALT_AWS_PROFILE: ${{ secrets.ALT_AWS_PROFILE }} AWS_REGION: us-west-2 GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }} + GOLANGCI_LINT_VERSION: v1.59.0 NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} PROVIDER: eks @@ -69,8 +70,14 @@ jobs: run: | echo "$HOME/.yarn/bin" >> $GITHUB_PATH echo "$HOME/.config/yarn/global/node_modules/.bin" >> $GITHUB_PATH - - name: Run lint + - name: Run nodejs linter run: make lint + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: ${{ env.GOLANGCI_LINT_VERSION }} + args: -c ../.golangci.yml + working-directory: provider - name: Run unit tests run: make test_unit_tests prerequisites: diff --git a/.golangci.yml b/.golangci.yml index f901dd449..ece1e2079 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,24 +1,20 @@ linters: enable: - - deadcode - errcheck - goconst - gofmt - - golint - gosec + - gosimple - govet - ineffassign - - interfacer - lll - megacheck - misspell - nakedret - - structcheck + - revive + - staticcheck + - unused - unconvert - - varcheck enable-all: false run: - skip-files: - - schema.go - - pulumiManifest.go timeout: 10m diff --git a/provider/cmd/pulumi-gen-eks/main.go b/provider/cmd/pulumi-gen-eks/main.go index 5fa65ee82..d053a85cd 100644 --- a/provider/cmd/pulumi-gen-eks/main.go +++ b/provider/cmd/pulumi-gen-eks/main.go @@ -17,7 +17,6 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" @@ -92,7 +91,7 @@ func k8sRef(ref string) string { return fmt.Sprintf("/kubernetes/%s/schema.json%s", k8sVersion, ref) } -// nolint: lll +//nolint:lll,goconst func generateSchema() schema.PackageSpec { return schema.PackageSpec{ Name: "eks", @@ -1679,6 +1678,7 @@ func generateSchema() schema.PackageSpec { } } +//nolint:lll func nodeGroupProperties(cluster, v2 bool) map[string]schema.PropertySpec { props := map[string]schema.PropertySpec{ "nodeSubnetIds": { @@ -1936,8 +1936,10 @@ func nodeGroupProperties(cluster, v2 bool) map[string]schema.PropertySpec { props["launchTemplateTagSpecifications"] = schema.PropertySpec{ TypeSpec: schema.TypeSpec{ - Type: "array", - Items: &schema.TypeSpec{Ref: awsRef("#/types/aws:ec2%2FLaunchTemplateTagSpecification:LaunchTemplateTagSpecification")}, + Type: "array", + Items: &schema.TypeSpec{ + Ref: awsRef("#/types/aws:ec2%2FLaunchTemplateTagSpecification:LaunchTemplateTagSpecification"), + }, }, Description: "The tag specifications to apply to the launch template.", } @@ -2096,13 +2098,13 @@ func vpcCniProperties(kubeconfig bool) map[string]schema.PropertySpec { func rawMessage(v interface{}) schema.RawMessage { bytes, err := json.Marshal(v) - contract.Assert(err == nil) + contract.Assertf(err == nil, "failed to marshal raw message: %v", err) return bytes } func readSchema(schemaPath string, version string) *schema.Package { // Read in, decode, and import the schema. - schemaBytes, err := ioutil.ReadFile(schemaPath) + schemaBytes, err := os.ReadFile(schemaPath) if err != nil { panic(err) } @@ -2156,7 +2158,7 @@ func mustWriteFile(rootDir, filename string, contents []byte) { if err := os.MkdirAll(filepath.Dir(outPath), 0755); err != nil { panic(err) } - err := ioutil.WriteFile(outPath, contents, 0600) + err := os.WriteFile(outPath, contents, 0600) if err != nil { panic(err) } diff --git a/provider/provider_test.go b/provider/provider_test.go index 7b3b430fc..28c915ba2 100644 --- a/provider/provider_test.go +++ b/provider/provider_test.go @@ -107,6 +107,8 @@ func testProviderUpgrade(t *testing.T, example string) { test := pulumitest.NewPulumiTest(t, dir, options...) - result := providertest.PreviewProviderUpgrade(t, test, providerName, baselineVersion, optproviderupgrade.DisableAttach()) + result := providertest.PreviewProviderUpgrade(t, test, providerName, baselineVersion, + optproviderupgrade.DisableAttach(), + ) assertpreview.HasNoReplacements(t, result) }