Skip to content

Commit

Permalink
Merge pull request #51 from minamijoyo/go-1.21
Browse files Browse the repository at this point in the history
Update Go to v1.21
  • Loading branch information
minamijoyo authored Oct 17, 2023
2 parents 790c478 + f96b227 commit 1128beb
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version-file: '.go-version'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.45.2
version: v1.54.2
args: --timeout=5m
5 changes: 2 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ jobs:
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version-file: '.go-version'
cache: true
- name: Generate github app token
id: generate_github_app_token
uses: tibdex/github-app-token@f717b5ecd4534d3c4df4ce9b5c1c2214f0f7cd06 # v1.6.0
Expand All @@ -29,7 +28,7 @@ jobs:
private_key: ${{ secrets.APP_PRIVATE_KEY }}
repository: minamijoyo/homebrew-tfschema
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ jobs:
- macOS-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version-file: '.go-version'
cache: true
- name: test
run: make test
testacc:
Expand All @@ -33,7 +32,7 @@ jobs:
strategy:
matrix:
terraform:
- 1.0.0
- 1.5.5
- 0.15.5
- 0.14.11
- 0.13.7
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.11
1.21
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TERRAFORM_VERSION=latest
FROM hashicorp/terraform:$TERRAFORM_VERSION AS terraform

FROM golang:1.17.11-alpine3.16
FROM golang:1.21-alpine3.18
RUN apk --no-cache add make git bash

# A workaround for a permission issue of 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/minamijoyo/tfschema

go 1.17
go 1.21

require (
github.com/hashicorp/go-hclog v0.15.0
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ github.com/tombuildsstuff/giovanni v0.15.1/go.mod h1:0TZugJPEtqzPlMpuJHYfXY6Dq2u
github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U=
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"sync"
Expand Down Expand Up @@ -93,7 +92,7 @@ func logOutput() io.Writer {
minLevel := os.Getenv("TFSCHEMA_LOG")

// default log writer is null device.
writer := ioutil.Discard
writer := io.Discard
if minLevel != "" {
writer = os.Stderr
}
Expand Down
38 changes: 19 additions & 19 deletions tfschema/lock_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tfschema

import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand All @@ -18,23 +17,24 @@ import (
// # This file is maintained automatically by "terraform init".
// # Manual edits may be lost in future updates.
//
// provider "registry.terraform.io/hashicorp/aws" {
// version = "3.17.0"
// constraints = "3.17.0"
// hashes = [
// "h1:BLK4zgpn2O4ojSZhCtAXzqsvm7BymqSxrtcXLp/J/yA=",
// "zh:047e22b2e02d57fb1d945d52c4bd062f50a657865b6a8d21f96ba55ef8a474e5",
// "zh:30135eb8eed7f4c135c504889cf66a2a586671783122a2953856b7040074cba9",
// "zh:557a57801e5c004178caf8c9d94282b17bfab0c6f8fe68e414a4f650b441fc3c",
// "zh:6583fbc0159a7835235d7e7b7ce08b5cc51514dc5bc8276c49b3e14a79a7ddea",
// "zh:6dc01ed7ea928caf1fd5ace9a25e219b57642925d8784046f994e241adad45d2",
// "zh:9c8a1942c21dcb78992a39d2ca54a08d839cc936a68341fb5443983ebd17cad0",
// "zh:c71ca4ccb2c228bfb1aa5e127a54872c739fe54c477b4c545df2e74e77ef3bf4",
// "zh:c94ed23ed6770721262d7bc342467c02524bb0380ece0122f224e30a6b0d23de",
// "zh:e3b71cb43d0602ee1fcf520a7bd7a2a9232b751138e6ef5cf6837caa26c63173",
// "zh:f5143912cd4588bc3a19a98a7fd7979202b9c55130c77b2697cf64bfea76c61c",
// ]
// }
// provider "registry.terraform.io/hashicorp/aws" {
// version = "3.17.0"
// constraints = "3.17.0"
// hashes = [
// "h1:BLK4zgpn2O4ojSZhCtAXzqsvm7BymqSxrtcXLp/J/yA=",
// "zh:047e22b2e02d57fb1d945d52c4bd062f50a657865b6a8d21f96ba55ef8a474e5",
// "zh:30135eb8eed7f4c135c504889cf66a2a586671783122a2953856b7040074cba9",
// "zh:557a57801e5c004178caf8c9d94282b17bfab0c6f8fe68e414a4f650b441fc3c",
// "zh:6583fbc0159a7835235d7e7b7ce08b5cc51514dc5bc8276c49b3e14a79a7ddea",
// "zh:6dc01ed7ea928caf1fd5ace9a25e219b57642925d8784046f994e241adad45d2",
// "zh:9c8a1942c21dcb78992a39d2ca54a08d839cc936a68341fb5443983ebd17cad0",
// "zh:c71ca4ccb2c228bfb1aa5e127a54872c739fe54c477b4c545df2e74e77ef3bf4",
// "zh:c94ed23ed6770721262d7bc342467c02524bb0380ece0122f224e30a6b0d23de",
// "zh:e3b71cb43d0602ee1fcf520a7bd7a2a9232b751138e6ef5cf6837caa26c63173",
// "zh:f5143912cd4588bc3a19a98a7fd7979202b9c55130c77b2697cf64bfea76c61c",
// ]
// }
//
// ```
//
// It includes selected the fully qualified provider name and version.
Expand Down Expand Up @@ -99,7 +99,7 @@ type Provider struct {

// loadLockFile loads and parses a given lock file.
func loadLockFile(path string) (*Lock, error) {
source, err := ioutil.ReadFile(path)
source, err := os.ReadFile(path)
if err != nil {
return nil, err
}
Expand Down
17 changes: 9 additions & 8 deletions tfschema/selection_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package tfschema
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand All @@ -13,12 +12,14 @@ import (
// selectionFile represents a lock file in Terraform v0.13.
// An example is as follows:
// ```.terraform/plugins/selections.json
// {
// "registry.terraform.io/hashicorp/aws": {
// "hash": "h1:bVpVG796X94WeMxRcRNq+YmHVQkbaWYCsR906VwgJxE=",
// "version": "2.67.0"
// }
// }
//
// {
// "registry.terraform.io/hashicorp/aws": {
// "hash": "h1:bVpVG796X94WeMxRcRNq+YmHVQkbaWYCsR906VwgJxE=",
// "version": "2.67.0"
// }
// }
//
// ```
//
// It includes selected the fully qualified provider name and version.
Expand All @@ -43,7 +44,7 @@ func newSelectionFile(path string) *selectionFile {

// pluginDirs peeks a selection file and returns a slice of plugin directories.
func (f *selectionFile) pluginDirs() ([]string, error) {
buf, err := ioutil.ReadFile(f.path)
buf, err := os.ReadFile(f.path)

if err != nil {
if os.IsNotExist(err) {
Expand Down

0 comments on commit 1128beb

Please sign in to comment.