Skip to content

Commit

Permalink
feat: Updates to Go 1.21.3 (#1550)
Browse files Browse the repository at this point in the history
* update to Go 1.21.3

* update doc

* update linter

* keep timeout in linter to avoid error: Timeout exceeded: try increasing it by passing --timeout option

* adjust linter to use depguard v2

* apply feedback about using toolchain version

* apply feedback to remove depguard linter

* undo reformat

* remove linters not being used because abandoned.

WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
  • Loading branch information
lantoli committed Oct 24, 2023
1 parent a7f7217 commit f0395d8
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.52.2
args: --timeout 9m0s
version: v1.55.0
args: --timeout 10m
website-lint:
runs-on: ubuntu-latest
steps:
Expand Down
20 changes: 7 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ linters-settings:
- name: redefines-builtin-id
maligned:
suggest-new: true
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
misspell:
locale: US
ignore-words:
Expand All @@ -72,15 +66,13 @@ linters-settings:
settings:
mnd:
# don't include the "operation" and "assign"
checks: [case,return]
checks: [case, return]
funlen:
lines: 360
statements: 120
linters:
disable-all: true
enable:
- deadcode
- depguard
- dogsled
- errcheck
- funlen
Expand All @@ -101,14 +93,16 @@ linters:
- rowserrcheck
- exportloopref
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unused
- varcheck
- whitespace
# don't enable:
# - deadcode
# - varcheck
# - structcheck
# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
# - gocyclo # we already have funlen lint
# - dupl # we have a lot of duplicate test cases
# - gochecknoinits # we need the init function for the provider
Expand Down Expand Up @@ -137,10 +131,10 @@ issues:

# Exclude some staticcheck messages
- linters:
- staticcheck
- staticcheck
text: "SA1019:" # d.GetOkExists is deprecated: usage is discouraged due to undefined behaviors and may be removed in a future version of the SDK
- linters:
- gocritic
- gocritic
text: "^hugeParam: req is heavy"

run:
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
golang 1.20
golang 1.21.3
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Prerequisite Tools

- [Git](https://git-scm.com/)
- [Go (at least Go 1.20)](https://golang.org/dl/)
- [Go (at least Go 1.21)](https://golang.org/dl/)

### Environment

Expand Down
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GITTAG=$(shell git describe --always --tags)
VERSION=$(GITTAG:v%=%)
LINKER_FLAGS=-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=${VERSION}'

GOLANGCI_VERSION=v1.52.2
GOLANGCI_VERSION=v1.55.0

export PATH := $(shell go env GOPATH)/bin:$(PATH)
export SHELL := env PATH=$(PATH) /bin/bash
Expand Down Expand Up @@ -78,7 +78,7 @@ lint:
tools: ## Install dev tools
@echo "==> Installing dependencies..."
go install github.com/client9/misspell/cmd/misspell@latest
go install github.com/terraform-linters/tflint@v0.46.1
go install github.com/terraform-linters/tflint@v0.48.0
go install github.com/rhysd/actionlint/cmd/actionlint@latest
go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCI_VERSION)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature requests can be submitted at https://feedback.mongodb.com/forums/924145-

## Requirements
- [Terraform](https://www.terraform.io/downloads.html) 1.0+
- [Go](https://golang.org/doc/install) 1.20 (to build the provider plugin)
- [Go](https://golang.org/doc/install) 1.21 (to build the provider plugin)

## Using the Provider

Expand Down
17 changes: 10 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/mongodb/terraform-provider-mongodbatlas

go 1.20
go 1.21

toolchain go1.21.3

require (
github.com/aws/aws-sdk-go v1.46.0
Expand Down Expand Up @@ -34,7 +36,7 @@ require (
cloud.google.com/go/compute v1.19.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.13.0 // indirect
cloud.google.com/go/storage v1.28.1 // indirect
cloud.google.com/go/storage v1.29.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.1 // indirect
Expand All @@ -44,7 +46,7 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down Expand Up @@ -78,6 +80,7 @@ require (
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.19.0 // indirect
github.com/hashicorp/terraform-json v0.17.1 // indirect
Expand All @@ -93,7 +96,7 @@ require (
github.com/klauspost/compress v1.15.11 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
github.com/mitchellh/cli v1.1.5 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
Expand All @@ -112,9 +115,9 @@ require (
github.com/pquerna/otp v1.3.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/stretchr/testify v1.8.3 // indirect
github.com/tmccombs/hcl2json v0.3.3 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/urfave/cli v1.22.2 // indirect
Expand All @@ -131,7 +134,7 @@ require (
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.114.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down

0 comments on commit f0395d8

Please sign in to comment.