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

deps: update to use go1.19 #1467

Merged
merged 6 commits into from
Aug 8, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
- id: cache-paths
name: Get cache paths
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
- id: cache-paths
name: Get cache paths
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
- id: cache-paths
name: Get cache paths
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
- name: goreleaser check
uses: goreleaser/goreleaser-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
- name: Run linters
uses: golangci/[email protected]
with:
version: v1.45
version: v1.48
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
- name: Install Cosign
uses: sigstore/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19.0-alpine3.15 as builder
FROM golang:1.19-alpine3.16 as builder

RUN apk add --no-cache make

Expand Down
3 changes: 1 addition & 2 deletions cmd/langserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"context"
"fmt"
"log"
"os"

Expand All @@ -16,7 +15,7 @@ func (cli *CLI) startLanguageServer(configPath string, cliConfig *tflint.Config)

handler, plugin, err := langserver.NewHandler(configPath, cliConfig)
if err != nil {
log.Println(fmt.Sprintf("Failed to start language server: %s", err))
log.Printf("Failed to start language server: %s", err)
return ExitCodeError
}
if plugin != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/building.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Building TFLint

Go 1.18 or higher is required to build TFLint from source code. Clone the source code and run the `make` command. Built binary will be placed in `dist` directory.
Go 1.19 or higher is required to build TFLint from source code. Clone the source code and run the `make` command. Built binary will be placed in `dist` directory.

```console
$ git clone https://github.com/terraform-linters/tflint.git
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/terraform-linters/tflint

go 1.18
go 1.19

require (
github.com/Masterminds/semver/v3 v3.1.1
Expand Down
6 changes: 3 additions & 3 deletions langserver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func (h *handler) handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2
Data: req.Params,
}
}
log.Println(fmt.Sprintf("Received `%s` with `%s`", req.Method, string(params)))
log.Printf("Received `%s` with `%s`", req.Method, string(params))
} else {
log.Println(fmt.Sprintf("Received `%s`", req.Method))
log.Printf("Received `%s`", req.Method)
}

if h.shutdown && req.Method != "exit" {
Expand Down Expand Up @@ -120,7 +120,7 @@ func (h *handler) handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2

func (h *handler) chdir(dir string) error {
if h.rootDir != dir {
log.Println(fmt.Sprintf("Changing directory: %s", dir))
log.Printf("Changing directory: %s", dir)
if err := os.Chdir(dir); err != nil {
return fmt.Errorf("Failed to chdir to %s: %s", dir, err)
}
Expand Down
2 changes: 1 addition & 1 deletion langserver/text_document_did_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (h *handler) textDocumentDidChange(ctx context.Context, conn *jsonrpc2.Conn
return nil, err
}

log.Println(fmt.Sprintf("Notify `textDocument/publishDiagnostics` with `%#v`", diagnostics))
log.Printf("Notify `textDocument/publishDiagnostics` with `%#v`", diagnostics)
for path, diags := range diagnostics {
err = conn.Notify(
ctx,
Expand Down
2 changes: 1 addition & 1 deletion langserver/text_document_did_open.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (h *handler) textDocumentDidOpen(ctx context.Context, conn *jsonrpc2.Conn,
return nil, err
}

log.Println(fmt.Sprintf("Notify `textDocument/publishDiagnostics` with `%#v`", diagnostics))
log.Printf("Notify `textDocument/publishDiagnostics` with `%#v`", diagnostics)
for path, diags := range diagnostics {
err = conn.Notify(
ctx,
Expand Down
2 changes: 1 addition & 1 deletion langserver/workspace_did_change_watched_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (h *handler) workspaceDidChangeWatchedFiles(ctx context.Context, conn *json
return nil, err
}

log.Println(fmt.Sprintf("Notify `textDocument/publishDiagnostics` with `%#v`", diagnostics))
log.Printf("Notify `textDocument/publishDiagnostics` with `%#v`", diagnostics)
for path, diags := range diagnostics {
err = conn.Notify(
ctx,
Expand Down
1 change: 0 additions & 1 deletion plugin/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type Checksummer struct {
// 3a61fff3689f27c89bce22893219919c629d2e10b96e7eadd5fef9f0e90bb353 tflint-ruleset-aws_darwin_amd64.zip
// 482419fdeed00692304e59558b5b0d915d4727868b88a5adbbbb76f5ed1b537a tflint-ruleset-aws_linux_amd64.zip
// db4eed4c0abcfb0b851da5bbfe8d0c71e1c2b6afe4fd627638a462c655045902 tflint-ruleset-aws_windows_amd64.zip
//
func NewChecksummer(f io.Reader) (*Checksummer, error) {
scanner := bufio.NewScanner(f)

Expand Down
8 changes: 4 additions & 4 deletions plugin/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ func FindPluginPath(config *InstallConfig) (string, error) {
// getPluginDir returns the base plugin directory.
// Adopted with the following priorities:
//
// 1. `plugin_dir` in a global config
// 2. `TFLINT_PLUGIN_DIR` environment variable
// 3. Current directory (./.tflint.d/plugins)
// 4. Home directory (~/.tflint.d/plugins)
// 1. `plugin_dir` in a global config
// 2. `TFLINT_PLUGIN_DIR` environment variable
// 3. Current directory (./.tflint.d/plugins)
// 4. Home directory (~/.tflint.d/plugins)
//
// If the environment variable is set, other directories will not be considered,
// but if the current directory does not exist, it will fallback to the home directory.
Expand Down
1 change: 0 additions & 1 deletion plugin/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (c *InstallConfig) AssetName() string {
//
// - The release must contain a signature file for the checksum file with the name checksums.txt.sig
// - The signature file must be binary OpenPGP format
//
func (c *InstallConfig) Install() (string, error) {
dir, err := getPluginDir(c.globalConfig)
if err != nil {
Expand Down
6 changes: 0 additions & 6 deletions rules/terraformrules/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,6 @@ type referencable interface {
referenceableSigil()
}

type referenceable struct {
}

func (r referenceable) referenceableSigil() {
}

type inputVariableReference struct {
referencable
name string
Expand Down
14 changes: 7 additions & 7 deletions tflint/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ func NewModuleRunners(parent *Runner) ([]*Runner, error) {
// Basically, this function is a wrapper for hclext.PartialContent, but in some ways it reproduces
// Terraform language semantics.
//
// 1. The block schema implicitly adds dynamic blocks to the target
// https://www.terraform.io/language/expressions/dynamic-blocks
// 2. Supports overriding files
// https://www.terraform.io/language/files/override
// 3. Resources not created by count or for_each will be ignored
// https://www.terraform.io/language/meta-arguments/count
// https://www.terraform.io/language/meta-arguments/for_each
// 1. The block schema implicitly adds dynamic blocks to the target
// https://www.terraform.io/language/expressions/dynamic-blocks
// 2. Supports overriding files
// https://www.terraform.io/language/files/override
// 3. Resources not created by count or for_each will be ignored
// https://www.terraform.io/language/meta-arguments/count
// https://www.terraform.io/language/meta-arguments/for_each
//
// However, this behavior is controlled by options. The above is the default.
func (r *Runner) GetModuleContent(bodyS *hclext.BodySchema, opts sdk.GetModuleContentOption) (*hclext.BodyContent, hcl.Diagnostics) {
Expand Down