Skip to content

Commit

Permalink
fix(deps): update all non-major dependencies (#690)
Browse files Browse the repository at this point in the history
* fix(deps): update all non-major dependencies

* update to go 1.22

run go mod tidy

* run gofmt

* fix all staticcheck warnings DT-6909

* bump codeql action

* does this fix it?

---------

Co-authored-by: Coveo Renovate Bot <[email protected]>
Co-authored-by: Jonathan Piché <[email protected]>
  • Loading branch information
3 people authored Apr 9, 2024
1 parent 5e3634e commit 9045572
Show file tree
Hide file tree
Showing 24 changed files with 163 additions and 175 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: '1.22'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -58,7 +62,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -71,6 +75,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
12 changes: 6 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.22'
- uses: actions/checkout@v4

- name: Run static checks
Expand All @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.22'
- uses: actions/checkout@v4

- run: make build
Expand All @@ -32,7 +32,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.22'
- uses: actions/checkout@v4

- run: make fmtcheck
Expand All @@ -48,7 +48,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.22'
- uses: actions/checkout@v4

- name: Install Terraform
Expand All @@ -64,7 +64,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.22'

- uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757
with:
Expand All @@ -80,7 +80,7 @@ jobs:
fetch-depth: 0 # goreleaser needs the whole history to build the release notes
- uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.22'

- uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '1.22'

- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ full-test:
go test -v ./...

static:
go install honnef.co/go/tools/cmd/staticcheck@2022.1
go install honnef.co/go/tools/cmd/staticcheck@2023.1.7
staticcheck --version

staticcheck ./...
Expand Down
6 changes: 3 additions & 3 deletions awshelper/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"regexp"
Expand Down Expand Up @@ -136,7 +136,7 @@ func SaveS3Status(bucketInfo *BucketInfo, folder string) (err error) {
if err != nil {
return
}
err = ioutil.WriteFile(filepath.Join(folder, CacheFile), jsonString, 0644)
err = os.WriteFile(filepath.Join(folder, CacheFile), jsonString, 0644)
return
}

Expand All @@ -153,7 +153,7 @@ func CheckS3Status(sourceBucketInfo *BucketInfo, folder string) error {
return fmt.Errorf("error while reading %s: %w", *sourceBucketInfo, err)
}

content, err := ioutil.ReadFile(filepath.Join(folder, CacheFile))
content, err := os.ReadFile(filepath.Join(folder, CacheFile))
if err != nil {
return err
}
Expand Down
33 changes: 16 additions & 17 deletions cli/download_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cli

import (
"fmt"
"io/ioutil"
"net/url"
"os"
"regexp"
Expand Down Expand Up @@ -130,7 +129,7 @@ func readVersionFile(terraformSource *TerraformSource) (string, error) {
// calculated using the encodeSourceVersion method.
func writeVersionFile(terraformSource *TerraformSource) error {
version := encodeSourceVersion(terraformSource.CanonicalSourceURL)
return tgerrors.WithStackTrace(ioutil.WriteFile(terraformSource.VersionFile, []byte(version), 0640))
return tgerrors.WithStackTrace(os.WriteFile(terraformSource.VersionFile, []byte(version), 0640))
}

// Take the given source path and create a TerraformSource struct from it, including the folder where the source should
Expand All @@ -141,25 +140,25 @@ func writeVersionFile(terraformSource *TerraformSource) error {
// To maximize reuse, given a working directory w and a source URL s, we download code from S into the folder /T/W/H
// where:
//
// 1. S is the part of s before the double-slash (//). This typically represents the root of the repo (e.g.
// github.com/foo/infrastructure-modules). We download the entire repo so that relative paths to other files in that
// repo resolve correctly. If no double-slash is specified, all of s is used.
// 1. T is the OS temp dir (e.g. /tmp).
// 2. W is the base 64 encoded sha1 hash of w. This ensures that if you are running Terragrunt concurrently in
// multiple folders (e.g. during automated tests), then even if those folders are using the same source URL s, they
// do not overwrite each other.
// 3. H is the base 64 encoded sha1 of S without its query string. For remote source URLs (e.g. Git
// URLs), this is based on the assumption that the scheme/host/path of the URL (e.g. git::github.com/foo/bar)
// identifies the repo, and we always want to download the same repo into the same folder (see the encodeSourceName
// method). We also assume the version of the module is stored in the query string (e.g. ref=v0.0.3), so we store
// the base 64 encoded sha1 of the query string in a file called .terragrunt-source-version within /T/W/H.
// 1. S is the part of s before the double-slash (//). This typically represents the root of the repo (e.g.
// github.com/foo/infrastructure-modules). We download the entire repo so that relative paths to other files in that
// repo resolve correctly. If no double-slash is specified, all of s is used.
// 1. T is the OS temp dir (e.g. /tmp).
// 2. W is the base 64 encoded sha1 hash of w. This ensures that if you are running Terragrunt concurrently in
// multiple folders (e.g. during automated tests), then even if those folders are using the same source URL s, they
// do not overwrite each other.
// 3. H is the base 64 encoded sha1 of S without its query string. For remote source URLs (e.g. Git
// URLs), this is based on the assumption that the scheme/host/path of the URL (e.g. git::github.com/foo/bar)
// identifies the repo, and we always want to download the same repo into the same folder (see the encodeSourceName
// method). We also assume the version of the module is stored in the query string (e.g. ref=v0.0.3), so we store
// the base 64 encoded sha1 of the query string in a file called .terragrunt-source-version within /T/W/H.
//
// The downloadTerraformSourceIfNecessary decides when we should download the Terraform code and when not to. It uses
// the following rules:
//
// 1. Always download source URLs pointing to local file paths.
// 2. Only download source URLs pointing to remote paths if /T/W/H doesn't already exist or, if it does exist, if the
// version number in /T/W/H/.terragrunt-source-version doesn't match the current version.
// 1. Always download source URLs pointing to local file paths.
// 2. Only download source URLs pointing to remote paths if /T/W/H doesn't already exist or, if it does exist, if the
// version number in /T/W/H/.terragrunt-source-version doesn't match the current version.
func processTerraformSource(source string, terragruntOptions *options.TerragruntOptions) (*TerraformSource, error) {
canonicalWorkingDir, err := util.CanonicalPath(terragruntOptions.WorkingDir, "")
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cli/download_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cli

import (
"fmt"
"io/ioutil"
"net/url"
"os"
"path/filepath"
Expand Down Expand Up @@ -183,7 +182,7 @@ func testAlreadyHaveLatestCode(t *testing.T, canonicalURL string, downloadDir st
}

func tmpDir(t *testing.T) string {
dir, err := ioutil.TempDir("", "download-source-test")
dir, err := os.MkdirTemp("", "download-source-test")
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions config/config_export_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -85,7 +85,7 @@ func (conf *TerragruntConfig) ExportVariables(existingTerraformVariables map[str
if len(content) > 0 && content[len(content)-1] != '\n' {
content = append(content, '\n')
}
if err = ioutil.WriteFile(writePath, content, 0644); handleError(err) != nil {
if err = os.WriteFile(writePath, content, 0644); handleError(err) != nil {
return fmt.Errorf("file write error: %v", err)
}
}
Expand Down
3 changes: 2 additions & 1 deletion config/config_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func (ctx *resolveContext) getParentDir() (string, error) {
}

// Returns the named environment variable or default value if it does not exist
// get_env(variable_name, default_value)
//
// get_env(variable_name, default_value)
func (ctx *resolveContext) getEnvironmentVariable(env, defValue string) string {
if value, exists := ctx.options.Env[env]; exists {
return value
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package config

import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"testing"
Expand Down Expand Up @@ -464,7 +464,7 @@ func TestReadTerragruntConfigHooksAreInitalized(t *testing.T) {

fixturesDir := "../test/fixture-hooks"

files, err := ioutil.ReadDir(fixturesDir)
files, err := os.ReadDir(fixturesDir)
if err != nil {
t.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions configstack/running_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ func toRunningModules(modules []*TerraformModule, dependencyOrder dependencyOrde

// Loop through the map of runningModules and for each module M:
//
// * If dependencyOrder is NormalOrder, plug in all the modules M depends on into the Dependencies field and all the
// modules that depend on M into the NotifyWhenDone field.
// * If dependencyOrder is ReverseOrder, do the reverse.
// - If dependencyOrder is NormalOrder, plug in all the modules M depends on into the Dependencies field and all the
// modules that depend on M into the NotifyWhenDone field.
// - If dependencyOrder is ReverseOrder, do the reverse.
func crossLinkDependencies(modules map[string]*runningModule, dependencyOrder dependencyOrder) (map[string]*runningModule, error) {
for _, module := range modules {
for _, dependency := range module.Module.Dependencies {
Expand Down
5 changes: 2 additions & 3 deletions configstack/stack_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package configstack

import (
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -52,7 +51,7 @@ func TestFindStackInSubfolders(t *testing.T) {
}

func createTempFolder(t *testing.T) string {
tmpFolder, err := ioutil.TempDir("", "")
tmpFolder, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("Failed to create temp directory: %s\n", err.Error())
}
Expand All @@ -69,7 +68,7 @@ func writeDummyTerragruntConfigs(t *testing.T, tmpFolder string, paths []string)
containingDir := filepath.Dir(absPath)
createDirIfNotExist(t, containingDir)

err := ioutil.WriteFile(absPath, contents, os.ModePerm)
err := os.WriteFile(absPath, contents, os.ModePerm)
if err != nil {
t.Fatalf("Failed to write file at path %s: %s\n", path, err.Error())
}
Expand Down
5 changes: 0 additions & 5 deletions dynamodb/dynamo_lock_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"math/rand"
"testing"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
Expand All @@ -15,10 +14,6 @@ import (
"github.com/stretchr/testify/assert"
)

func init() {
rand.Seed(time.Now().UnixNano())
}

var mockOptions = options.NewTerragruntOptionsForTest("dynamo_lock_test_utils")

// Returns a unique (ish) id we can use to name resources so they don't conflict with each other. Uses base 62 to
Expand Down
46 changes: 23 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module github.com/coveooss/terragrunt/v2

go 1.18
go 1.22

require (
github.com/alecthomas/kingpin/v2 v2.4.0
github.com/aws/aws-sdk-go-v2 v1.25.2
github.com/aws/aws-sdk-go-v2/config v1.27.4
github.com/aws/aws-sdk-go-v2/credentials v1.17.4
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.30.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.51.1
github.com/aws/aws-sdk-go-v2/service/ssm v1.49.1
github.com/aws/aws-sdk-go-v2/service/sts v1.28.1
github.com/aws/aws-sdk-go-v2 v1.26.1
github.com/aws/aws-sdk-go-v2/config v1.27.11
github.com/aws/aws-sdk-go-v2/credentials v1.17.11
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.53.1
github.com/aws/aws-sdk-go-v2/service/ssm v1.49.5
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6
github.com/cheekybits/genny v1.0.0
github.com/coveooss/gotemplate/v3 v3.7.5
github.com/coveooss/multilogger v0.5.2
Expand All @@ -23,9 +23,9 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/rs/xid v1.5.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/urfave/cli v1.22.14
github.com/zclconf/go-cty v1.14.2
github.com/zclconf/go-cty v1.14.4
gopkg.in/matryer/try.v1 v1.0.0-20150601225556-312d2599e12e
gopkg.in/yaml.v2 v2.4.0
)
Expand All @@ -46,20 +46,20 @@ require (
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/apparentlymart/go-versions v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.37.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 // indirect
github.com/aws/smithy-go v1.20.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bmatcuk/doublestar v1.3.4 // indirect
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 // indirect
Expand Down
Loading

0 comments on commit 9045572

Please sign in to comment.