From bbef44a8fb01673ac1ab4357f86e7d4de88319f5 Mon Sep 17 00:00:00 2001 From: Scott Winkler Date: Wed, 25 Oct 2023 05:24:35 -0700 Subject: [PATCH] fix comments --- .github/workflows/acc-test.yml | 6 --- CONTRIBUTING.md | 2 +- Makefile | 61 +++++++++++++++---------------- pkg/sdk/tasks_dto_builders_gen.go | 2 + 4 files changed, 33 insertions(+), 38 deletions(-) diff --git a/.github/workflows/acc-test.yml b/.github/workflows/acc-test.yml index b90fc2a991..4c664df054 100644 --- a/.github/workflows/acc-test.yml +++ b/.github/workflows/acc-test.yml @@ -22,9 +22,3 @@ jobs: - name: Create and populate .snowflake/config file run: mkdir $HOME/.snowflake && echo "${{ secrets.SNOWFLAKE_CONFIG_FILE }}" > $HOME/.snowflake/config - run: make testacc - env: - SKIP_EMAIL_INTEGRATION_TESTS=true - SKIP_EXTERNAL_TABLE_TEST=true - SKIP_NOTIFICATION_INTEGRATION_TESTS=true - SKIP_SAML_INTEGRATION_TESTS=true - SKIP_STREAM_TEST=true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e810e3b6f8..3cbd88073a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ 2. Ensure that your `GOPATH` is set to the desired location 3. Fork this repo and clone it into `$GOPATH/src/github.com/Snowflake-Labs/terraform-provider-snowflake` 4. cd to `terraform-provider-snowflake` and install all the required packages with `go get` -5. Build provider with `make build` +5. Build and install provider with `make install` ## Testing diff --git a/Makefile b/Makefile index ecec58e7fa..dcf3e527f6 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,16 @@ +export SKIP_EMAIL_INTEGRATION_TESTS=true +export SKIP_EXTERNAL_TABLE_TEST=true +export SKIP_NOTIFICATION_INTEGRATION_TESTS=true +export SKIP_SAML_INTEGRATION_TESTS=true +export SKIP_STREAM_TEST=true -default: install - -build: - go build -v ./... - -clean-generator-poc: - rm -f ./internal/sdk/poc/example/*_gen.go - rm -f ./internal/sdk/poc/example/*_gen_test.go - -clean-generator-%: ## Clean generated files for specified resource - rm -f ./internal/sdk/$**_gen.go - rm -f ./internal/sdk/$**_gen_*test.go +default: help docs: go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate docs-check: docs ## check that docs have been generated git diff --exit-code -- docs -.PHONY: docs-check fmt: ## Run gofumpt @echo "==> Fixing source code with gofumpt..." @@ -29,16 +22,10 @@ fumpt: fmt generate: cd tools && go generate ./... -generate-all-dto: ## Generate all DTOs for SDK interfaces - go generate ./internal/sdk/*_dto.go - -generate-dto-%: ./internal/sdk/%_dto.go ## Generate DTO for given SDK interface - go generate $< - help: @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-23s\033[0m %s\n", $$1, $$2}' -install: build +install: go install -v ./... # See https://golangci-lint.run/ @@ -57,16 +44,6 @@ mod-check: mod ## check if there are any missing/unused modules pre-push: fmt lint mod docs ## Run a few checks before pushing a change (docs, fmt, mod, etc.) pre-push-check: docs-check lint-check mod-check; ## Run a few checks before pushing a change (docs, fmt, mod, etc.) -.PHONY: pre-push - - -run-generator-poc: - go generate ./internal/sdk/poc/example/*_def.go - go generate ./internal/sdk/poc/example/*_dto_gen.go - -run-generator-%: ./internal/sdk/%_def.go ## Run go generate on given object definition - go generate $< - go generate ./internal/sdk/$*_dto_gen.go sweep: ## destroy the whole architecture; USE ONLY FOR DEVELOPMENT ACCOUNTS @echo "WARNING: This will destroy infrastructure. Use only in development accounts." @@ -81,7 +58,7 @@ test: go test -v -cover -timeout=30m -parallel=4 ./... testacc: - TF_ACC=1 go test -v -cover -timeout 30m -parallel=4 `go list ./... | grep -v internal/sdk` + TF_ACC=1 go test -v -cover -timeout 30m -parallel=4 `go list ./... | grep -v pkg/sdk` tools: cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint @@ -89,4 +66,26 @@ tools: cd tools && go install github.com/hashicorp/copywrite cd tools && go install mvdan.cc/gofumpt +generate-all-dto: ## Generate all DTOs for SDK interfaces + go generate ./internal/sdk/*_dto.go + +generate-dto-%: ./internal/sdk/%_dto.go ## Generate DTO for given SDK interface + go generate $< + +clean-generator-poc: + rm -f ./internal/sdk/poc/example/*_gen.go + rm -f ./internal/sdk/poc/example/*_gen_test.go + +clean-generator-%: ## Clean generated files for specified resource + rm -f ./internal/sdk/$**_gen.go + rm -f ./internal/sdk/$**_gen_*test.go + +run-generator-poc: + go generate ./internal/sdk/poc/example/*_def.go + go generate ./internal/sdk/poc/example/*_dto_gen.go + +run-generator-%: ./internal/sdk/%_def.go ## Run go generate on given object definition + go generate $< + go generate ./internal/sdk/$*_dto_gen.go + .PHONY: build clean-generator-poc clean-generator-% docs docs-check fmt fumpt generate generate-all-dto generate-dto-% help install lint lint-fix mod mod-check pre-push pre-push-check run-generator-poc run-generator-% sweep test testacc tools diff --git a/pkg/sdk/tasks_dto_builders_gen.go b/pkg/sdk/tasks_dto_builders_gen.go index eb7317c18c..fd02c08b2e 100644 --- a/pkg/sdk/tasks_dto_builders_gen.go +++ b/pkg/sdk/tasks_dto_builders_gen.go @@ -2,6 +2,8 @@ package sdk +import () + func NewCreateTaskRequest( name SchemaObjectIdentifier, sql string,