Bump golang to 1.22.1

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
This commit is contained in:
Khosrow Moossavi
2024-03-15 12:47:17 -04:00
parent 7a00604085
commit a321c282f2
14 changed files with 60 additions and 2423 deletions

View File

@@ -7,7 +7,7 @@ on:
pull_request:
env:
GO_VERSION: "1.21.5"
GO_VERSION: "1.22.1"
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
jobs:
@@ -73,7 +73,7 @@ jobs:
- name: Check License headers
run: |
GO111MODULE=off go get github.com/google/addlicense
go install github.com/google/addlicense@latest
addlicense -check $(find . -type f -name "*.go")
addlicense -check $(find . -type f -name "*.sh")

View File

@@ -6,7 +6,7 @@ on:
- master
env:
GO_VERSION: "1.21.5"
GO_VERSION: "1.22.1"
jobs:
analyze:

View File

@@ -6,7 +6,7 @@ on:
- "v*.*.*-*"
env:
GO_VERSION: "1.21.5"
GO_VERSION: "1.22.1"
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
jobs:

View File

@@ -7,7 +7,7 @@ on:
- "!v*.*.*-*"
env:
GO_VERSION: "1.21.5"
GO_VERSION: "1.22.1"
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
jobs:

View File

@@ -10,7 +10,7 @@ us on [Slack].
## Development Requirements
- [Go] 1.16+
- [Go] 1.22+
- [goimports]
- [golangci-lint]

View File

@@ -141,7 +141,7 @@ major: release ## Prepare Major release
.PHONY: goimports
goimports: ## Install goimports
ifeq (, $(shell which goimports))
GO111MODULE=off $(GO) get -u golang.org/x/tools/cmd/goimports
$(GO) install golang.org/x/tools/cmd/goimports@latest
endif
.PHONY: golangci

View File

@@ -11,7 +11,7 @@ the root directory of this source tree.
package format
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -182,7 +182,7 @@ func TestGeneratorFuncModule(t *testing.T) {
generator := newGenerator(config, true, withModule(module))
path := filepath.Join("..", "terraform", "testdata", "expected", "full-example-mainTf-Header.golden")
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
assert.Nil(err)

33
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/terraform-docs/terraform-docs
go 1.16
go 1.22
require (
github.com/BurntSushi/toml v1.3.2
@@ -23,19 +23,50 @@ require (
)
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect
golang.org/x/exp/typeparams v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)

2395
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,6 @@ package plugin
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -56,7 +55,7 @@ func findPlugins(dir string) (*List, error) {
clients := map[string]*goplugin.Client{}
formatters := map[string]*pluginsdk.Client{}
files, err := ioutil.ReadDir(dir)
files, err := os.ReadDir(dir)
if err != nil {
return nil, err
}

View File

@@ -11,7 +11,6 @@ the root directory of this source tree.
package testutil
import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -43,7 +42,7 @@ func GetModule(config *print.Config) (*terraform.Module, error) {
// GetExpected returns 'example' Module and expected Golden file content
func GetExpected(format, name string) (string, error) {
path := filepath.Join(testDataPath(), format, name+".golden")
bytes, err := ioutil.ReadFile(filepath.Clean(path))
bytes, err := os.ReadFile(filepath.Clean(path))
if err != nil {
return "", err
}

View File

@@ -11,7 +11,7 @@ the root directory of this source tree.
package template
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -129,12 +129,12 @@ func TestSanitizeSection(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
assert := assert.New(t)
bytes, err := ioutil.ReadFile(filepath.Join("testdata", "section", tt.filename+".golden"))
bytes, err := os.ReadFile(filepath.Join("testdata", "section", tt.filename+".golden"))
assert.Nil(err)
actual := SanitizeSection(string(bytes), tt.escape, false)
expected, err := ioutil.ReadFile(filepath.Join("testdata", "section", tt.filename+".expected"))
expected, err := os.ReadFile(filepath.Join("testdata", "section", tt.filename+".expected"))
assert.Nil(err)
assert.Equal(string(expected), actual)
@@ -168,12 +168,12 @@ func TestSanitizeDocument(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
assert := assert.New(t)
bytes, err := ioutil.ReadFile(filepath.Join("testdata", "document", tt.filename+".golden"))
bytes, err := os.ReadFile(filepath.Join("testdata", "document", tt.filename+".golden"))
assert.Nil(err)
actual := SanitizeDocument(string(bytes), tt.escape, false)
expected, err := ioutil.ReadFile(filepath.Join("testdata", "document", tt.filename+".expected"))
expected, err := os.ReadFile(filepath.Join("testdata", "document", tt.filename+".expected"))
assert.Nil(err)
assert.Equal(string(expected), actual)
@@ -229,12 +229,12 @@ func TestSanitizeMarkdownTable(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
assert := assert.New(t)
bytes, err := ioutil.ReadFile(filepath.Join("testdata", "table", tt.filename+".golden"))
bytes, err := os.ReadFile(filepath.Join("testdata", "table", tt.filename+".golden"))
assert.Nil(err)
actual := SanitizeMarkdownTable(string(bytes), tt.escape, tt.html)
expected, err := ioutil.ReadFile(filepath.Join("testdata", "table", tt.expected+".markdown.expected"))
expected, err := os.ReadFile(filepath.Join("testdata", "table", tt.expected+".markdown.expected"))
assert.Nil(err)
assert.Equal(string(expected), actual)
@@ -268,12 +268,12 @@ func TestSanitizeAsciidocTable(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
assert := assert.New(t)
bytes, err := ioutil.ReadFile(filepath.Join("testdata", "table", tt.filename+".golden"))
bytes, err := os.ReadFile(filepath.Join("testdata", "table", tt.filename+".golden"))
assert.Nil(err)
actual := SanitizeAsciidocTable(string(bytes), tt.escape, false)
expected, err := ioutil.ReadFile(filepath.Join("testdata", "table", tt.filename+".asciidoc.expected"))
expected, err := os.ReadFile(filepath.Join("testdata", "table", tt.filename+".asciidoc.expected"))
assert.Nil(err)
assert.Equal(string(expected), actual)
@@ -400,7 +400,7 @@ func TestConvertMultiLineText(t *testing.T) {
assert := assert.New(t)
path := filepath.Join("testdata", "multiline", tt.filename+".golden")
bytes, err := ioutil.ReadFile(path)
bytes, err := os.ReadFile(path)
assert.Nil(err)
actual := ConvertMultiLineText(string(bytes), tt.isTable, false, tt.showHTML)

View File

@@ -14,7 +14,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -148,7 +147,7 @@ func loadSection(config *print.Config, file string, section string) (string, err
return "", err // user explicitly asked for a file which doesn't exist
}
if getFileFormat(file) != ".tf" {
content, err := ioutil.ReadFile(filepath.Clean(filename))
content, err := os.ReadFile(filepath.Clean(filename))
if err != nil {
return "", err
}
@@ -316,7 +315,7 @@ func loadOutputValues(config *print.Config) (map[string]*output, error) {
if out, err = cmd.Output(); err != nil {
return nil, fmt.Errorf("caught error while reading the terraform outputs: %w", err)
}
} else if out, err = ioutil.ReadFile(config.OutputValues.From); err != nil {
} else if out, err = os.ReadFile(config.OutputValues.From); err != nil {
return nil, fmt.Errorf("caught error while reading the terraform outputs file at %s: %w", config.OutputValues.From, err)
}
var terraformOutputs map[string]*output

View File

@@ -11,7 +11,7 @@ the root directory of this source tree.
package terraform
import (
"io/ioutil"
"os"
"path/filepath"
"sort"
"testing"
@@ -226,7 +226,7 @@ func TestLoadHeader(t *testing.T) {
showHeader: true,
expectedData: func() (string, error) {
path := filepath.Join("testdata", "expected", "full-example-mainTf-Header.golden")
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
return string(data), err
},
},
@@ -272,7 +272,7 @@ func TestLoadFooter(t *testing.T) {
showFooter: true,
expectedData: func() (string, error) {
path := filepath.Join("testdata", "expected", "full-example-mainTf-Header.golden")
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
return string(data), err
},
},