Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Bump go to 1.21 #2267

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export TERRAFORM_PLUGIN_LOCAL_INSTALL=$(TERRAFORM_PLUGINS_DIR)/$(BASE_BINARY_NAM
default: help

dev-setup: ## setup development dependencies
@which ./bin/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.53.3
@which ./bin/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.55.2
cd tools && mkdir -p bin/
cd tools && env GOBIN=$$PWD/bin go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
cd tools && env GOBIN=$$PWD/bin go install mvdan.cc/gofumpt
Expand Down Expand Up @@ -46,7 +46,7 @@ lint-fix: ## Run static code analysis, check formatting and try to fix findings
./bin/golangci-lint run ./... -v --fix

mod: ## add missing and remove unused modules
go mod tidy -compat=1.20
go mod tidy -compat=1.21

mod-check: mod ## check if there are any missing/unused modules
git diff --exit-code -- go.mod go.sum
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Snowflake-Labs/terraform-provider-snowflake

go 1.20
go 1.21

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
Expand All @@ -25,7 +25,6 @@ require (
github.com/stretchr/testify v1.8.4
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a
golang.org/x/crypto v0.16.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/text v0.14.0
)

Expand Down Expand Up @@ -118,6 +117,7 @@ require (
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sync v0.5.0 // indirect
Expand Down
30 changes: 30 additions & 0 deletions go.sum

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pkg/resources/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"context"
"database/sql"
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"golang.org/x/exp/slices"
"slices"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

var databaseSchema = map[string]*schema.Schema{
Expand Down
6 changes: 2 additions & 4 deletions pkg/resources/failover_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"slices"
"strconv"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"golang.org/x/exp/slices"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

var failoverGroupSchema = map[string]*schema.Schema{
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/grant_privileges_to_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"database/sql"
"fmt"
"log"
"slices"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/logging"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"golang.org/x/exp/slices"
)

var grantPrivilegesToRoleSchema = map[string]*schema.Schema{
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/helper_expansion.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package resources

import "golang.org/x/exp/slices"
import "slices"

// borrowed from https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/structure.go#L924:6

Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func GetPropertyAsPointer[T any](d *schema.ResourceData, property string) *T {
return &typedValue
}

func IsDataType() schema.SchemaValidateFunc {
func IsDataType() schema.SchemaValidateFunc { //nolint:staticcheck
return func(value any, key string) (warnings []string, errors []error) {
stringValue, ok := value.(string)
if !ok {
Expand Down
3 changes: 1 addition & 2 deletions pkg/resources/procedure.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import (
"errors"
"fmt"
"log"
"slices"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/snowflake"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"golang.org/x/exp/slices"
)

var procedureLanguages = []string{"javascript", "java", "scala", "SQL", "python"}
Expand Down
5 changes: 2 additions & 3 deletions pkg/resources/role_grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import (
"errors"
"fmt"
"log"
"slices"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/snowflake"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/jmoiron/sqlx"
"github.com/snowflakedb/gosnowflake"
"golang.org/x/exp/slices"
)

func RoleGrants() *schema.Resource {
Expand Down
3 changes: 1 addition & 2 deletions pkg/resources/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import (
"errors"
"fmt"
"log"
"slices"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/snowflake"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"golang.org/x/exp/slices"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions pkg/resources/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import (
"database/sql"
"fmt"
"log"
"slices"
"strconv"
"time"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/helpers"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"golang.org/x/exp/slices"
)

var taskSchema = map[string]*schema.Schema{
Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (
"fmt"
"log"
"os"
"slices"

"github.com/jmoiron/sqlx"
"github.com/luna-duclos/instrumentedsql"
"golang.org/x/exp/slices"

"github.com/snowflakedb/gosnowflake"
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/data_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package sdk

import (
"fmt"
"slices"
"strings"

"golang.org/x/exp/slices"
)

// DataType is based on https://docs.snowflake.com/en/sql-reference/intro-summary-data-types.
Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/failover_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"context"
"database/sql"
"errors"
"slices"
"strings"
"time"

"golang.org/x/exp/slices"
)

var _ FailoverGroups = (*failoverGroups)(nil)
Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/file_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"encoding/json"
"fmt"
"reflect"
"slices"
"strconv"
"strings"
"time"

"golang.org/x/exp/slices"
)

var (
Expand Down
4 changes: 1 addition & 3 deletions pkg/sdk/grants_validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package sdk
import (
"errors"
"fmt"

// TODO: change to slices with go 1.21
"golang.org/x/exp/slices"
"slices"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/object_types.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package sdk

import (
"slices"
"strings"

"golang.org/x/exp/slices"
)

// Object bundles together the object type and name. Its used for DDL statements.
Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/poc/generator/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package generator

import (
"fmt"
"slices"
"strings"

"golang.org/x/exp/slices"
)

// Field defines properties of a single field or struct (by defining Fields)
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdk/poc/generator/field_transformers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package generator

import "golang.org/x/exp/slices"
import "slices"

type FieldTransformer interface {
Transform(f *Field) *Field
Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/poc/generator/template_executors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"io"
"log"
"os"
"slices"
"text/template"

"golang.org/x/exp/slices"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions pkg/sdk/sweepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package sdk
import (
"context"
"log"
"slices"
"strings"

"golang.org/x/exp/slices"
)

func Sweep(client *Client, prefix string) error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdk/tasks_impl_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package sdk
import (
"context"
"encoding/json"
"slices"
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/internal/collections"
"golang.org/x/exp/slices"
)

var _ Tasks = (*tasks)(nil)
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdk/testint/failover_groups_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package testint
import (
"log"
"os"
"slices"
"testing"
"time"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/avast/retry-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"
)

func TestInt_FailoverGroupsCreate(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tools

go 1.20
go 1.21

require (
github.com/golangci/golangci-lint v1.55.0
Expand Down
Loading
Loading