diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index f3786037e..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,101 +0,0 @@ -orbs: - win: circleci/windows@1.0.0 - -version: 2.1 - -environment: &ENVIRONMENT - EMAIL: 62970560+packer-ci@users.noreply.github.com - GIT_AUTHOR_NAME: packer-ci - GIT_COMMITTER_NAME: packer-ci - -executors: - golang: - docker: - - image: docker.mirror.hashicorp.services/cimg/go:1.18 - resource_class: medium+ - darwin: - macos: - xcode: "13.4.1" - -commands: - install-go-run-tests-unix: - parameters: - GOOS: - type: string - GOVERSION: - type: string - steps: - - checkout - - run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.<< parameters.GOOS >>-amd64.tar.gz | tar -C ~/ -xz - - run: GO111MODULE=on PATH="$PATH:$HOME/go/bin/" ~/go/bin/go test ./... -race -coverprofile=coverage.txt -covermode=atomic - install-go-run-tests-windows: - parameters: - GOVERSION: - type: string - steps: - - checkout - - run: curl https://dl.google.com/go/go<< parameters.GOVERSION >>.windows-amd64.zip --output ~/go<< parameters.GOVERSION >>.windows-amd64.zip - - run: unzip ~/go<< parameters.GOVERSION >>.windows-amd64.zip -d ~/ - - run: GO111MODULE=on PATH="$PATH:$HOME/go/bin/" ~/go/bin/go test ./... -coverprofile=coverage.txt -covermode=atomic - -# Golang CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-go/ for more details -jobs: - test-linux: - executor: golang - resource_class: large - working_directory: ~/go/src/github.com/hashicorp/packer-plugin-sdk - steps: - - checkout - - run: make vet - - run: TESTARGS="-coverprofile=coverage.txt -covermode=atomic" make ci - test-darwin: - executor: darwin - working_directory: ~/go/src/github.com/hashicorp/packer-plugin-sdk - environment: - GO111MODULE: "off" - steps: - - install-go-run-tests-unix: - GOOS: darwin - GOVERSION: "1.18.5" - test-windows: - executor: - name: win/vs2019 - shell: bash.exe - steps: - - install-go-run-tests-windows: - GOVERSION: "1.18.5" - check-lint: - executor: golang - resource_class: xlarge - steps: - - checkout - - run: git fetch --all - - run: - command: make ci-lint - no_output_timeout: 30m - check-fmt: - executor: golang - steps: - - checkout - - run: make fmt-check - check-generate: - executor: golang - working_directory: ~/go/src/github.com/hashicorp/packer-plugin-sdk - steps: - - checkout - - run: make generate-check - -workflows: - version: 2 - test: - jobs: - - test-linux - - test-darwin - - test-windows - check-code: - jobs: - - check-lint - - check-fmt - - check-generate diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 73057e8b6..691d4e14f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,6 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: diff --git a/.github/release.yml b/.github/release.yml index 1f3a89f91..029406c4a 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,3 +1,6 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + changelog: categories: - title: Breaking Changes 🛠 diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 000000000..615e2e63e --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,13 @@ +name: Lint GitHub Actions Workflows +on: + push: + pull_request: +permissions: + contents: read +jobs: + actionlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + - name: "Check workflow files" + uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint:latest diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml new file mode 100644 index 000000000..85b845073 --- /dev/null +++ b/.github/workflows/go-test.yml @@ -0,0 +1,151 @@ +name: go-test +on: + push: + branches: + - main + pull_request: + branches: + - main +env: + TEST_RESULTS_PATH: /tmp/test-results +permissions: + contents: read +jobs: + linux-tests: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: + - '1.20' + - '1.21.x' + permissions: + id-token: write + contents: read + steps: + - name: Setup go + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Check that go.mod does not contain a replace + run: | + if grep -Eq "^\s*replace" &2 + false + fi + + - name: Create test directory + run: | + mkdir -p ${{ env.TEST_RESULTS_PATH }}/packer-plugin-sdk + + - name: Run gofmt + run: | + make fmt-check + + - name: Run Go Generate Check + run: | + make generate-check + + - name: Install gotestsum + run: go install gotest.tools/gotestsum@v1.8.2 + + # Required for passing tests as we need to have a replace in the go.mod + # otherwise we'll get compile-time errors when running them + - name: Fix gocty + run: | + make install-gen-deps + packer-sdc fix . + go mod tidy + + - name: Run Go tests + run: | + PACKAGE_NAMES="$(go list ./...)" + echo "Running $(echo "$PACKAGE_NAMES" | wc -w) packages" + echo "$PACKAGE_NAMES" + echo "$PACKAGE_NAMES" | xargs -I {} gotestsum --format=short-verbose --junitfile "$TEST_RESULTS_PATH"/packer-plugin-sdk/gotestsum-report.xml -- -count 1 -p 2 {}; + + windows-tests: + runs-on: windows-latest + strategy: + matrix: + go-version: + - '1.20' + - '1.21.x' + permissions: + id-token: write + contents: read + steps: + - name: Run git config #Windows-only + run: git config --global core.autocrlf false + + - name: Setup Go + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Install gotestsum + shell: bash + run: go install gotest.tools/gotestsum@v1.8.2 + + # Required for passing tests as we need to have a replace in the go.mod + # otherwise we'll get compile-time errors when running them + - name: Fix gocty + run: | + make install-gen-deps + packer-sdc fix . + go mod tidy + + - name: Run Go tests + shell: bash + run: | + PACKAGE_NAMES="$(go list ./...)" + echo "Running $(echo "$PACKAGE_NAMES" | wc -w) packages" + echo "$PACKAGE_NAMES" + echo "$PACKAGE_NAMES" | xargs -I {} gotestsum --format=short-verbose --junitfile "$TEST_RESULTS_PATH"/packer-plugin-sdk/gotestsum-report.xml -- -count 1 -p 2 {}; + + darwin-tests: + runs-on: macos-latest + strategy: + matrix: + go-version: + - '1.20' + - '1.21.x' + permissions: + id-token: write + contents: read + steps: + - name: Setup go + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Create test directory + run: | + mkdir -p ${{ env.TEST_RESULTS_PATH }}/packer-plugin-sdk + + - name: Install gotestsum + run: go install gotest.tools/gotestsum@v1.8.2 + + # Required for passing tests as we need to have a replace in the go.mod + # otherwise we'll get compile-time errors when running them + - name: Fix gocty + run: | + make install-gen-deps + packer-sdc fix . + go mod tidy + + - name: Run Go tests + run: | + PACKAGE_NAMES="$(go list ./...)" + echo "Running $(echo "$PACKAGE_NAMES" | wc -w) packages" + echo "$PACKAGE_NAMES" + echo "$PACKAGE_NAMES" | xargs -I {} gotestsum --format=short-verbose --junitfile "$TEST_RESULTS_PATH"/packer-plugin-sdk/gotestsum-report.xml -- -count 1 -p 2 {}; diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df3257059..5b5995f6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,9 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: GoReleaser - uses: goreleaser/goreleaser-action@v3.0.0 - args: "release" + uses: goreleaser/goreleaser-action@v5.1.0 + with: + args: "release" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index f1585ec9c..dc7c141b6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,3 +1,6 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + project_name: packer-plugin-sdk build: skip: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 502f9b139..e6da20a0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - See [Releases](https://github.com/hashicorp/packer-plugin-sdk/releases) for latest CHANGELOG information. + # Latest Release + Please refer to [releases](https://github.com/hashicorp/packer-plugin-sdk/releases) for latest CHANGELOG information. ## 0.3.1 (July 28, 2022) diff --git a/LICENSE b/LICENSE index a612ad981..c121cee6e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,5 @@ +Copyright (c) 2020 HashiCorp, Inc. + Mozilla Public License Version 2.0 ================================== diff --git a/README.md b/README.md index c0a0a531a..5682ad187 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,11 @@ See the [Extending Packer](https://www.packer.io/docs/plugins/creation#extending See the [Extending Packer](https://www.packer.io/docs/plugins/creation#extending-packer) section on the Packer website. +## Testing + +The SDK embeds tests to ensure we don't introduce a regression in the future. Up to version 0.5.0 of the SDK, tests would be runnable with `make test` on their own but since we removed the `replace` statement for `go-cty` tests won't work out-of-the-box. Users will need to invoke `packer-sdc fix .` in order to fix the `go.mod` and `go.sum` files before running tests. +Please do not commit these changes, as adding this `replace` section to the `go.mod` file will make it impossible for dependents to run `go install` for `packer-sdc` afterwards. + ## Packer Scope (Plugins VS Core) ### Packer Core diff --git a/acctest/doc.go b/acctest/doc.go index 56f4edddd..fea0ca787 100644 --- a/acctest/doc.go +++ b/acctest/doc.go @@ -1,79 +1,83 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package acctest provides an acceptance testing framework for testing builders and provisioners. -Writing Provisioner Acceptance Tests +# Writing Provisioner Acceptance Tests Packer has implemented a `ProvisionerTestCase` structure to help write provisioner acceptance tests. ```go -type ProvisionerTestCase struct { - // Check is called after this step is executed in order to test that - // the step executed successfully. If this is not set, then the next - // step will be called - Check func(*exec.Cmd, string) error - // IsCompatible checks whether a provisioner is able to run against a - // given builder type and guest operating system, and returns a boolean. - // if it returns true, the test combination is okay to run. If false, the - // test combination is not okay to run. - IsCompatible func(builderType string, BuilderGuestOS string) bool - // Name is the name of the test case. Be simple but unique and descriptive. - Name string - // Setup, if non-nil, will be called once before the test case - // runs. This can be used for some setup like setting environment - // variables, or for validation prior to the - // test running. For example, you can use this to make sure certain - // binaries are installed, or text fixtures are in place. - Setup func() error - // Teardown will be called before the test case is over regardless - // of if the test succeeded or failed. This should return an error - // in the case that the test can't guarantee all resources were - // properly cleaned up. - Teardown builderT.TestTeardownFunc - // Template is the provisioner template to use. - // The provisioner template fragment must be a json-formatted string - // containing the provisioner definition but no other portions of a packer - // template. For - // example: - // - // ```json - // { - // "type": "shell-local", - // "inline", ["echo hello world"] - // } - //``` - // - // is a valid entry for "template" here, but the complete Packer template: - // - // ```json - // { - // "provisioners": [ - // { - // "type": "shell-local", - // "inline", ["echo hello world"] - // } - // ] - // } - // ``` - // - // is invalid as input. - // - // You may provide multiple provisioners in the same template. For example: - // ```json - // { - // "type": "shell-local", - // "inline", ["echo hello world"] - // }, - // { - // "type": "shell-local", - // "inline", ["echo hello world 2"] - // } - // ``` - Template string - // Type is the type of provisioner. - Type string -} + + type ProvisionerTestCase struct { + // Check is called after this step is executed in order to test that + // the step executed successfully. If this is not set, then the next + // step will be called + Check func(*exec.Cmd, string) error + // IsCompatible checks whether a provisioner is able to run against a + // given builder type and guest operating system, and returns a boolean. + // if it returns true, the test combination is okay to run. If false, the + // test combination is not okay to run. + IsCompatible func(builderType string, BuilderGuestOS string) bool + // Name is the name of the test case. Be simple but unique and descriptive. + Name string + // Setup, if non-nil, will be called once before the test case + // runs. This can be used for some setup like setting environment + // variables, or for validation prior to the + // test running. For example, you can use this to make sure certain + // binaries are installed, or text fixtures are in place. + Setup func() error + // Teardown will be called before the test case is over regardless + // of if the test succeeded or failed. This should return an error + // in the case that the test can't guarantee all resources were + // properly cleaned up. + Teardown builderT.TestTeardownFunc + // Template is the provisioner template to use. + // The provisioner template fragment must be a json-formatted string + // containing the provisioner definition but no other portions of a packer + // template. For + // example: + // + // ```json + // { + // "type": "shell-local", + // "inline", ["echo hello world"] + // } + //``` + // + // is a valid entry for "template" here, but the complete Packer template: + // + // ```json + // { + // "provisioners": [ + // { + // "type": "shell-local", + // "inline", ["echo hello world"] + // } + // ] + // } + // ``` + // + // is invalid as input. + // + // You may provide multiple provisioners in the same template. For example: + // ```json + // { + // "type": "shell-local", + // "inline", ["echo hello world"] + // }, + // { + // "type": "shell-local", + // "inline", ["echo hello world 2"] + // } + // ``` + Template string + // Type is the type of provisioner. + Type string + } ``` @@ -86,62 +90,65 @@ The following example has been adapted from a shell-local provisioner test: ``` import ( - "github.com/hashicorp/packer-plugin-sdk/acctest/provisioneracc" - "github.com/hashicorp/packer-plugin-sdk/acctest/testutils" + + "github.com/hashicorp/packer-plugin-sdk/acctest/provisioneracc" + "github.com/hashicorp/packer-plugin-sdk/acctest/testutils" + ) // ... -func TestAccShellProvisioner_basic(t *testing.T) { - // Create a json template fragment containing just the provisioners you want - // to run. - templateString := `{ - "type": "shell-local", - "script": "test-fixtures/script.sh", - "max_retries" : 5 -}` - - // instantiate a test case. - testCase := &provisioneracc.ProvisionerTestCase{ - IsCompatible: func() bool {return true}, - Name: "shell-local-provisioner-basic", - Teardown: func() error { - testutils.CleanupFiles("test-fixtures/file.txt") - return nil - }, - Template: templateString, - Type: "shell-local", - Check: func(buildcommand *exec.Cmd, logfile string) error { - if buildcommand.ProcessState != nil { - if buildcommand.ProcessState.ExitCode() != 0 { - return fmt.Errorf("Bad exit code. Logfile: %s", logfile) - } - } - filecontents, err := loadFile("file.txt") - if err != nil { - return err - } - if !strings.Contains(filecontents, "hello") { - return fmt.Errorf("file contents were wrong: %s", filecontents) - } - return nil - }, - } - - provisioneracc.TestProvisionersAgainstBuilders(testCase, t) -} + func TestAccShellProvisioner_basic(t *testing.T) { + // Create a json template fragment containing just the provisioners you want + // to run. + templateString := `{ + "type": "shell-local", + "script": "test-fixtures/script.sh", + "max_retries" : 5 + }` + + // instantiate a test case. + testCase := &provisioneracc.ProvisionerTestCase{ + IsCompatible: func() bool {return true}, + Name: "shell-local-provisioner-basic", + Teardown: func() error { + testutils.CleanupFiles("test-fixtures/file.txt") + return nil + }, + Template: templateString, + Type: "shell-local", + Check: func(buildcommand *exec.Cmd, logfile string) error { + if buildcommand.ProcessState != nil { + if buildcommand.ProcessState.ExitCode() != 0 { + return fmt.Errorf("Bad exit code. Logfile: %s", logfile) + } + } + filecontents, err := loadFile("file.txt") + if err != nil { + return err + } + if !strings.Contains(filecontents, "hello") { + return fmt.Errorf("file contents were wrong: %s", filecontents) + } + return nil + }, + } + + provisioneracc.TestProvisionersAgainstBuilders(testCase, t) + } ``` - After writing the struct and implementing the interface, now is time to write the test that will run all of this code you wrote. Your test should be like: ```go -func TestShellProvisioner(t *testing.T) { - acc.TestProvisionersPreCheck("shell", t) - acc.TestProvisionersAgainstBuilders(new(ShellProvisionerAccTest), t) -} + + func TestShellProvisioner(t *testing.T) { + acc.TestProvisionersPreCheck("shell", t) + acc.TestProvisionersAgainstBuilders(new(ShellProvisionerAccTest), t) + } + ``` The method `TestProvisionersAgainstBuilders` will run the provisioner against @@ -154,26 +161,28 @@ builder fragment. For example, one of our amazon-ebs builders is defined in provisioneracc/test-fixtures/amazon-ebs/amazon-ebs.txt and contains: ```json -{ - "type": "amazon-ebs", - "ami_name": "packer-acc-test", - "instance_type": "t2.micro", - "region": "us-east-1", - "ssh_username": "ubuntu", - "source_ami_filter": { - "filters": { - "virtualization-type": "hvm", - "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", - "root-device-type": "ebs" - }, - "owners": ["099720109477"], - "most_recent": true - }, - "force_deregister" : true, - "tags": { - "packer-test": "true" - } -} + + { + "type": "amazon-ebs", + "ami_name": "packer-acc-test", + "instance_type": "t2.micro", + "region": "us-east-1", + "ssh_username": "ubuntu", + "source_ami_filter": { + "filters": { + "virtualization-type": "hvm", + "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", + "root-device-type": "ebs" + }, + "owners": ["099720109477"], + "most_recent": true + }, + "force_deregister" : true, + "tags": { + "packer-test": "true" + } + } + ``` note that this fragment does not contain anything other than a single builder @@ -184,53 +193,55 @@ In order to tell the testing framework how to use this builder fragment, you need to implement a `BuilderFixture` struct: ```go -type BuilderFixture struct { - // Name is the name of the builder fixture. - // Be simple and descriptive. - Name string - // Setup creates necessary extra test fixtures, and renders their values - // into the BuilderFixture.Template. - Setup func() - // Template is the path to a builder template fragment. - // The builder template fragment must be a json-formatted file containing - // the builder definition but no other portions of a packer template. For - // example: - // - // ```json - // { - // "type": "null", - // "communicator", "none" - // } - //``` - // - // is a valid entry for "template" here, but the complete Packer template: - // - // ```json - // { - // "builders": [ - // "type": "null", - // "communicator": "none" - // ] - // } - // ``` - // - // is invalid as input. - // - // Only provide one builder template fragment per file. - TemplatePath string - - // GuestOS says what guest os type the builder template fragment creates. - // Valid values are "windows", "linux" or "darwin" guests. - GuestOS string - - // HostOS says what host os type the builder is capable of running on. - // Valid values are "any", windows", or "posix". If you set "posix", then - // this builder can run on a "linux" or "darwin" platform. If you set - // "any", then this builder can be used on any platform. - HostOS string - - Teardown builderT.TestTeardownFunc -} + + type BuilderFixture struct { + // Name is the name of the builder fixture. + // Be simple and descriptive. + Name string + // Setup creates necessary extra test fixtures, and renders their values + // into the BuilderFixture.Template. + Setup func() + // Template is the path to a builder template fragment. + // The builder template fragment must be a json-formatted file containing + // the builder definition but no other portions of a packer template. For + // example: + // + // ```json + // { + // "type": "null", + // "communicator", "none" + // } + //``` + // + // is a valid entry for "template" here, but the complete Packer template: + // + // ```json + // { + // "builders": [ + // "type": "null", + // "communicator": "none" + // ] + // } + // ``` + // + // is invalid as input. + // + // Only provide one builder template fragment per file. + TemplatePath string + + // GuestOS says what guest os type the builder template fragment creates. + // Valid values are "windows", "linux" or "darwin" guests. + GuestOS string + + // HostOS says what host os type the builder is capable of running on. + // Valid values are "any", windows", or "posix". If you set "posix", then + // this builder can run on a "linux" or "darwin" platform. If you set + // "any", then this builder can be used on any platform. + HostOS string + + Teardown builderT.TestTeardownFunc + } + ``` Implement this struct to the file "provisioneracc/builders.go", then add the new implementation to the `BuildersAccTest` map in diff --git a/acctest/pluginacc.go b/acctest/pluginacc.go index d2dc531d1..7d5e13ee9 100644 --- a/acctest/pluginacc.go +++ b/acctest/pluginacc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package acctest import ( @@ -22,6 +25,10 @@ const TestEnvVar = "PACKER_ACC" type PluginTestCase struct { // Init, if true `packer init` will be executed prior to `packer build`. Init bool + // BuildExtraArgs is the list of arguments to be passed as extra to the packer build + // command. + // These arguments are injected before the already present `--machine-readable` option. + BuildExtraArgs []string // CheckInit is called after packer init step is executed in order to test that // the step executed successfully. If this is not set, then the next // step will be called @@ -56,9 +63,7 @@ type TestTeardownFunc func() error //nolint:errcheck func TestPlugin(t *testing.T, testCase *PluginTestCase) { if os.Getenv(TestEnvVar) == "" { - t.Skip(fmt.Sprintf( - "Acceptance tests skipped unless env '%s' set", - TestEnvVar)) + t.Skipf("Acceptance tests skipped unless env '%s' set", TestEnvVar) return } @@ -117,8 +122,14 @@ func TestPlugin(t *testing.T, testCase *PluginTestCase) { } } + buildArgs := []string{"build"} + for _, arg := range testCase.BuildExtraArgs { + buildArgs = append(buildArgs, arg) + } + buildArgs = append(buildArgs, "--machine-readable", templatePath) + // Run build - buildCommand := exec.Command(packerbin, "build", "--machine-readable", templatePath) + buildCommand := exec.Command(packerbin, buildArgs...) buildCommand.Env = append(buildCommand.Env, os.Environ()...) buildCommand.Env = append(buildCommand.Env, "PACKER_LOG=1", fmt.Sprintf("PACKER_LOG_PATH=%s", logfile)) diff --git a/acctest/provisioneracc/builders.go b/acctest/provisioneracc/builders.go index 84010c07e..4fcf1620c 100644 --- a/acctest/provisioneracc/builders.go +++ b/acctest/provisioneracc/builders.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package provisioneracc creates a framework for provisioner acceptance testing. For builder acceptance testing, use the top level tooling in the diff --git a/acctest/provisioneracc/provisioners.go b/acctest/provisioneracc/provisioners.go index 8473ced8b..045b2500c 100644 --- a/acctest/provisioneracc/provisioners.go +++ b/acctest/provisioneracc/provisioners.go @@ -1,9 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package provisioneracc import ( "bytes" "fmt" - "io/ioutil" + "io" "log" "os" "os/exec" @@ -154,7 +157,7 @@ func LoadBuilderFragment(templateFragmentPath string) (string, error) { } defer fragmentFile.Close() - fragmentString, err := ioutil.ReadAll(fragmentFile) + fragmentString, err := io.ReadAll(fragmentFile) if err != nil { return "", fmt.Errorf("Unable to read %s", fragmentAbsPath) } diff --git a/acctest/testutils/utils.go b/acctest/testutils/utils.go index 2a493618e..dde030783 100644 --- a/acctest/testutils/utils.go +++ b/acctest/testutils/utils.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package testutils provides some simple ease-of-use tools for implementing // acceptance testing. package testutils @@ -5,7 +8,6 @@ package testutils import ( "encoding/json" "fmt" - "io/ioutil" "os" ) @@ -45,7 +47,7 @@ func GetArtifact(manifestfilepath string) (ManifestFile, error) { // "last_run_uuid": "81fc083f-0b78-d815-ed3a-2e5f53b36bff" // } manifest := ManifestFile{} - data, err := ioutil.ReadFile(manifestfilepath) + data, err := os.ReadFile(manifestfilepath) if err != nil { return manifest, fmt.Errorf("failed to open manifest file %s", manifestfilepath) } diff --git a/adapter/adapter.go b/adapter/adapter.go index 5d9adf455..6b387ace6 100644 --- a/adapter/adapter.go +++ b/adapter/adapter.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package adapter import ( @@ -102,7 +105,6 @@ func (c *Adapter) handleSession(newChannel ssh.NewChannel) error { // Sessions have requests such as "pty-req", "shell", "env", and "exec". // see RFC 4254, section 6 go func(in <-chan *ssh.Request) { - env := make([]envRequestPayload, 4) for req := range in { switch req.Type { case "pty-req": @@ -117,7 +119,6 @@ func (c *Adapter) handleSession(newChannel ssh.NewChannel) error { req.Reply(false, nil) continue } - env = append(env, req.Payload) log.Printf("new env request: %s", req.Payload) req.Reply(true, nil) case "exec": @@ -204,7 +205,7 @@ func (c *Adapter) exec(command string, in io.Reader, out io.Writer, err io.Write func serveSCP(args string) bool { opts, _ := scpOptions(args) - return bytes.IndexAny(opts, "tf") >= 0 + return bytes.ContainsAny(opts, "tf") } func (c *Adapter) scpExec(args string, in io.Reader, out io.Writer) error { diff --git a/adapter/adapter_test.go b/adapter/adapter_test.go index 30f6cbe52..197c12c6c 100644 --- a/adapter/adapter_test.go +++ b/adapter/adapter_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package adapter import ( diff --git a/adapter/doc.go b/adapter/doc.go index bf6254089..64fc1564f 100644 --- a/adapter/doc.go +++ b/adapter/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package adapter helps command line tools connect to the guest via a Packer communicator. diff --git a/adapter/scp.go b/adapter/scp.go index ccf2c1fb0..0b34c2937 100644 --- a/adapter/scp.go +++ b/adapter/scp.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package adapter import ( @@ -39,13 +42,13 @@ well. func scpUploadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packersdk.Communicator) error { rest = strings.TrimSpace(rest) if len(rest) == 0 { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return errors.New("no scp target specified") } d, err := tmp.Dir("ansible-upload") if err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return err } defer os.RemoveAll(d) @@ -57,20 +60,20 @@ func scpUploadSession(opts []byte, rest string, in io.Reader, out io.Writer, com // irrelevant. state := &scpUploadState{target: rest, srcRoot: d, comm: comm} - fmt.Fprintf(out, scpOK) // signal the client to start the transfer. + fmt.Fprint(out, scpOK) // signal the client to start the transfer. return state.Protocol(bufio.NewReader(in), out) } func scpDownloadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packersdk.Communicator) error { rest = strings.TrimSpace(rest) if len(rest) == 0 { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return errors.New("no scp source specified") } d, err := tmp.Dir("ansible-download") if err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return err } defer os.RemoveAll(d) @@ -78,20 +81,20 @@ func scpDownloadSession(opts []byte, rest string, in io.Reader, out io.Writer, c if bytes.Contains([]byte{'d'}, opts) { // the only ansible module that supports downloading via scp is fetch, // fetch only supports file downloads as of Ansible 2.1. - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return errors.New("directory downloads not supported") } f, err := os.Create(filepath.Join(d, filepath.Base(rest))) if err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return err } defer f.Close() err = comm.Download(rest, f) if err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return err } @@ -115,7 +118,7 @@ func (state *scpDownloadState) FileProtocol(path string, info os.FileInfo, in *b defer f.Close() io.CopyN(out, f, size) - fmt.Fprintf(out, scpOK) + fmt.Fprint(out, scpOK) return scpResponse(in) } @@ -154,12 +157,12 @@ func (state *scpUploadState) Protocol(in *bufio.Reader, out io.Writer) error { return state.FileProtocol(in, out) case 'E': state.dir = filepath.Dir(state.dir) - fmt.Fprintf(out, scpOK) + fmt.Fprint(out, scpOK) return nil case 'D': return state.DirProtocol(in, out) default: - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return fmt.Errorf("unexpected message: %c", b) } } @@ -175,10 +178,10 @@ func (state *scpUploadState) FileProtocol(in *bufio.Reader, out io.Writer) error var name string _, err := fmt.Fscanf(in, "%04o %d %s\n", &mode, &size, &name) if err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return fmt.Errorf("invalid file message: %v", err) } - fmt.Fprintf(out, scpOK) + fmt.Fprint(out, scpOK) var fi os.FileInfo = fileInfo{name: name, size: size, mode: mode, mtime: state.mtime} @@ -189,7 +192,7 @@ func (state *scpUploadState) FileProtocol(in *bufio.Reader, out io.Writer) error err = state.comm.Upload(dest, io.LimitReader(in, fi.Size()), &fi) if err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return err } @@ -197,17 +200,17 @@ func (state *scpUploadState) FileProtocol(in *bufio.Reader, out io.Writer) error return err } - fmt.Fprintf(out, scpOK) + fmt.Fprint(out, scpOK) return nil } func (state *scpUploadState) TimeProtocol(in *bufio.Reader, out io.Writer) error { var m, a int64 if _, err := fmt.Fscanf(in, "%d 0 %d 0\n", &m, &a); err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return err } - fmt.Fprintf(out, scpOK) + fmt.Fprint(out, scpOK) state.atime = time.Unix(a, 0) state.mtime = time.Unix(m, 0) @@ -220,10 +223,10 @@ func (state *scpUploadState) DirProtocol(in *bufio.Reader, out io.Writer) error var name string if _, err := fmt.Fscanf(in, "%04o %d %s\n", &mode, &length, &name); err != nil { - fmt.Fprintf(out, scpEmptyError) + fmt.Fprint(out, scpEmptyError) return fmt.Errorf("invalid directory message: %v", err) } - fmt.Fprintf(out, scpOK) + fmt.Fprint(out, scpOK) path := filepath.Join(state.dir, name) if err := os.Mkdir(path, mode); err != nil { diff --git a/bootcommand/boot_command.go b/bootcommand/boot_command.go index 940b8561e..5fbfeee66 100644 --- a/bootcommand/boot_command.go +++ b/bootcommand/boot_command.go @@ -611,14 +611,20 @@ var g = &grammar{ ignoreCase: true, want: "\"right\"i", }, + &litMatcher{ + pos: position{line: 71, col: 32, offset: 1699}, + val: "menu", + ignoreCase: true, + want: "\"menu\"i", + }, }, }, }, { name: "NonZeroDigit", - pos: position{line: 73, col: 1, offset: 1698}, + pos: position{line: 73, col: 1, offset: 1708}, expr: &charClassMatcher{ - pos: position{line: 73, col: 16, offset: 1713}, + pos: position{line: 73, col: 16, offset: 1723}, val: "[1-9]", ranges: []rune{'1', '9'}, ignoreCase: false, @@ -627,9 +633,9 @@ var g = &grammar{ }, { name: "Digit", - pos: position{line: 74, col: 1, offset: 1719}, + pos: position{line: 74, col: 1, offset: 1729}, expr: &charClassMatcher{ - pos: position{line: 74, col: 9, offset: 1727}, + pos: position{line: 74, col: 9, offset: 1737}, val: "[0-9]", ranges: []rune{'0', '9'}, ignoreCase: false, @@ -638,48 +644,48 @@ var g = &grammar{ }, { name: "TimeUnit", - pos: position{line: 75, col: 1, offset: 1733}, + pos: position{line: 75, col: 1, offset: 1743}, expr: &choiceExpr{ - pos: position{line: 75, col: 13, offset: 1745}, + pos: position{line: 75, col: 13, offset: 1755}, alternatives: []interface{}{ &litMatcher{ - pos: position{line: 75, col: 13, offset: 1745}, + pos: position{line: 75, col: 13, offset: 1755}, val: "ns", ignoreCase: false, want: "\"ns\"", }, &litMatcher{ - pos: position{line: 75, col: 20, offset: 1752}, + pos: position{line: 75, col: 20, offset: 1762}, val: "us", ignoreCase: false, want: "\"us\"", }, &litMatcher{ - pos: position{line: 75, col: 27, offset: 1759}, + pos: position{line: 75, col: 27, offset: 1769}, val: "µs", ignoreCase: false, want: "\"µs\"", }, &litMatcher{ - pos: position{line: 75, col: 34, offset: 1767}, + pos: position{line: 75, col: 34, offset: 1777}, val: "ms", ignoreCase: false, want: "\"ms\"", }, &litMatcher{ - pos: position{line: 75, col: 41, offset: 1774}, + pos: position{line: 75, col: 41, offset: 1784}, val: "s", ignoreCase: false, want: "\"s\"", }, &litMatcher{ - pos: position{line: 75, col: 47, offset: 1780}, + pos: position{line: 75, col: 47, offset: 1790}, val: "m", ignoreCase: false, want: "\"m\"", }, &litMatcher{ - pos: position{line: 75, col: 53, offset: 1786}, + pos: position{line: 75, col: 53, offset: 1796}, val: "h", ignoreCase: false, want: "\"h\"", @@ -690,11 +696,11 @@ var g = &grammar{ { name: "_", displayName: "\"whitespace\"", - pos: position{line: 77, col: 1, offset: 1792}, + pos: position{line: 77, col: 1, offset: 1802}, expr: &zeroOrMoreExpr{ - pos: position{line: 77, col: 19, offset: 1810}, + pos: position{line: 77, col: 19, offset: 1820}, expr: &charClassMatcher{ - pos: position{line: 77, col: 19, offset: 1810}, + pos: position{line: 77, col: 19, offset: 1820}, val: "[ \\n\\t\\r]", chars: []rune{' ', '\n', '\t', '\r'}, ignoreCase: false, @@ -704,11 +710,11 @@ var g = &grammar{ }, { name: "EOF", - pos: position{line: 79, col: 1, offset: 1822}, + pos: position{line: 79, col: 1, offset: 1832}, expr: ¬Expr{ - pos: position{line: 79, col: 8, offset: 1829}, + pos: position{line: 79, col: 8, offset: 1839}, expr: &anyMatcher{ - line: 79, col: 9, offset: 1830, + line: 79, col: 9, offset: 1840, }, }, }, @@ -897,18 +903,17 @@ func Entrypoint(ruleName string) Option { // // Example usage: // -// input := "input" -// stats := Stats{} -// _, err := Parse("input-file", []byte(input), Statistics(&stats, "no match")) -// if err != nil { -// log.Panicln(err) -// } -// b, err := json.MarshalIndent(stats.ChoiceAltCnt, "", " ") -// if err != nil { -// log.Panicln(err) -// } -// fmt.Println(string(b)) -// +// input := "input" +// stats := Stats{} +// _, err := Parse("input-file", []byte(input), Statistics(&stats, "no match")) +// if err != nil { +// log.Panicln(err) +// } +// b, err := json.MarshalIndent(stats.ChoiceAltCnt, "", " ") +// if err != nil { +// log.Panicln(err) +// } +// fmt.Println(string(b)) func Statistics(stats *Stats, choiceNoMatch string) Option { return func(p *parser) Option { oldStats := p.Stats diff --git a/bootcommand/boot_command.pigeon b/bootcommand/boot_command.pigeon index fdfbba0cf..982e8f98d 100644 --- a/bootcommand/boot_command.pigeon +++ b/bootcommand/boot_command.pigeon @@ -68,7 +68,7 @@ SpecialKey = "bs"i / "del"i / "enter"i / "esc"i / "f10"i / "f11"i / "f12"i / "return"i / "tab"i / "up"i / "down"i / "spacebar"i / "insert"i / "home"i / "end"i / "pageUp"i / "pageDown"i / "leftAlt"i / "leftCtrl"i / "leftShift"i / "rightAlt"i / "rightCtrl"i / "rightShift"i / "leftSuper"i / "rightSuper"i - / "left"i / "right"i + / "left"i / "right"i / "menu"i NonZeroDigit = [1-9] Digit = [0-9] diff --git a/bootcommand/boot_command_ast.go b/bootcommand/boot_command_ast.go index f680345c4..ad1eefc11 100644 --- a/bootcommand/boot_command_ast.go +++ b/bootcommand/boot_command_ast.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( diff --git a/bootcommand/boot_command_ast_test.go b/bootcommand/boot_command_ast_test.go index 49bbb5cd4..fd2a4b4ec 100644 --- a/bootcommand/boot_command_ast_test.go +++ b/bootcommand/boot_command_ast_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( @@ -12,7 +15,7 @@ func Test_parse(t *testing.T) { in := "" in += "foo/bar > one ç•Œ" in += " b" - in += "" + in += "" expected := []string{ "Wait<1s>", "Wait<20s>", @@ -48,6 +51,7 @@ func Test_parse(t *testing.T) { "Spec-Press(leftalt)", "Spec-Press(rightshift)", "Spec-Press(rightsuper)", + "Spec-Press(menu)", } seq, err := GenerateExpressionSequence(in) diff --git a/bootcommand/config.go b/bootcommand/config.go index 2ef5d926f..6cf77dbcb 100644 --- a/bootcommand/config.go +++ b/bootcommand/config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown package bootcommand @@ -50,7 +53,7 @@ const PackerKeyDefault = 100 * time.Millisecond // // - ` ` - Simulates pressing the home and end keys. // -// - ` ` - Simulates pressing the page up and page down +// - ` ` - Simulates pressing the page up and page down // keys. // // - `` - Simulates pressing the Menu key. @@ -63,24 +66,24 @@ const PackerKeyDefault = 100 * time.Millisecond // // - ` ` - Simulates pressing the ⌘ or Windows key. // -// - ` ` - Adds a 1, 5 or 10 second pause before +// - ` ` - Adds a 1, 5 or 10 second pause before // sending any additional keys. This is useful if you have to generally // wait for the UI to update before typing more. // -// - `` - Add an arbitrary pause before sending any additional keys. +// - `` - Add an arbitrary pause before sending any additional keys. // The format of `XX` is a sequence of positive decimal numbers, each with // optional fraction and a unit suffix, such as `300ms`, `1.5h` or `2h45m`. // Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. For // example `` or ``. // -// - ` ` - Any printable keyboard character, and of these -// "special" expressions, with the exception of the `` types, can -// also be toggled on or off. For example, to simulate ctrl+c, use -// `c`. Be sure to release them, otherwise they -// will be held down until the machine reboots. To hold the `c` key down, -// you would use ``. Likewise, `` to release. +// - ` ` - Any printable keyboard character, and of these +// "special" expressions, with the exception of the `` types, can +// also be toggled on or off. For example, to simulate ctrl+c, use +// `c`. Be sure to release them, otherwise they +// will be held down until the machine reboots. To hold the `c` key down, +// you would use ``. Likewise, `` to release. // -// - `{{ .HTTPIP }} {{ .HTTPPort }}` - The IP and port, respectively of an +// - `{{ .HTTPIP }} {{ .HTTPPort }}` - The IP and port, respectively of an // HTTP server that is started serving the directory specified by the // `http_directory` configuration parameter. If `http_directory` isn't // specified, these will be blank! @@ -94,18 +97,22 @@ const PackerKeyDefault = 100 * time.Millisecond // // ```json // "boot_command": [ -// "", -// " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" -// ] +// +// "", +// " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" +// ] +// // ``` // // In HCL2: // // ```hcl // boot_command = [ -// "", -// " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" -// ] +// +// "", +// " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" +// ] +// // ``` // // The example shown below is a working boot command used to start an Ubuntu @@ -115,15 +122,17 @@ const PackerKeyDefault = 100 * time.Millisecond // // ```json // "boot_command": [ -// "", -// "/install/vmlinuz noapic ", -// "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", -// "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", -// "hostname={{ .Name }} ", -// "fb=false debconf/frontend=noninteractive ", -// "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", -// "keyboard-configuration/variant=USA console-setup/ask_detect=false ", -// "initrd=/install/initrd.gz -- " +// +// "", +// "/install/vmlinuz noapic ", +// "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", +// "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", +// "hostname={{ .Name }} ", +// "fb=false debconf/frontend=noninteractive ", +// "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", +// "keyboard-configuration/variant=USA console-setup/ask_detect=false ", +// "initrd=/install/initrd.gz -- " +// // ] // ``` // @@ -131,20 +140,22 @@ const PackerKeyDefault = 100 * time.Millisecond // // ```hcl // boot_command = [ -// "", -// "/install/vmlinuz noapic ", -// "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", -// "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", -// "hostname={{ .Name }} ", -// "fb=false debconf/frontend=noninteractive ", -// "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", -// "keyboard-configuration/variant=USA console-setup/ask_detect=false ", -// "initrd=/install/initrd.gz -- " +// +// "", +// "/install/vmlinuz noapic ", +// "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", +// "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", +// "hostname={{ .Name }} ", +// "fb=false debconf/frontend=noninteractive ", +// "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", +// "keyboard-configuration/variant=USA console-setup/ask_detect=false ", +// "initrd=/install/initrd.gz -- " +// // ] // ``` // // For more examples of various boot commands, see the sample projects from our -// [community templates page](/community-tools#templates). +// [community templates page](https://packer.io/community-tools#templates). type BootConfig struct { // Time to wait after sending a group of key pressses. The value of this // should be a duration. Examples are `5s` and `1m30s` which will cause diff --git a/bootcommand/config_test.go b/bootcommand/config_test.go index a8297c17f..85aa88c70 100644 --- a/bootcommand/config_test.go +++ b/bootcommand/config_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( diff --git a/bootcommand/doc.go b/bootcommand/doc.go index 2bfa3d8bd..440ec699f 100644 --- a/bootcommand/doc.go +++ b/bootcommand/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package bootcommand generates and sends boot commands to the remote instance. // // This package is relevant to people who want to create new builders, particularly diff --git a/bootcommand/driver.go b/bootcommand/driver.go index 04b0eecd6..cc49b1672 100644 --- a/bootcommand/driver.go +++ b/bootcommand/driver.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand const shiftedChars = "~!@#$%^&*()_+{}|:\"<>?" diff --git a/bootcommand/gen.go b/bootcommand/gen.go index f4e3fa964..b811f98ce 100644 --- a/bootcommand/gen.go +++ b/bootcommand/gen.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate pigeon -o boot_command.go boot_command.pigeon package bootcommand diff --git a/bootcommand/pc_xt_driver.go b/bootcommand/pc_xt_driver.go index f39b02e89..cf2c7cab0 100644 --- a/bootcommand/pc_xt_driver.go +++ b/bootcommand/pc_xt_driver.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( diff --git a/bootcommand/pc_xt_driver_test.go b/bootcommand/pc_xt_driver_test.go index 95c469d27..68d668c5b 100644 --- a/bootcommand/pc_xt_driver_test.go +++ b/bootcommand/pc_xt_driver_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( diff --git a/bootcommand/usb_driver.go b/bootcommand/usb_driver.go index b81c47c90..5ebbb80ed 100644 --- a/bootcommand/usb_driver.go +++ b/bootcommand/usb_driver.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( diff --git a/bootcommand/usb_driver_test.go b/bootcommand/usb_driver_test.go index df370e6a3..a156d1e1b 100644 --- a/bootcommand/usb_driver_test.go +++ b/bootcommand/usb_driver_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( diff --git a/bootcommand/vnc_driver.go b/bootcommand/vnc_driver.go index 2c5bbf950..9dc7a15a7 100644 --- a/bootcommand/vnc_driver.go +++ b/bootcommand/vnc_driver.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( diff --git a/bootcommand/vnc_driver_test.go b/bootcommand/vnc_driver_test.go index e0e429472..64692424e 100644 --- a/bootcommand/vnc_driver_test.go +++ b/bootcommand/vnc_driver_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package bootcommand import ( @@ -23,12 +26,14 @@ func (s *sender) KeyEvent(u uint32, down bool) error { } func Test_vncSpecialLookup(t *testing.T) { - in := "" + in := "" expected := []event{ {0xFFE2, true}, {0xFFE2, false}, {0xFFE2, false}, {0xFFE2, true}, + {0xFF67, true}, + {0xFF67, false}, } s := &sender{} d := NewVNCDriver(s, time.Duration(0)) diff --git a/chroot/cleanup.go b/chroot/cleanup.go index d31d25ffd..60f2da4eb 100644 --- a/chroot/cleanup.go +++ b/chroot/cleanup.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( diff --git a/chroot/communicator.go b/chroot/communicator.go index 23a785249..9a1f867ee 100644 --- a/chroot/communicator.go +++ b/chroot/communicator.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( diff --git a/chroot/communicator_test.go b/chroot/communicator_test.go index dabff5024..d563d01ff 100644 --- a/chroot/communicator_test.go +++ b/chroot/communicator_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( @@ -7,8 +10,8 @@ import ( ) func TestCommunicator_ImplementsCommunicator(t *testing.T) { - var raw interface{} - raw = &Communicator{} + var raw interface{} = &Communicator{} + if _, ok := raw.(packersdk.Communicator); !ok { t.Fatalf("Communicator should be a communicator") } diff --git a/chroot/doc.go b/chroot/doc.go index 26e8259fb..9133b79f9 100644 --- a/chroot/doc.go +++ b/chroot/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package chroot provides convenience tooling specific to chroot builders. diff --git a/chroot/interpolate_context_provider.go b/chroot/interpolate_context_provider.go index 9aab670b5..37ddec00d 100644 --- a/chroot/interpolate_context_provider.go +++ b/chroot/interpolate_context_provider.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import "github.com/hashicorp/packer-plugin-sdk/template/interpolate" diff --git a/chroot/run_local_commands.go b/chroot/run_local_commands.go index 946ecda8e..6e597dc01 100644 --- a/chroot/run_local_commands.go +++ b/chroot/run_local_commands.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( diff --git a/chroot/step_chroot_provision.go b/chroot/step_chroot_provision.go index 4730619e6..af851b622 100644 --- a/chroot/step_chroot_provision.go +++ b/chroot/step_chroot_provision.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( diff --git a/chroot/step_copy_files.go b/chroot/step_copy_files.go index 869acb2bf..c3f612ecb 100644 --- a/chroot/step_copy_files.go +++ b/chroot/step_copy_files.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( @@ -16,8 +19,9 @@ import ( // StepCopyFiles copies some files from the host into the chroot environment. // // Produces: -// copy_files_cleanup CleanupFunc - A function to clean up the copied files -// early. +// +// copy_files_cleanup CleanupFunc - A function to clean up the copied files +// early. type StepCopyFiles struct { Files []string files []string diff --git a/chroot/step_copy_files_test.go b/chroot/step_copy_files_test.go index 9eccb6552..6a53c4539 100644 --- a/chroot/step_copy_files_test.go +++ b/chroot/step_copy_files_test.go @@ -1,9 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( "context" "fmt" - "io/ioutil" + "io" "path" "runtime" "strings" @@ -20,15 +23,14 @@ func testUI() (packersdk.Ui, func() string) { errorBuffer := &strings.Builder{} ui := &packersdk.BasicUi{ Reader: strings.NewReader(""), - Writer: ioutil.Discard, + Writer: io.Discard, ErrorWriter: errorBuffer, } return ui, errorBuffer.String } func TestCopyFilesCleanupFunc_ImplementsCleanupFunc(t *testing.T) { - var raw interface{} - raw = new(StepCopyFiles) + var raw interface{} = new(StepCopyFiles) if _, ok := raw.(Cleanup); !ok { t.Fatalf("cleanup func should be a CleanupFunc") } @@ -47,8 +49,7 @@ func TestCopyFiles_Run(t *testing.T) { var gotCommand string commandRunCount := 0 - var wrapper common.CommandWrapper - wrapper = func(ran string) (string, error) { + var wrapper common.CommandWrapper = func(ran string) (string, error) { gotCommand = ran commandRunCount++ return "", nil @@ -98,8 +99,7 @@ func TestCopyFiles_CopyNothing(t *testing.T) { } commandRunCount := 0 - var wrapper common.CommandWrapper - wrapper = func(ran string) (string, error) { + var wrapper common.CommandWrapper = func(ran string) (string, error) { commandRunCount++ return "", nil } diff --git a/chroot/step_early_cleanup.go b/chroot/step_early_cleanup.go index f91681a11..df686d36f 100644 --- a/chroot/step_early_cleanup.go +++ b/chroot/step_early_cleanup.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( diff --git a/chroot/step_mount_extra.go b/chroot/step_mount_extra.go index 843a385cc..a8207bcd0 100644 --- a/chroot/step_mount_extra.go +++ b/chroot/step_mount_extra.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( @@ -16,7 +19,8 @@ import ( // StepMountExtra mounts the attached device. // // Produces: -// mount_extra_cleanup CleanupFunc - To perform early cleanup +// +// mount_extra_cleanup CleanupFunc - To perform early cleanup type StepMountExtra struct { ChrootMounts [][]string mounts []string diff --git a/chroot/step_mount_extra_test.go b/chroot/step_mount_extra_test.go index d53cc7056..1d406be88 100644 --- a/chroot/step_mount_extra_test.go +++ b/chroot/step_mount_extra_test.go @@ -1,10 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import "testing" func TestMountExtraCleanupFunc_ImplementsCleanupFunc(t *testing.T) { - var raw interface{} - raw = new(StepMountExtra) + var raw interface{} = new(StepMountExtra) if _, ok := raw.(Cleanup); !ok { t.Fatalf("cleanup func should be a CleanupFunc") } diff --git a/chroot/step_post_mount_commands.go b/chroot/step_post_mount_commands.go index 803c61f20..1b7330067 100644 --- a/chroot/step_post_mount_commands.go +++ b/chroot/step_post_mount_commands.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( diff --git a/chroot/step_pre_mount_commands.go b/chroot/step_pre_mount_commands.go index 8434dd27f..19d61472f 100644 --- a/chroot/step_pre_mount_commands.go +++ b/chroot/step_pre_mount_commands.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package chroot import ( diff --git a/cmd/packer-sdc/README.md b/cmd/packer-sdc/README.md index 5140e950f..381bcd9b4 100644 --- a/cmd/packer-sdc/README.md +++ b/cmd/packer-sdc/README.md @@ -19,3 +19,4 @@ specific help commands: * `packer-sdc plugin-check -h` * `packer-sdc struct-markdown -h` * `packer-sdc renderdocs -h` +* `packer-sdc fix -h` diff --git a/cmd/packer-sdc/internal/cmd/utils.go b/cmd/packer-sdc/internal/cmd/utils.go index ba45dd80c..1e0a76811 100644 --- a/cmd/packer-sdc/internal/cmd/utils.go +++ b/cmd/packer-sdc/internal/cmd/utils.go @@ -1,7 +1,9 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package cmd import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -43,7 +45,7 @@ func (fc FileCheck) Verify(t *testing.T, dir string) { } } for file, expectedContent := range fc.ExpectedContent { - content, err := ioutil.ReadFile(filepath.Join(dir, file)) + content, err := os.ReadFile(filepath.Join(dir, file)) if err != nil { t.Fatalf("ioutil.ReadFile: %v", err) } diff --git a/cmd/packer-sdc/internal/fix/README.md b/cmd/packer-sdc/internal/fix/README.md new file mode 100644 index 000000000..a1ecb208e --- /dev/null +++ b/cmd/packer-sdc/internal/fix/README.md @@ -0,0 +1,16 @@ +## `packer-sdc fix` + +Fix rewrites parts of the plugin codebase to address known issues or common workarounds used within plugins consuming the Packer plugin SDK. + +Options: + + -diff If the -diff flag is set, no files are rewritten. Instead, fix prints the differences a rewrite would introduce. + +Available Fixes: + + gocty Adds a replace directive for github.com/zclconf/go-cty to github.com/nywilken/go-cty + + +### Related Issues +Use `packer-sdc fix` to resolve the [cty.Value does not implement gob.GobEncoder](https://github.com/hashicorp/packer-plugin-sdk/issues/187) + diff --git a/cmd/packer-sdc/internal/fix/cmd.go b/cmd/packer-sdc/internal/fix/cmd.go new file mode 100644 index 000000000..54fd3f529 --- /dev/null +++ b/cmd/packer-sdc/internal/fix/cmd.go @@ -0,0 +1,159 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package fix + +import ( + "bytes" + "errors" + "flag" + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/hashicorp/go-multierror" + "github.com/pkg/diff" +) + +const cmdPrefix string = "fix" + +// Command is the base entry for the fix sub-command. +type Command struct { + Dir string + Diff bool +} + +// Flags contain the default flags for the fix sub-command. +func (cmd *Command) Flags() *flag.FlagSet { + fs := flag.NewFlagSet(cmdPrefix, flag.ExitOnError) + fs.BoolVar(&cmd.Diff, "diff", false, "if set prints the differences a rewrite would introduce.") + return fs +} + +// Help displays usage for the command. +func (cmd *Command) Help() string { + var s strings.Builder + for _, fix := range availableFixes { + s.WriteString(fmt.Sprintf(" %s\t\t%s\n", fix.name, fix.description)) + } + + helpText := ` +Usage: packer-sdc fix [options] directory + + Fix rewrites parts of the plugin codebase to address known issues or + common workarounds used within plugins consuming the Packer plugin SDK. + +Options: + -diff If the -diff flag is set fix prints the differences an applied fix would introduce. + +Available fixes: +%s` + return fmt.Sprintf(helpText, s.String()) +} + +// Run executes the command +func (cmd *Command) Run(args []string) int { + if err := cmd.run(args); err != nil { + fmt.Printf("%v", err) + return 1 + } + return 0 +} + +func (cmd *Command) run(args []string) error { + f := cmd.Flags() + err := f.Parse(args) + if err != nil { + return errors.New("unable to parse flags for fix command") + } + + if f.NArg() != 1 { + err := fmt.Errorf("packer-sdc fix: missing directory argument\n%s", cmd.Help()) + return err + } + + dir := f.Arg(0) + if dir == "." || dir == "./..." { + dir, _ = os.Getwd() + } + + info, err := os.Stat(dir) + if err != nil && os.IsNotExist(err) { + return errors.New("a plugin root directory must be specified or a dot for the current directory") + } + + if !info.IsDir() { + return errors.New("a plugin root directory must be specified or a dot for the current directory") + } + + dir, err = filepath.Abs(dir) + if err != nil { + return errors.New("unable to determine the absolute path for the provided plugin root directory") + } + cmd.Dir = dir + + return processFiles(cmd.Dir, cmd.Diff) +} + +func (cmd *Command) Synopsis() string { + return "Rewrites parts of the plugin codebase to address known issues or common workarounds within plugins consuming the Packer plugin SDK." +} + +func processFiles(rootDir string, showDiff bool) error { + srcFiles := make(map[string][]byte) + fixedFiles := make(map[string][]byte) + + var cmdApplyErrs error + for _, f := range availableFixes { + matches, err := f.scan(rootDir) + if err != nil { + return fmt.Errorf("failed to apply %s fix: %s", f.name, err) + } + + //matches contains all files to apply the said fix on + for _, filename := range matches { + if _, ok := srcFiles[filename]; !ok { + bs, err := os.ReadFile(filename) + if err != nil { + cmdApplyErrs = multierror.Append(cmdApplyErrs, err) + } + srcFiles[filename] = append([]byte{}, bs...) + } + + fixedData, ok := fixedFiles[filename] + if !ok { + fixedData = append([]byte{}, srcFiles[filename]...) + } + + fixedData, err := f.fix(filename, fixedData) + if err != nil { + cmdApplyErrs = multierror.Append(cmdApplyErrs, err) + continue + } + if bytes.Equal(fixedData, srcFiles[filename]) { + continue + } + fixedFiles[filename] = fixedData + } + } + + if cmdApplyErrs != nil { + return cmdApplyErrs + } + + if showDiff { + for filename, fixedData := range fixedFiles { + diff.Text(filename, "Fixed: "+filename, string(srcFiles[filename]), string(fixedData), os.Stdout) + } + return nil + } + + for filename, fixedData := range fixedFiles { + fmt.Println(filename) + info, _ := os.Stat(filename) + os.WriteFile(filename, fixedData, info.Mode()) + } + + return nil +} diff --git a/cmd/packer-sdc/internal/fix/fix.go b/cmd/packer-sdc/internal/fix/fix.go new file mode 100644 index 000000000..c1dede85b --- /dev/null +++ b/cmd/packer-sdc/internal/fix/fix.go @@ -0,0 +1,27 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package fix + +// Fixer applies all defined fixes on a plugin dir; a Fixer should be idempotent. +// The caller of any fix is responsible for checking if the file context have changed. +type fixer interface { + fix(filename string, data []byte) ([]byte, error) +} + +type fix struct { + name, description string + scan func(dir string) ([]string, error) + fixer +} + +var ( + // availableFixes to apply to a plugin - refer to init func + availableFixes []fix +) + +func init() { + availableFixes = []fix{ + goctyFix, + } +} diff --git a/cmd/packer-sdc/internal/fix/gocty.go b/cmd/packer-sdc/internal/fix/gocty.go new file mode 100644 index 000000000..ebb243d0b --- /dev/null +++ b/cmd/packer-sdc/internal/fix/gocty.go @@ -0,0 +1,114 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package fix + +import ( + "fmt" + "os" + "path" + + "golang.org/x/mod/modfile" +) + +const ( + sdkPath string = "github.com/hashicorp/packer-plugin-sdk" + oldPath string = "github.com/zclconf/go-cty" + newPath string = "github.com/nywilken/go-cty" + newVersion string = "1.13.3" + modFilename string = "go.mod" +) + +var goctyFix = fix{ + name: "gocty", + description: "Adds a replace directive for github.com/zclconf/go-cty to github.com/nywilken/go-cty", + scan: modPaths, + fixer: goCtyFix{ + OldPath: oldPath, + NewPath: newPath, + NewVersion: newVersion, + }, +} + +// modPaths scans the incoming dir for potential go.mod files to fix. +func modPaths(dir string) ([]string, error) { + paths := []string{ + path.Join(dir, modFilename), + } + return paths, nil + +} + +type goCtyFix struct { + OldPath, NewPath, NewVersion string +} + +func (f goCtyFix) modFileFormattedVersion() string { + return fmt.Sprintf("v%s", f.NewVersion) +} + +// Fix applies a replace directive in a projects go.mod file for f.OldPath to f.NewPath. +// This fix applies to the replacement of github.com/zclconf/go-cty, as described in https://github.com/hashicorp/packer-plugin-sdk/issues/187 +// The return data contains the data file with the applied fix. In cases where the fix is already applied or not needed the original data is returned. +func (f goCtyFix) fix(modFilePath string, data []byte) ([]byte, error) { + if _, err := os.Stat(modFilePath); err != nil { + return nil, fmt.Errorf("failed to find go.mod file %s", modFilePath) + } + + mf, err := modfile.Parse(modFilePath, data, nil) + if err != nil { + return nil, fmt.Errorf("%s: failed to parse go.mod file: %v", modFilePath, err) + } + + // fix doesn't apply to go.mod with no module dependencies + if len(mf.Require) == 0 { + return data, nil + } + + var requiresSDK, requiresGoCty bool + for _, req := range mf.Require { + if req.Mod.Path == sdkPath || mf.Module.Mod.Path == sdkPath { + requiresSDK = true + } + if req.Mod.Path == f.OldPath { + requiresGoCty = true + } + + if requiresSDK && requiresGoCty { + break + } + } + + if !(requiresSDK && requiresGoCty) { + return data, nil + } + + for _, r := range mf.Replace { + if r.Old.Path != f.OldPath { + continue + } + + if r.New.Path != f.NewPath { + return nil, fmt.Errorf("%s: found unexpected replace for %s", modFilePath, r.Old.Path) + } + + if r.New.Version == f.modFileFormattedVersion() { + return data, nil + } + } + + if err := mf.DropReplace(f.OldPath, ""); err != nil { + return nil, fmt.Errorf("%s: failed to drop previously added replacement fix %v", modFilePath, err) + } + + commentSuffix := " // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187" + if err := mf.AddReplace(f.OldPath, "", f.NewPath, f.modFileFormattedVersion()+commentSuffix); err != nil { + return nil, fmt.Errorf("%s: failed to apply go-cty fix: %v", modFilePath, err) + } + + newData, err := mf.Format() + if err != nil { + return nil, err + } + return newData, nil +} diff --git a/cmd/packer-sdc/internal/fix/gocty_test.go b/cmd/packer-sdc/internal/fix/gocty_test.go new file mode 100644 index 000000000..5ec0c1cf1 --- /dev/null +++ b/cmd/packer-sdc/internal/fix/gocty_test.go @@ -0,0 +1,155 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package fix + +import ( + "os" + "path/filepath" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func copyToTempFile(t testing.TB, data []byte) string { + t.Helper() + dir := t.TempDir() + fn := filepath.Join(dir, "go.mod") + err := os.WriteFile(fn, data, os.ModePerm) + if err != nil { + t.Fatalf("Failed to create test mod file: %s", err) + } + return dir +} + +func goctyTestFixer() goCtyFix { + return goCtyFix{ + OldPath: oldPath, + NewPath: newPath, + NewVersion: newVersion, + } +} + +func TestFixGoCty_FixNotNeeded(t *testing.T) { + tt := []struct { + name string + fixtureDir string + }{ + { + name: "empty mod file", + fixtureDir: filepath.Join("testdata", "empty"), + }, + { + name: "no requires for go-cty or packer-plugin-sdk modules", + fixtureDir: filepath.Join("testdata", "missing-requires", "both"), + }, + { + name: "no go-cty module dependency", + fixtureDir: filepath.Join("testdata", "missing-requires", "go-cty"), + }, + { + name: "no packer-plugin-sdk module dependency", + fixtureDir: filepath.Join("testdata", "missing-requires", "packer-plugin-sdk"), + }, + { + name: "previously fixed mod file", + fixtureDir: filepath.Join("testdata", "fixed", "basic"), + }, + { + name: "fixed mod file with other replace directives", + fixtureDir: filepath.Join("testdata", "fixed", "many-replace"), + }, + } + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + testFixer := goctyTestFixer() + testFixtureDir := tc.fixtureDir + expectedFn := filepath.Join(testFixtureDir, modFilename) + expected, err := os.ReadFile(expectedFn) + if err != nil { + t.Fatalf("failed while reading text fixture: %s", err) + } + + outFileDir := copyToTempFile(t, expected) + outFileFn := filepath.Join(outFileDir, "go.mod") + fixed, err := testFixer.fix(outFileFn, expected) + if err != nil { + t.Fatalf("expected fix to not err but it did: %v", err) + } + + if diff := cmp.Diff(expected, fixed); diff != "" { + t.Errorf("expected no differences but got %q", diff) + } + + }) + } +} + +func TestFixGoCty_Unfixed(t *testing.T) { + tt := []struct { + name string + versionStr string + fixtureDir string + }{ + { + name: "basic unfixed mod file", + fixtureDir: filepath.Join("testdata", "unfixed", "basic"), + }, + { + name: "unfixed mod file with other replace directives", + fixtureDir: filepath.Join("testdata", "unfixed", "many-replace"), + }, + { + name: "out of date fix", + fixtureDir: filepath.Join("testdata", "unfixed", "version"), + }, + } + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + testFixer := goctyTestFixer() + if tc.versionStr != "" { + testFixer.NewVersion = tc.versionStr + } + testFixtureDir := tc.fixtureDir + unfixedFn := filepath.Join(testFixtureDir, "go.mod") + unfixed, err := os.ReadFile(unfixedFn) + if err != nil { + t.Fatalf("failed while reading text fixture: %s", err) + } + + outFileDir := copyToTempFile(t, unfixed) + outFileFn := filepath.Join(outFileDir, modFilename) + fixed, err := testFixer.fix(outFileFn, unfixed) + if err != nil { + t.Fatalf("expected fix to not err but it did: %v", err) + } + + expectedFn := filepath.Join(testFixtureDir, "fixed.go.mod") + expected, err := os.ReadFile(expectedFn) + if err != nil { + t.Fatalf("failed while reading text fixture: %s", err) + } + + if diff := cmp.Diff(expected, fixed); diff != "" { + t.Errorf("expected differences but got %q", diff) + } + + }) + } +} + +func TestFixGoCty_InvalidReplacePath(t *testing.T) { + testFixer := goctyTestFixer() + testFixtureDir := filepath.Join("testdata", "invalid") + expectedFn := filepath.Join(testFixtureDir, modFilename) + expected, err := os.ReadFile(expectedFn) + if err != nil { + t.Fatalf("failed while reading text fixture: %s", err) + } + + outFileDir := copyToTempFile(t, expected) + outFileFn := filepath.Join(outFileDir, modFilename) + if _, err := testFixer.fix(outFileFn, expected); err == nil { + t.Fatalf("expected fix to err but it didn't: %v", err) + } +} diff --git a/cmd/packer-sdc/internal/fix/testdata/empty/go.mod b/cmd/packer-sdc/internal/fix/testdata/empty/go.mod new file mode 100644 index 000000000..c364a0d1b --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/empty/go.mod @@ -0,0 +1,3 @@ +module github.com/hashicorp/example + +go 1.20 diff --git a/cmd/packer-sdc/internal/fix/testdata/fixed/basic/go.mod b/cmd/packer-sdc/internal/fix/testdata/fixed/basic/go.mod new file mode 100644 index 000000000..d88f7979e --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/fixed/basic/go.mod @@ -0,0 +1,11 @@ +module packer-plugin-scaffolding + +go 1.17 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 diff --git a/cmd/packer-sdc/internal/fix/testdata/fixed/many-replace/go.mod b/cmd/packer-sdc/internal/fix/testdata/fixed/many-replace/go.mod new file mode 100644 index 000000000..00dc509ec --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/fixed/many-replace/go.mod @@ -0,0 +1,13 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/hashicorp/packer-plugin-sdk => github.com/example/packer-plugin-sdk v0.5.0 + +replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187 diff --git a/cmd/packer-sdc/internal/fix/testdata/invalid/go.mod b/cmd/packer-sdc/internal/fix/testdata/invalid/go.mod new file mode 100644 index 000000000..bec402a4e --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/invalid/go.mod @@ -0,0 +1,11 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/zclconf/go-cty => github.com/random/go-cty v1.14.1 diff --git a/cmd/packer-sdc/internal/fix/testdata/missing-requires/both/go.mod b/cmd/packer-sdc/internal/fix/testdata/missing-requires/both/go.mod new file mode 100644 index 000000000..966657efd --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/missing-requires/both/go.mod @@ -0,0 +1,18 @@ +module example + +require ( + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d + github.com/google/go-cmp v0.3.0 + github.com/hashicorp/go-cleanhttp v0.5.0 + github.com/hashicorp/go-multierror v1.1.0 + github.com/hashicorp/go-safetemp v1.0.0 + github.com/hashicorp/go-version v1.1.0 + github.com/klauspost/compress v1.11.2 + github.com/mitchellh/go-homedir v1.0.0 + github.com/mitchellh/go-testing-interface v1.0.0 + github.com/ulikunitz/xz v0.5.8 +) + +require github.com/hashicorp/errwrap v1.0.0 // indirect + +go 1.18 diff --git a/cmd/packer-sdc/internal/fix/testdata/missing-requires/go-cty/go.mod b/cmd/packer-sdc/internal/fix/testdata/missing-requires/go-cty/go.mod new file mode 100644 index 000000000..ad38b4bd0 --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/missing-requires/go-cty/go.mod @@ -0,0 +1,19 @@ +module example + +require ( + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d + github.com/google/go-cmp v0.3.0 + github.com/hashicorp/go-cleanhttp v0.5.0 + github.com/hashicorp/go-multierror v1.1.0 + github.com/hashicorp/go-safetemp v1.0.0 + github.com/hashicorp/go-version v1.1.0 + github.com/hashicorp/packer-plugin-sdk v0.4.0 + github.com/klauspost/compress v1.11.2 + github.com/mitchellh/go-homedir v1.0.0 + github.com/mitchellh/go-testing-interface v1.0.0 + github.com/ulikunitz/xz v0.5.8 +) + +require github.com/hashicorp/errwrap v1.0.0 // indirect + +go 1.18 diff --git a/cmd/packer-sdc/internal/fix/testdata/missing-requires/packer-plugin-sdk/go.mod b/cmd/packer-sdc/internal/fix/testdata/missing-requires/packer-plugin-sdk/go.mod new file mode 100644 index 000000000..aace57136 --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/missing-requires/packer-plugin-sdk/go.mod @@ -0,0 +1,19 @@ +module example + +require ( + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d + github.com/google/go-cmp v0.3.0 + github.com/hashicorp/go-cleanhttp v0.5.0 + github.com/hashicorp/go-multierror v1.1.0 + github.com/hashicorp/go-safetemp v1.0.0 + github.com/hashicorp/go-version v1.1.0 + github.com/klauspost/compress v1.11.2 + github.com/mitchellh/go-homedir v1.0.0 + github.com/mitchellh/go-testing-interface v1.0.0 + github.com/ulikunitz/xz v0.5.8 + github.com/zclconf/go-cty v1.13.1 +) + +require github.com/hashicorp/errwrap v1.0.0 // indirect + +go 1.18 diff --git a/cmd/packer-sdc/internal/fix/testdata/unfixed/basic/fixed.go.mod b/cmd/packer-sdc/internal/fix/testdata/unfixed/basic/fixed.go.mod new file mode 100644 index 000000000..9554e74f6 --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/unfixed/basic/fixed.go.mod @@ -0,0 +1,11 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187 diff --git a/cmd/packer-sdc/internal/fix/testdata/unfixed/basic/go.mod b/cmd/packer-sdc/internal/fix/testdata/unfixed/basic/go.mod new file mode 100644 index 000000000..8a509b792 --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/unfixed/basic/go.mod @@ -0,0 +1,9 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) diff --git a/cmd/packer-sdc/internal/fix/testdata/unfixed/many-replace/fixed.go.mod b/cmd/packer-sdc/internal/fix/testdata/unfixed/many-replace/fixed.go.mod new file mode 100644 index 000000000..00dc509ec --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/unfixed/many-replace/fixed.go.mod @@ -0,0 +1,13 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/hashicorp/packer-plugin-sdk => github.com/example/packer-plugin-sdk v0.5.0 + +replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187 diff --git a/cmd/packer-sdc/internal/fix/testdata/unfixed/many-replace/go.mod b/cmd/packer-sdc/internal/fix/testdata/unfixed/many-replace/go.mod new file mode 100644 index 000000000..10c40e72a --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/unfixed/many-replace/go.mod @@ -0,0 +1,11 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/hashicorp/packer-plugin-sdk => github.com/example/packer-plugin-sdk v0.5.0 diff --git a/cmd/packer-sdc/internal/fix/testdata/unfixed/version/fixed.go.mod b/cmd/packer-sdc/internal/fix/testdata/unfixed/version/fixed.go.mod new file mode 100644 index 000000000..9554e74f6 --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/unfixed/version/fixed.go.mod @@ -0,0 +1,11 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.13.3 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187 diff --git a/cmd/packer-sdc/internal/fix/testdata/unfixed/version/go.mod b/cmd/packer-sdc/internal/fix/testdata/unfixed/version/go.mod new file mode 100644 index 000000000..da456395d --- /dev/null +++ b/cmd/packer-sdc/internal/fix/testdata/unfixed/version/go.mod @@ -0,0 +1,11 @@ +module packer-plugin-scaffolding + +go 1.20 + +require ( + github.com/hashicorp/hcl/v2 v2.13.0 + github.com/hashicorp/packer-plugin-sdk v0.3.1 + github.com/zclconf/go-cty v1.10.0 +) + +replace github.com/zclconf/go-cty => github.com/nywilken/go-cty v1.12.1 // added by packer-sdc fix as noted in github.com/hashicorp/packer-plugin-sdk/issues/187 diff --git a/cmd/packer-sdc/internal/fs/sync.go b/cmd/packer-sdc/internal/fs/sync.go index 18d00a124..daddc9fb3 100644 --- a/cmd/packer-sdc/internal/fs/sync.go +++ b/cmd/packer-sdc/internal/fs/sync.go @@ -1,9 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package fs import ( "bytes" "io" - "io/ioutil" "os" "path/filepath" "runtime" @@ -41,7 +43,7 @@ func SyncDir(src, dst string) error { return errors.Wrapf(err, "cannot mkdir %s", dst) } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return errors.Wrapf(err, "cannot read directory %s", dst) } @@ -64,7 +66,7 @@ func SyncDir(src, dst string) error { } // Remove files in dst that aren't in src - entries, err = ioutil.ReadDir(dst) + entries, err = os.ReadDir(dst) if err != nil { return errors.Wrapf(err, "cannot read directory %s", dst) } diff --git a/cmd/packer-sdc/internal/fs/sync_test.go b/cmd/packer-sdc/internal/fs/sync_test.go index 911978de8..d0eb30ea5 100644 --- a/cmd/packer-sdc/internal/fs/sync_test.go +++ b/cmd/packer-sdc/internal/fs/sync_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package fs import ( diff --git a/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2.go b/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2.go index 453642700..167f95d7b 100644 --- a/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2.go +++ b/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // mapstructure-to-hcl2 fills the gaps between hcl2 and mapstructure for Packer // // By generating a struct that the HCL2 ecosystem understands making use of @@ -8,13 +11,13 @@ // // Here are a few differences/gaps betweens hcl2 and mapstructure: // -// * in HCL2 all basic struct fields (string/int/struct) that are not pointers -// are required ( must be set ). In mapstructure everything is optional. +// - in HCL2 all basic struct fields (string/int/struct) that are not pointers +// are required ( must be set ). In mapstructure everything is optional. // -// * mapstructure allows to 'squash' fields -// (ex: Field CommonStructType `mapstructure:",squash"`) this allows to -// decorate structs and reuse configuration code. HCL2 parsing libs don't have -// anything similar. +// - mapstructure allows to 'squash' fields +// (ex: Field CommonStructType `mapstructure:",squash"`) this allows to +// decorate structs and reuse configuration code. HCL2 parsing libs don't have +// anything similar. // // mapstructure-to-hcl2 will parse Packer's config files and generate the HCL2 // compliant code that will allow to not change any of the current builders in @@ -137,14 +140,30 @@ func (cmd *Command) Run(args []string) int { if !utOk { continue } + pos := sort.SearchStrings(typeNames, id.Name) if pos >= len(typeNames) || typeNames[pos] != id.Name { continue // not a struct we care about } + // Sometimes we see the underlying struct for a similar named type, which results + // in an incorrect FlatMap. If the type names are not exactly the same skip. + if nt.Obj().Name() != id.Name { + continue // not the struct we are looking for + } // make sure each type is found once where somehow sometimes they can be found twice typeNames = append(typeNames[:pos], typeNames[pos+1:]...) - flatenedStruct := getMapstructureSquashedStruct(obj.Pkg(), utStruct) - flatenedStruct = addCtyTagToStruct(flatenedStruct) + flatenedStruct, err := getMapstructureSquashedStruct(obj.Pkg(), utStruct) + if err != nil { + log.Printf("%s.%s: %s", obj.Pkg().Name(), obj.Id(), err) + return 1 + } + + flatenedStruct, err = addCtyTagToStruct(flatenedStruct) + if err != nil { + log.Printf("%s.%s: %s", obj.Pkg().Name(), obj.Id(), err) + return 1 + } + newStructName := "Flat" + id.Name structs = append(structs, StructDef{ OriginalStructName: id.Name, @@ -419,7 +438,7 @@ func getUsedImports(s *types.Struct) map[NamePath]*types.Package { return res } -func addCtyTagToStruct(s *types.Struct) *types.Struct { +func addCtyTagToStruct(s *types.Struct) (*types.Struct, error) { vars, tags := structFields(s) for i := range tags { field, tag := vars[i], tags[i] @@ -434,10 +453,16 @@ func addCtyTagToStruct(s *types.Struct) *types.Struct { _ = st.Set(&structtag.Tag{Key: "hcl", Name: ctyAccessor}) tags[i] = st.String() } - return types.NewStruct(uniqueTags("cty", vars, tags)) + + vars, tags, err := uniqueTags("cty", vars, tags) + if err != nil { + return nil, fmt.Errorf("failed to add tag to struct: %s", err) + } + + return types.NewStruct(vars, tags), nil } -func uniqueTags(tagName string, fields []*types.Var, tags []string) ([]*types.Var, []string) { +func uniqueTags(tagName string, fields []*types.Var, tags []string) ([]*types.Var, []string, error) { outVars := []*types.Var{} outTags := []string{} uniqueTags := map[string]bool{} @@ -447,20 +472,19 @@ func uniqueTags(tagName string, fields []*types.Var, tags []string) ([]*types.Va h, err := structtag.Get(tagName) if err == nil { if uniqueTags[h.Name] { - log.Printf("skipping field %s ( duplicate `%s` %s tag )", field.Name(), h.Name, tagName) - continue + return nil, nil, fmt.Errorf("field %q: duplicate tag %q", field.Name(), tagName) } uniqueTags[h.Name] = true } outVars = append(outVars, field) outTags = append(outTags, tag) } - return outVars, outTags + return outVars, outTags, nil } // getMapstructureSquashedStruct will return the same struct but embedded // fields with a `mapstructure:",squash"` tag will be un-nested. -func getMapstructureSquashedStruct(topPkg *types.Package, utStruct *types.Struct) *types.Struct { +func getMapstructureSquashedStruct(topPkg *types.Package, utStruct *types.Struct) (*types.Struct, error) { res := &types.Struct{} for i := 0; i < utStruct.NumFields(); i++ { field, tag := utStruct.Field(i), utStruct.Tag(i) @@ -495,7 +519,16 @@ func getMapstructureSquashedStruct(topPkg *types.Package, utStruct *types.Struct continue } - res = squashStructs(res, getMapstructureSquashedStruct(topPkg, utStruct)) + sqStr, err := getMapstructureSquashedStruct(topPkg, utStruct) + if err != nil { + return nil, err + } + + res, err = squashStructs(res, sqStr) + if err != nil { + return nil, err + } + continue } } @@ -550,9 +583,12 @@ func getMapstructureSquashedStruct(topPkg *types.Package, utStruct *types.Struct // non optional fields should be non pointers. field = makePointer(field) } - res = addFieldToStruct(res, field, tag) + res, err = addFieldToStruct(res, field, tag) + if err != nil { + return nil, err + } } - return res + return res, nil } func flattenNamed(f *types.Named, underlying types.Type) *types.Named { @@ -565,32 +601,45 @@ func makePointer(field *types.Var) *types.Var { return types.NewField(field.Pos(), field.Pkg(), field.Name(), types.NewPointer(field.Type()), field.Embedded()) } -func addFieldToStruct(s *types.Struct, field *types.Var, tag string) *types.Struct { +func addFieldToStruct(s *types.Struct, field *types.Var, tag string) (*types.Struct, error) { sf, st := structFields(s) - return types.NewStruct(uniqueFields(append(sf, field), append(st, tag))) + + vars, tags, err := uniqueFields(append(sf, field), append(st, tag)) + if err != nil { + return nil, err + } + + str := types.NewStruct(vars, tags) + return str, nil } -func squashStructs(a, b *types.Struct) *types.Struct { +func squashStructs(a, b *types.Struct) (*types.Struct, error) { va, ta := structFields(a) vb, tb := structFields(b) - return types.NewStruct(uniqueFields(append(va, vb...), append(ta, tb...))) + + vars, tags, err := uniqueFields(append(va, vb...), append(ta, tb...)) + if err != nil { + return nil, fmt.Errorf("failed to squash struct: %s", err) + } + + str := types.NewStruct(vars, tags) + return str, nil } -func uniqueFields(fields []*types.Var, tags []string) ([]*types.Var, []string) { +func uniqueFields(fields []*types.Var, tags []string) ([]*types.Var, []string, error) { outVars := []*types.Var{} outTags := []string{} fieldNames := map[string]bool{} for i := range fields { field, tag := fields[i], tags[i] if fieldNames[field.Name()] { - log.Printf("skipping duplicate %s field", field.Name()) - continue + return nil, nil, fmt.Errorf("duplicate field %q", field.Name()) } fieldNames[field.Name()] = true outVars = append(outVars, field) outTags = append(outTags, tag) } - return outVars, outTags + return outVars, outTags, nil } func structFields(s *types.Struct) (vars []*types.Var, tags []string) { diff --git a/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2_test.go b/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2_test.go index 5e1a9cd35..6c72213ee 100644 --- a/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2_test.go +++ b/cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // mapstructure-to-hcl2 fills the gaps between hcl2 and mapstructure for Packer // // By generating a struct that the HCL2 ecosystem understands making use of @@ -8,13 +11,13 @@ // // Here are a few differences/gaps betweens hcl2 and mapstructure: // -// * in HCL2 all basic struct fields (string/int/struct) that are not pointers -// are required ( must be set ). In mapstructure everything is optional. +// - in HCL2 all basic struct fields (string/int/struct) that are not pointers +// are required ( must be set ). In mapstructure everything is optional. // -// * mapstructure allows to 'squash' fields -// (ex: Field CommonStructType `mapstructure:",squash"`) this allows to -// decorate structs and reuse configuration code. HCL2 parsing libs don't have -// anything similar. +// - mapstructure allows to 'squash' fields +// (ex: Field CommonStructType `mapstructure:",squash"`) this allows to +// decorate structs and reuse configuration code. HCL2 parsing libs don't have +// anything similar. // // mapstructure-to-hcl2 will parse Packer's config files and generate the HCL2 // compliant code that will allow to not change any of the current builders in @@ -42,6 +45,16 @@ func TestCommand_Run(t *testing.T) { Expected: []string{"../test-data/packer-plugin-happycloud/builder/happycloud/config.hcl2spec.go"}, }, }, + { + []string{"-type", "Config", "../test-data/field-conflict/test_mapstructure_field_conflict.go"}, + 1, + FileCheck{}, + }, + { + []string{"-type", "Config", "../test-data/tag-conflict/test_mapstructure_tag_conflict.go"}, + 1, + FileCheck{}, + }, } for _, tt := range tests { t.Run(fmt.Sprintf("%s", tt.args), func(t *testing.T) { diff --git a/cmd/packer-sdc/internal/plugincheck/cmd.go b/cmd/packer-sdc/internal/plugincheck/cmd.go index cfc0f93ea..a0d0183c2 100644 --- a/cmd/packer-sdc/internal/plugincheck/cmd.go +++ b/cmd/packer-sdc/internal/plugincheck/cmd.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package plugincheck import ( diff --git a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/bootcommand/BootConfig.mdx b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/bootcommand/BootConfig.mdx index efab62bb5..c6bb41f96 100644 --- a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/bootcommand/BootConfig.mdx +++ b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/bootcommand/BootConfig.mdx @@ -31,7 +31,7 @@ command, they will be replaced by the proper key: - ` ` - Simulates pressing the home and end keys. -- ` ` - Simulates pressing the page up and page down + - ` ` - Simulates pressing the page up and page down keys. - `` - Simulates pressing the Menu key. @@ -44,24 +44,24 @@ command, they will be replaced by the proper key: - ` ` - Simulates pressing the ⌘ or Windows key. -- ` ` - Adds a 1, 5 or 10 second pause before + - ` ` - Adds a 1, 5 or 10 second pause before sending any additional keys. This is useful if you have to generally wait for the UI to update before typing more. -- `` - Add an arbitrary pause before sending any additional keys. + - `` - Add an arbitrary pause before sending any additional keys. The format of `XX` is a sequence of positive decimal numbers, each with optional fraction and a unit suffix, such as `300ms`, `1.5h` or `2h45m`. Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. For example `` or ``. -- ` ` - Any printable keyboard character, and of these - "special" expressions, with the exception of the `` types, can - also be toggled on or off. For example, to simulate ctrl+c, use - `c`. Be sure to release them, otherwise they - will be held down until the machine reboots. To hold the `c` key down, - you would use ``. Likewise, `` to release. + - ` ` - Any printable keyboard character, and of these + "special" expressions, with the exception of the `` types, can + also be toggled on or off. For example, to simulate ctrl+c, use + `c`. Be sure to release them, otherwise they + will be held down until the machine reboots. To hold the `c` key down, + you would use ``. Likewise, `` to release. -- `{{ .HTTPIP }} {{ .HTTPPort }}` - The IP and port, respectively of an + - `{{ .HTTPIP }} {{ .HTTPPort }}` - The IP and port, respectively of an HTTP server that is started serving the directory specified by the `http_directory` configuration parameter. If `http_directory` isn't specified, these will be blank! @@ -75,18 +75,22 @@ In JSON: ```json "boot_command": [ - "", - " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" - ] + + "", + " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" + ] + ``` In HCL2: ```hcl boot_command = [ - "", - " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" - ] + + "", + " ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg" + ] + ``` The example shown below is a working boot command used to start an Ubuntu @@ -96,15 +100,17 @@ In JSON: ```json "boot_command": [ - "", - "/install/vmlinuz noapic ", - "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", - "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", - "hostname={{ .Name }} ", - "fb=false debconf/frontend=noninteractive ", - "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", - "keyboard-configuration/variant=USA console-setup/ask_detect=false ", - "initrd=/install/initrd.gz -- " + + "", + "/install/vmlinuz noapic ", + "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", + "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", + "hostname={{ .Name }} ", + "fb=false debconf/frontend=noninteractive ", + "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", + "keyboard-configuration/variant=USA console-setup/ask_detect=false ", + "initrd=/install/initrd.gz -- " + ] ``` @@ -112,19 +118,21 @@ In HCL2: ```hcl boot_command = [ - "", - "/install/vmlinuz noapic ", - "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", - "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", - "hostname={{ .Name }} ", - "fb=false debconf/frontend=noninteractive ", - "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", - "keyboard-configuration/variant=USA console-setup/ask_detect=false ", - "initrd=/install/initrd.gz -- " + + "", + "/install/vmlinuz noapic ", + "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", + "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", + "hostname={{ .Name }} ", + "fb=false debconf/frontend=noninteractive ", + "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", + "keyboard-configuration/variant=USA console-setup/ask_detect=false ", + "initrd=/install/initrd.gz -- " + ] ``` For more examples of various boot commands, see the sample projects from our -[community templates page](/community-tools#templates). +[community templates page](https://packer.io/community-tools#templates). diff --git a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSH-not-required.mdx b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSH-not-required.mdx index b1a8652f6..99706b6ae 100644 --- a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSH-not-required.mdx +++ b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSH-not-required.mdx @@ -9,7 +9,7 @@ - `ssh_password` (string) - A plaintext password to use to authenticate with SSH. -- `ssh_ciphers` ([]string) - This overrides the value of ciphers supported by default by golang. +- `ssh_ciphers` ([]string) - This overrides the value of ciphers supported by default by Golang. The default value is [ "aes128-gcm@openssh.com", "chacha20-poly1305@openssh.com", @@ -29,7 +29,7 @@ currently only works on guests with `sed` installed. - `ssh_key_exchange_algorithms` ([]string) - If set, Packer will override the value of key exchange (kex) algorithms - supported by default by golang. Acceptable values include: + supported by default by Golang. Acceptable values include: "curve25519-sha256@libssh.org", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group14-sha1", and "diffie-hellman-group1-sha1". @@ -74,6 +74,11 @@ - `ssh_file_transfer_method` (string) - `scp` or `sftp` - How to transfer files, Secure copy (default) or SSH File Transfer Protocol. + + **NOTE**: Guests using Windows with Win32-OpenSSH v9.1.0.0p1-Beta, scp + (the default protocol for copying data) returns a a non-zero error code since the MOTW + cannot be set, which cause any file transfer to fail. As a workaround you can override the transfer protocol + with SFTP instead `ssh_file_transfer_protocol = "sftp"`. - `ssh_proxy_host` (string) - A SOCKS proxy host to use for SSH connection diff --git a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSHTemporaryKeyPair-not-required.mdx b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSHTemporaryKeyPair-not-required.mdx index f0f5813ab..582d13870 100644 --- a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSHTemporaryKeyPair-not-required.mdx +++ b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/SSHTemporaryKeyPair-not-required.mdx @@ -4,6 +4,9 @@ Specifies the type of key to create. The possible values are 'dsa', 'ecdsa', 'ed25519', or 'rsa'. + + NOTE: DSA is deprecated and no longer recognized as secure, please + consider other alternatives like RSA or ED25519. - `temporary_key_pair_bits` (int) - Specifies the number of bits in the key to create. For RSA keys, the minimum size is 1024 bits and the default is 4096 bits. Generally, 3072 @@ -13,5 +16,8 @@ bits. Attempting to use bit lengths other than these three values for ECDSA keys will fail. Ed25519 keys have a fixed length and bits will be ignored. + + NOTE: DSA is deprecated and no longer recognized as secure as specified + by FIPS 186-5, please consider other alternatives like RSA or ED25519. diff --git a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/WinRM-not-required.mdx b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/WinRM-not-required.mdx index 5c3910d16..f6b5de07d 100644 --- a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/WinRM-not-required.mdx +++ b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/communicator/WinRM-not-required.mdx @@ -8,7 +8,7 @@ NOTE: If using an Amazon EBS builder, you can specify the interface WinRM connects to via - [`ssh_interface`](/docs/builders/amazon-ebs#ssh_interface) + [`ssh_interface`](/packer/plugins/builders/amazon/ebs#ssh_interface) - `winrm_no_proxy` (bool) - Setting this to `true` adds the remote `host:port` to the `NO_PROXY` environment variable. This has the effect of diff --git a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx index 0c653cc3d..b7c307c32 100644 --- a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx +++ b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/FloppyConfig.mdx @@ -7,6 +7,6 @@ this setting get placed into the root directory of the floppy and the floppy is attached as the first floppy device. The summary size of the listed files must not exceed 1.44 MB. The supported ways to move large files into the OS are using `http_directory` or [the file -provisioner](/docs/provisioners/file). +provisioner](/packer/docs/provisioners/file). diff --git a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx index b3cdfc96a..0e09e80ac 100644 --- a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx +++ b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx @@ -6,6 +6,8 @@ referenced will be available in your builder. Example usage from a builder: - `wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/foo/bar/preseed.cfg` +``` +wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/foo/bar/preseed.cfg +``` diff --git a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/ISOConfig.mdx b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/ISOConfig.mdx index 58293cd77..1c3b269df 100644 --- a/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/ISOConfig.mdx +++ b/cmd/packer-sdc/internal/renderdocs/docs-partials/packer-plugin-sdk/multistep/commonsteps/ISOConfig.mdx @@ -20,45 +20,61 @@ also possible to specify the checksum type. In JSON: ```json - "iso_checksum": "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2", - "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + "iso_checksum": "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2", + "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` ```json - "iso_checksum": "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum", - "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + "iso_checksum": "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum", + "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` ```json - "iso_checksum": "file://./shasums.txt", - "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + "iso_checksum": "file://./shasums.txt", + "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` ```json - "iso_checksum": "file:./shasums.txt", - "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + "iso_checksum": "file:./shasums.txt", + "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` In HCL2: ```hcl - iso_checksum = "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2" - iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + iso_checksum = "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2" + iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` ```hcl - iso_checksum = "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum" - iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + iso_checksum = "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum" + iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` ```hcl - iso_checksum = "file://./shasums.txt" - iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + iso_checksum = "file://./shasums.txt" + iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` ```hcl - iso_checksum = "file:./shasums.txt", - iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + + iso_checksum = "file:./shasums.txt", + iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" + ``` diff --git a/cmd/packer-sdc/internal/renderdocs/renderdocs.go b/cmd/packer-sdc/internal/renderdocs/renderdocs.go index e51b24d19..4d3710329 100644 --- a/cmd/packer-sdc/internal/renderdocs/renderdocs.go +++ b/cmd/packer-sdc/internal/renderdocs/renderdocs.go @@ -1,10 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package renderdocs import ( "bytes" "embed" "flag" - "io/ioutil" "log" "os" "path/filepath" @@ -64,7 +66,7 @@ func (cmd *Command) run(args []string) error { } func RenderDocsFolder(folder, partials string) error { - entries, err := ioutil.ReadDir(folder) + entries, err := os.ReadDir(folder) if err != nil { return errors.Wrapf(err, "cannot read directory %s", folder) } @@ -126,7 +128,9 @@ var partialFiles embed.FS // getPartial will first try to look for partials in the // renderdocs/docs-partials dir. This makes common/shared partials available to // all docs with for example: -// @include 'packer-plugin-sdk/communicator/Config.mdx' +// +// @include 'packer-plugin-sdk/communicator/Config.mdx' +// // Otherwise it tries to find a partial in/ the actual filesystem. func getPartial(partialsDir, partialPath string) ([]byte, error) { if partial, err := partialFiles.ReadFile(strings.Join([]string{"docs-partials", partialPath}, "/")); err == nil { diff --git a/cmd/packer-sdc/internal/renderdocs/renderdocs_test.go b/cmd/packer-sdc/internal/renderdocs/renderdocs_test.go index 795b4a6bc..60dd002df 100644 --- a/cmd/packer-sdc/internal/renderdocs/renderdocs_test.go +++ b/cmd/packer-sdc/internal/renderdocs/renderdocs_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package renderdocs import ( diff --git a/cmd/packer-sdc/internal/struct-markdown/struct_markdown.go b/cmd/packer-sdc/internal/struct-markdown/struct_markdown.go index c5fca3928..966078d65 100644 --- a/cmd/packer-sdc/internal/struct-markdown/struct_markdown.go +++ b/cmd/packer-sdc/internal/struct-markdown/struct_markdown.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package struct_markdown import ( @@ -5,7 +8,6 @@ import ( "go/ast" "go/parser" "go/token" - "io/ioutil" "log" "os" "path/filepath" @@ -45,7 +47,7 @@ func (cmd *Command) Run(args []string) int { for dir := filepath.Dir(absFilePath); len(dir) > 0 && projectRoot == ""; dir = filepath.Dir(dir) { base := filepath.Base(dir) - if base == "packer" { + if base == "packer" || base == "packer-internal" { projectRoot = dir filePath, _ = filepath.Rel(projectRoot, absFilePath) docsFolder = filepath.Join("website", "content", "partials") @@ -69,7 +71,7 @@ func (cmd *Command) Run(args []string) int { log.Fatal("Failed to guess project ROOT. If this is a Packer plugin project please make sure the root directory begins with`packer-plugin-*`") } - b, err := ioutil.ReadFile(fname) + b, err := os.ReadFile(fname) if err != nil { log.Fatalf("ReadFile: %+v", err) } diff --git a/cmd/packer-sdc/internal/struct-markdown/struct_markdown_test.go b/cmd/packer-sdc/internal/struct-markdown/struct_markdown_test.go index 7909c6008..00b651240 100644 --- a/cmd/packer-sdc/internal/struct-markdown/struct_markdown_test.go +++ b/cmd/packer-sdc/internal/struct-markdown/struct_markdown_test.go @@ -1,8 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package struct_markdown import ( "fmt" - "io/ioutil" + "os" "strings" "testing" @@ -39,7 +42,7 @@ func TestCommand_Run(t *testing.T) { } targetedPath := strings.TrimPrefix(tt.args[0], "../test-data/packer-plugin-happycloud/") for _, p := range tt.FileCheck.ExpectedFiles() { - raw, _ := ioutil.ReadFile(p) + raw, _ := os.ReadFile(p) content := string(raw) if !strings.Contains(content, targetedPath) { t.Errorf("%s must contain '%s'. Its content is:\n%s", p, targetedPath, content) diff --git a/cmd/packer-sdc/internal/struct-markdown/template.go b/cmd/packer-sdc/internal/struct-markdown/template.go index 40aaab1cd..58407a4cd 100644 --- a/cmd/packer-sdc/internal/struct-markdown/template.go +++ b/cmd/packer-sdc/internal/struct-markdown/template.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package struct_markdown import ( diff --git a/cmd/packer-sdc/internal/test-data/field-conflict/test_mapstructure_field_conflict.go b/cmd/packer-sdc/internal/test-data/field-conflict/test_mapstructure_field_conflict.go new file mode 100644 index 000000000..4a6a95588 --- /dev/null +++ b/cmd/packer-sdc/internal/test-data/field-conflict/test_mapstructure_field_conflict.go @@ -0,0 +1,17 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package test + +type NestedOne struct { + Arg int `mapstructure:"test"` +} + +type NestedTwo struct { + Arg int `mapstructure:"test"` +} + +type Config struct { + NestedOne `mapstructure:",squash"` + NestedTwo `mapstructure:",squash"` +} diff --git a/cmd/packer-sdc/internal/test-data/packer-plugin-happycloud/builder/happycloud/config.go b/cmd/packer-sdc/internal/test-data/packer-plugin-happycloud/builder/happycloud/config.go index e1ee091c2..66d9e6e43 100644 --- a/cmd/packer-sdc/internal/test-data/packer-plugin-happycloud/builder/happycloud/config.go +++ b/cmd/packer-sdc/internal/test-data/packer-plugin-happycloud/builder/happycloud/config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown //go:generate packer-sdc mapstructure-to-hcl2 -type Config,CustomerEncryptionKey diff --git a/cmd/packer-sdc/internal/test-data/tag-conflict/test_mapstructure_tag_conflict.go b/cmd/packer-sdc/internal/test-data/tag-conflict/test_mapstructure_tag_conflict.go new file mode 100644 index 000000000..172b5a829 --- /dev/null +++ b/cmd/packer-sdc/internal/test-data/tag-conflict/test_mapstructure_tag_conflict.go @@ -0,0 +1,17 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package test + +type NestedOne struct { + Arg int `mapstructure:"test"` +} + +type NestedTwo struct { + Args int `mapstructure:"test"` +} + +type Config struct { + NestedOne `mapstructure:",squash"` + NestedTwo `mapstructure:",squash"` +} diff --git a/cmd/packer-sdc/main.go b/cmd/packer-sdc/main.go index 266538470..5855a3b25 100644 --- a/cmd/packer-sdc/main.go +++ b/cmd/packer-sdc/main.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package main import ( @@ -5,6 +8,7 @@ import ( "log" "os" + "github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc/internal/fix" mapstructure_to_hcl2 "github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc/internal/mapstructure-to-hcl2" "github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc/internal/plugincheck" "github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc/internal/renderdocs" @@ -41,6 +45,9 @@ func main() { "plugin-check": func() (cli.Command, error) { return &plugincheck.Command{}, nil }, + "fix": func() (cli.Command, error) { + return &fix.Command{}, nil + }, } exitStatus, err := c.Run() diff --git a/common/command.go b/common/command.go index aa9d2d308..115995846 100644 --- a/common/command.go +++ b/common/command.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package common provides the PackerConfig structure that gets passed to every // plugin and contains information populated by the Packer core. This config // contains data about command line flags that were used, as well as template @@ -12,9 +15,11 @@ import ( // CommandWrapper is a type that given a command, will modify that // command in-flight. This might return an error. // For example, your command could be `foo` and your CommandWrapper could be -// func(s string) (string, error) { -// return fmt.Sprintf("/bin/sh/ %s", s) -// } +// +// func(s string) (string, error) { +// return fmt.Sprintf("/bin/sh/ %s", s) +// } +// // Using the CommandWrapper, you can set environment variables or perform // string interpolation once rather than many times, to save some lines of code // if similar wrapping needs to be performed many times during a plugin run. diff --git a/common/packer_config.go b/common/packer_config.go index 34c3091a9..c5fcd46f4 100644 --- a/common/packer_config.go +++ b/common/packer_config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package common const ( diff --git a/communicator/comm_host.go b/communicator/comm_host.go index a07b0b400..707876400 100644 --- a/communicator/comm_host.go +++ b/communicator/comm_host.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( diff --git a/communicator/config.go b/communicator/config.go index 92b20318c..16b3eb498 100644 --- a/communicator/config.go +++ b/communicator/config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown //go:generate packer-sdc mapstructure-to-hcl2 -type Config,SSH,WinRM,SSHTemporaryKeyPair @@ -6,7 +9,6 @@ package communicator import ( "errors" "fmt" - "io/ioutil" "net" "os" "time" @@ -84,7 +86,7 @@ type SSH struct { // a 36 character unique identifier. SSHTemporaryKeyPairName string `mapstructure:"temporary_key_pair_name" undocumented:"true"` SSHTemporaryKeyPair `mapstructure:",squash"` - // This overrides the value of ciphers supported by default by golang. + // This overrides the value of ciphers supported by default by Golang. // The default value is [ // "aes128-gcm@openssh.com", // "chacha20-poly1305@openssh.com", @@ -104,7 +106,7 @@ type SSH struct { // currently only works on guests with `sed` installed. SSHClearAuthorizedKeys bool `mapstructure:"ssh_clear_authorized_keys"` // If set, Packer will override the value of key exchange (kex) algorithms - // supported by default by golang. Acceptable values include: + // supported by default by Golang. Acceptable values include: // "curve25519-sha256@libssh.org", "ecdh-sha2-nistp256", // "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", // "diffie-hellman-group14-sha1", and "diffie-hellman-group1-sha1". @@ -162,6 +164,11 @@ type SSH struct { SSHBastionCertificateFile string `mapstructure:"ssh_bastion_certificate_file"` // `scp` or `sftp` - How to transfer files, Secure copy (default) or SSH // File Transfer Protocol. + // + // **NOTE**: Guests using Windows with Win32-OpenSSH v9.1.0.0p1-Beta, scp + // (the default protocol for copying data) returns a a non-zero error code since the MOTW + // cannot be set, which cause any file transfer to fail. As a workaround you can override the transfer protocol + // with SFTP instead `ssh_file_transfer_protocol = "sftp"`. SSHFileTransferMethod string `mapstructure:"ssh_file_transfer_method"` // A SOCKS proxy host to use for SSH connection SSHProxyHost string `mapstructure:"ssh_proxy_host"` @@ -199,6 +206,9 @@ type SSHTemporaryKeyPair struct { // // Specifies the type of key to create. The possible values are 'dsa', // 'ecdsa', 'ed25519', or 'rsa'. + // + // NOTE: DSA is deprecated and no longer recognized as secure, please + // consider other alternatives like RSA or ED25519. SSHTemporaryKeyPairType string `mapstructure:"temporary_key_pair_type"` // Specifies the number of bits in the key to create. For RSA keys, the // minimum size is 1024 bits and the default is 4096 bits. Generally, 3072 @@ -208,6 +218,9 @@ type SSHTemporaryKeyPair struct { // bits. Attempting to use bit lengths other than these three values for // ECDSA keys will fail. Ed25519 keys have a fixed length and bits will be // ignored. + // + // NOTE: DSA is deprecated and no longer recognized as secure as specified + // by FIPS 186-5, please consider other alternatives like RSA or ED25519. SSHTemporaryKeyPairBits int `mapstructure:"temporary_key_pair_bits"` } @@ -221,7 +234,7 @@ type WinRM struct { // // NOTE: If using an Amazon EBS builder, you can specify the interface // WinRM connects to via - // [`ssh_interface`](/docs/builders/amazon-ebs#ssh_interface) + // [`ssh_interface`](/packer/plugins/builders/amazon/ebs#ssh_interface) WinRMHost string `mapstructure:"winrm_host"` // Setting this to `true` adds the remote // `host:port` to the `NO_PROXY` environment variable. This has the effect of @@ -303,7 +316,7 @@ func (c *Config) ReadSSHPrivateKeyFile() ([]byte, error) { return []byte{}, fmt.Errorf("Error expanding path for SSH private key: %s", err) } - privateKey, err = ioutil.ReadFile(keyPath) + privateKey, err = os.ReadFile(keyPath) if err != nil { return privateKey, fmt.Errorf("Error on reading SSH private key: %s", err) } @@ -483,6 +496,16 @@ func (c *Config) prepareSSH(ctx *interpolate.Context) []error { c.SSHKeepAliveInterval = 5 * time.Second } + // Validation + var errs []error + if c.SSHPrivateKeyFile == "" && c.SSHCertificateFile != "" { + errs = append(errs, fmt.Errorf("ssh_private_key_file must be specified if ssh_certificate_file is specified")) + } + + if c.SSHBastionPrivateKeyFile == "" && c.SSHBastionCertificateFile != "" { + errs = append(errs, fmt.Errorf("ssh_bastion_private_key_file must be specified if ssh_bastion_certificate_file is specified")) + } + if c.SSHBastionHost != "" { if c.SSHBastionPort == 0 { c.SSHBastionPort = 22 @@ -490,12 +513,8 @@ func (c *Config) prepareSSH(ctx *interpolate.Context) []error { if c.SSHBastionPrivateKeyFile == "" && c.SSHPrivateKeyFile != "" { c.SSHBastionPrivateKeyFile = c.SSHPrivateKeyFile - } - - if c.SSHBastionCertificateFile == "" && c.SSHCertificateFile != "" { c.SSHBastionCertificateFile = c.SSHCertificateFile } - } if c.SSHProxyHost != "" { @@ -513,8 +532,6 @@ func (c *Config) prepareSSH(ctx *interpolate.Context) []error { c.SSHTimeout = c.SSHWaitTimeout } - // Validation - var errs []error if c.SSHUsername == "" { errs = append(errs, errors.New("An ssh_username must be specified\n Note: some builders used to default ssh_username to \"root\".")) } @@ -619,7 +636,7 @@ func (c *Config) prepareWinRM(ctx *interpolate.Context) (errs []error) { c.WinRMTimeout = 30 * time.Minute } - if c.WinRMUseNTLM == true { + if c.WinRMUseNTLM { c.WinRMTransportDecorator = func() winrm.Transporter { return &winrm.ClientNTLM{} } } diff --git a/communicator/config_test.go b/communicator/config_test.go index 0607f12d5..654515e14 100644 --- a/communicator/config_test.go +++ b/communicator/config_test.go @@ -1,12 +1,24 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "fmt" + "os" "reflect" "testing" + "time" + "github.com/google/go-cmp/cmp" "github.com/hashicorp/packer-plugin-sdk/multistep" "github.com/hashicorp/packer-plugin-sdk/template/interpolate" "github.com/masterzen/winrm" + "golang.org/x/crypto/ssh" ) func testConfig() *Config { @@ -139,28 +151,355 @@ func TestConfig_winrm_use_ntlm(t *testing.T) { } -func TestSSHBastion(t *testing.T) { - c := &Config{ - Type: "ssh", - SSH: SSH{ - SSHUsername: "root", - SSHBastionHost: "mybastionhost.company.com", - SSHBastionPassword: "test", - }, +// generateSSHPrivateKey generates a new RSA SSH private key for use in tests +// +// It returns the path in which the key was created. +// Removing the key after testing is the caller's responsibility. +func generateSSHPrivateKey() (path string, signer ssh.Signer, err error) { + pk, err := rsa.GenerateKey(rand.Reader, 4096) + if err != nil { + err = fmt.Errorf("failed to generate key: %s", err) + return } - if err := c.Prepare(testContext(t)); len(err) > 0 { - t.Fatalf("bad: %#v", err) + sshKeyFile, err := os.CreateTemp("", "") + if err != nil { + err = fmt.Errorf("failed to open a temp file: %s", err) + return } - if c.SSHBastionCertificateFile != "" { - t.Fatalf("Identity certificate somehow set") + defer sshKeyFile.Close() + + path = sshKeyFile.Name() + + rawPkey := x509.MarshalPKCS1PrivateKey(pk) + + err = pem.Encode(sshKeyFile, &pem.Block{ + Type: "RSA PRIVATE KEY", + Bytes: rawPkey, + }) + if err != nil { + err = fmt.Errorf("failed to encode to PEM: %s", err) + return + } + + signer, err = ssh.NewSignerFromKey(pk) + if err != nil { + err = fmt.Errorf("failed to create SSH signer: %s", err) + return + } + + return +} + +// generateSSHKeys generates a new SSH key, the CA key and a cert linked to the SSH key for use in tests +// +// It returns the paths in which the keys and cert were created. +// Removing the keys and certs after testing is the caller's responsibility. +func generateSSHKeys() ( + privKeyPath string, + certKeyPath string, + certPath string, + err error, +) { + var sshPrivKey, certSSHKey ssh.Signer + + privKeyPath, sshPrivKey, err = generateSSHPrivateKey() + if err != nil { + err = fmt.Errorf("failed to generate private key: %s", err) + return + } + + certKeyPath, certSSHKey, err = generateSSHPrivateKey() + if err != nil { + err = fmt.Errorf("failed to generate CA private key: %s", err) + return + } + + cert := &ssh.Certificate{ + CertType: ssh.HostCert, + Key: sshPrivKey.PublicKey(), + ValidAfter: 0, + ValidBefore: ssh.CertTimeInfinity, + KeyId: "TestSSHCert", + ValidPrincipals: []string{"authority.example.com"}, } - if c.SSHPrivateKeyFile != "" { - t.Fatalf("Private key file somehow set") + certFile, err := os.CreateTemp("", "") + if err != nil { + err = fmt.Errorf("failed to create cert file: %s", err) + return } + defer certFile.Close() + certPath = certFile.Name() + + err = cert.SignCert(rand.Reader, certSSHKey) + if err != nil { + err = fmt.Errorf("failed to sign cert: %s", err) + return + } + + rawCert := ssh.MarshalAuthorizedKey(cert) + + _, err = certFile.Write(rawCert) + if err != nil { + err = fmt.Errorf("failed to write marshalled certificate: %s", err) + } + + return +} + +func TestSSHBastion(t *testing.T) { + privKeyPath, certKeyPath, certPath, err := generateSSHKeys() + if err != nil { + t.Fatalf("failed to generate SSH keys and certificates: %s", err) + } + + defer func() { + os.Remove(privKeyPath) + os.Remove(certKeyPath) + os.Remove(certPath) + }() + + t.Logf("generated private key (%q), CA key (%q), certificate (%q)", privKeyPath, certKeyPath, certPath) + + bastionPrivKeyPath, bastionCertKeyPath, bastionCertPath, err := generateSSHKeys() + if err != nil { + t.Fatalf("failed to generate bastion SSH keys and certificates: %s", err) + } + + defer func() { + os.Remove(bastionPrivKeyPath) + os.Remove(bastionCertKeyPath) + os.Remove(bastionCertPath) + }() + + t.Logf("generated bastion private key (%q), CA key (%q), certificate (%q)", bastionPrivKeyPath, bastionCertKeyPath, bastionCertPath) + + testcases := []struct { + name string + config *Config + expectedConfig *Config + expectError bool + }{ + { + "OK - with host and password", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "mybastionhost.company.com", + SSHBastionPassword: "test", + }, + }, + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "mybastionhost.company.com", + SSHBastionPassword: "test", + SSHPort: 22, + SSHTimeout: time.Minute * 5, + SSHFileTransferMethod: "scp", + SSHKeepAliveInterval: time.Second * 5, + SSHHandshakeAttempts: 10, + SSHBastionPort: 22, + }, + }, + false, + }, + { + "OK - bastion config with bastion SSH private key", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: bastionPrivKeyPath, + }, + }, + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: bastionPrivKeyPath, + SSHPort: 22, + SSHTimeout: time.Minute * 5, + SSHFileTransferMethod: "scp", + SSHKeepAliveInterval: time.Second * 5, + SSHHandshakeAttempts: 10, + SSHBastionPort: 22, + }, + }, + false, + }, + { + "OK - bastion config with SSH private key, bastion key should be the same as SSH key", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHPrivateKeyFile: privKeyPath, + }, + }, + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: privKeyPath, + SSHPort: 22, + SSHTimeout: time.Minute * 5, + SSHFileTransferMethod: "scp", + SSHKeepAliveInterval: time.Second * 5, + SSHHandshakeAttempts: 10, + SSHBastionPort: 22, + SSHPrivateKeyFile: privKeyPath, + }, + }, + false, + }, + { + "OK - bastion config with SSH private key and cert, bastion should have both set", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHPrivateKeyFile: privKeyPath, + SSHCertificateFile: certPath, + }, + }, + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: privKeyPath, + SSHBastionCertificateFile: certPath, + SSHPort: 22, + SSHTimeout: time.Minute * 5, + SSHFileTransferMethod: "scp", + SSHKeepAliveInterval: time.Second * 5, + SSHHandshakeAttempts: 10, + SSHBastionPort: 22, + SSHPrivateKeyFile: privKeyPath, + SSHCertificateFile: certPath, + }, + }, + false, + }, + { + "OK - bastion config with SSH private key and cert, and a bastion private key, bastion cert should not be set", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: bastionPrivKeyPath, + SSHPrivateKeyFile: privKeyPath, + SSHCertificateFile: certPath, + }, + }, + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: bastionPrivKeyPath, + SSHPort: 22, + SSHTimeout: time.Minute * 5, + SSHFileTransferMethod: "scp", + SSHKeepAliveInterval: time.Second * 5, + SSHHandshakeAttempts: 10, + SSHBastionPort: 22, + SSHPrivateKeyFile: privKeyPath, + SSHCertificateFile: certPath, + }, + }, + false, + }, + { + "OK - bastion config with SSH private key and cert, and a bastion private key and cert", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: bastionPrivKeyPath, + SSHBastionCertificateFile: bastionCertPath, + SSHPrivateKeyFile: privKeyPath, + SSHCertificateFile: certPath, + }, + }, + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionHost: "my.bastion", + SSHBastionPrivateKeyFile: bastionPrivKeyPath, + SSHBastionCertificateFile: bastionCertPath, + SSHPort: 22, + SSHTimeout: time.Minute * 5, + SSHFileTransferMethod: "scp", + SSHKeepAliveInterval: time.Second * 5, + SSHHandshakeAttempts: 10, + SSHBastionPort: 22, + SSHPrivateKeyFile: privKeyPath, + SSHCertificateFile: certPath, + }, + }, + false, + }, + { + "Fail - ssh certificate file specified without an ssh private key file", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHCertificateFile: certPath, + }, + }, + nil, + true, + }, + { + "Fail - ssh bastion certificate file specified without an ssh bastion private key file", + &Config{ + Type: "ssh", + SSH: SSH{ + SSHUsername: "root", + SSHBastionCertificateFile: certPath, + }, + }, + nil, + true, + }, + } + + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + errs := tt.config.Prepare(testContext(t)) + + for _, err := range errs { + t.Logf("%s", err) + } + if (len(errs) != 0) != tt.expectError { + t.Fatalf("Expected %t error, got %d", tt.expectError, len(errs)) + } + if tt.expectError { + return + } + + diff := cmp.Diff(tt.config, tt.expectedConfig) + if diff != "" { + t.Errorf(diff) + } + }) + } } func TestSSHConfigFunc_ciphers(t *testing.T) { diff --git a/communicator/doc.go b/communicator/doc.go index e5990c9a6..fa91fe9f4 100644 --- a/communicator/doc.go +++ b/communicator/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package communicator provides common steps for connecting to an instance using the Packer communicator. These steps can be implemented by builders. diff --git a/communicator/ssh/key_pair.go b/communicator/ssh/key_pair.go index 0ca6b95ec..522a552d8 100644 --- a/communicator/ssh/key_pair.go +++ b/communicator/ssh/key_pair.go @@ -1,9 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( "bytes" "crypto" - "crypto/dsa" + "crypto/dsa" //nolint:all "crypto/ecdsa" "crypto/elliptic" "crypto/rand" @@ -57,10 +60,10 @@ type KeyPair struct { // KeyPairFromPrivateKey returns a KeyPair loaded from an existing private key. // // Supported key pair types include: -// - DSA -// - ECDSA -// - ED25519 -// - RSA +// - DSA (NOTE: deprecated from Go as DSA is not regarded as secure anymore, please consider RSA or ED25519 instead) +// - ECDSA +// - ED25519 +// - RSA func KeyPairFromPrivateKey(config FromPrivateKeyConfig) (KeyPair, error) { privateKey, err := gossh.ParseRawPrivateKey(config.RawPrivateKeyPemBlock) if err != nil { diff --git a/communicator/ssh/key_pair_test.go b/communicator/ssh/key_pair_test.go index 3c0e08ee6..c2fa3afb1 100644 --- a/communicator/ssh/key_pair_test.go +++ b/communicator/ssh/key_pair_test.go @@ -1,8 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( "bytes" - "crypto/dsa" + "crypto/dsa" //nolint:all "crypto/ecdsa" "crypto/rsa" "fmt" diff --git a/communicator/ssh/ssh.go b/communicator/ssh/ssh.go index 9c330bc27..66b972a2e 100644 --- a/communicator/ssh/ssh.go +++ b/communicator/ssh/ssh.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package SSH provides tooling for generating a temporary SSH keypair, and // provides tooling for connecting to an instance via a tunnel. package ssh @@ -5,7 +8,7 @@ package ssh import ( "encoding/pem" "fmt" - "io/ioutil" + "io" "os" "time" @@ -19,7 +22,7 @@ func parseKeyFile(path string) ([]byte, error) { } defer f.Close() - keyBytes, err := ioutil.ReadAll(f) + keyBytes, err := io.ReadAll(f) if err != nil { return nil, err } @@ -62,7 +65,7 @@ func ReadCertificate(certificatePath string, keySigner ssh.Signer) (ssh.Signer, } // Load the certificate - cert, err := ioutil.ReadFile(certificatePath) + cert, err := os.ReadFile(certificatePath) if err != nil { return nil, fmt.Errorf("unable to read certificate file: %v", err) } diff --git a/communicator/ssh/tunnel.go b/communicator/ssh/tunnel.go index 7e30f0ef5..efc4f78f8 100644 --- a/communicator/ssh/tunnel.go +++ b/communicator/ssh/tunnel.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( diff --git a/communicator/ssh/tunnel_test.go b/communicator/ssh/tunnel_test.go index 99f75fdfb..e89227668 100644 --- a/communicator/ssh/tunnel_test.go +++ b/communicator/ssh/tunnel_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( diff --git a/communicator/sshkey/algorithm_enumer.go b/communicator/sshkey/algorithm_enumer.go index 1a300735b..2d95b10a1 100644 --- a/communicator/sshkey/algorithm_enumer.go +++ b/communicator/sshkey/algorithm_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer -type Algorithm -transform snake"; DO NOT EDIT. -// package sshkey import ( diff --git a/communicator/sshkey/generate.go b/communicator/sshkey/generate.go index f6302015f..8b69f6d2d 100644 --- a/communicator/sshkey/generate.go +++ b/communicator/sshkey/generate.go @@ -1,7 +1,10 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package sshkey import ( - "crypto/dsa" + "crypto/dsa" //nolint:all "crypto/ecdsa" "crypto/ed25519" "crypto/elliptic" diff --git a/communicator/sshkey/generate_test.go b/communicator/sshkey/generate_test.go index 1de705a50..336efcbd4 100644 --- a/communicator/sshkey/generate_test.go +++ b/communicator/sshkey/generate_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package sshkey import ( diff --git a/communicator/sshkey/pubkey.go b/communicator/sshkey/pubkey.go index c80a5ca5f..c24b8dd47 100644 --- a/communicator/sshkey/pubkey.go +++ b/communicator/sshkey/pubkey.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package sshkey import ( diff --git a/communicator/sshkey/pubkey_test.go b/communicator/sshkey/pubkey_test.go index 1980602dd..9fac14710 100644 --- a/communicator/sshkey/pubkey_test.go +++ b/communicator/sshkey/pubkey_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package sshkey import ( diff --git a/communicator/step_connect.go b/communicator/step_connect.go index d28236f06..f53649414 100644 --- a/communicator/step_connect.go +++ b/communicator/step_connect.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( diff --git a/communicator/step_connect_ssh.go b/communicator/step_connect_ssh.go index fce6175f6..a1bb57515 100644 --- a/communicator/step_connect_ssh.go +++ b/communicator/step_connect_ssh.go @@ -1,9 +1,13 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( "context" "errors" "fmt" + "golang.org/x/term" "io" "log" "net" @@ -11,8 +15,6 @@ import ( "strings" "time" - "golang.org/x/crypto/ssh/terminal" - helperssh "github.com/hashicorp/packer-plugin-sdk/communicator/ssh" "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" @@ -258,7 +260,7 @@ func sshBastionConfig(config *Config) (*gossh.ClientConfig, error) { if config.SSHBastionInteractive { var c io.ReadWriteCloser - if terminal.IsTerminal(int(os.Stdin.Fd())) { + if term.IsTerminal(int(os.Stdin.Fd())) { c = os.Stdin } else { tty, err := os.Open("/dev/tty") diff --git a/communicator/step_connect_test.go b/communicator/step_connect_test.go index 5a62a7b86..48c54cf6f 100644 --- a/communicator/step_connect_test.go +++ b/communicator/step_connect_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( diff --git a/communicator/step_connect_winrm.go b/communicator/step_connect_winrm.go index 5545b4152..d7427b666 100644 --- a/communicator/step_connect_winrm.go +++ b/communicator/step_connect_winrm.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( @@ -25,10 +28,12 @@ import ( // configuration when creating the step. // // Uses: -// ui packersdk.Ui +// +// ui packersdk.Ui // // Produces: -// communicator packersdk.Communicator +// +// communicator packersdk.Communicator type StepConnectWinRM struct { // All the fields below are documented on StepConnect Config *Config diff --git a/communicator/step_debug_ssh_keys.go b/communicator/step_debug_ssh_keys.go index baf58a0cc..2e6826f11 100644 --- a/communicator/step_debug_ssh_keys.go +++ b/communicator/step_debug_ssh_keys.go @@ -1,9 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( "context" "fmt" - "io/ioutil" + "os" "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" @@ -21,7 +24,7 @@ func (s *StepDumpSSHKey) Run(_ context.Context, state multistep.StateBag) multis ui.Message(fmt.Sprintf("Saving key for debug purposes: %s", s.Path)) - err := ioutil.WriteFile(s.Path, s.SSH.SSHPrivateKey, 0700) + err := os.WriteFile(s.Path, s.SSH.SSHPrivateKey, 0700) if err != nil { state.Put("error", fmt.Errorf("Error saving debug key: %s", err)) return multistep.ActionHalt diff --git a/communicator/step_ssh_keygen.go b/communicator/step_ssh_keygen.go index 313b4c222..a277b2b13 100644 --- a/communicator/step_ssh_keygen.go +++ b/communicator/step_ssh_keygen.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( diff --git a/communicator/testing.go b/communicator/testing.go index d45a59c3d..d8abf0618 100644 --- a/communicator/testing.go +++ b/communicator/testing.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator import ( diff --git a/communicator/winrm.go b/communicator/winrm.go index afdf2569d..a722af596 100644 --- a/communicator/winrm.go +++ b/communicator/winrm.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package communicator // WinRMConfig is configuration that can be returned at runtime to diff --git a/didyoumean/name_suggestion.go b/didyoumean/name_suggestion.go index 333811fc4..7e6a79a35 100644 --- a/didyoumean/name_suggestion.go +++ b/didyoumean/name_suggestion.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package didyoumean import ( diff --git a/filelock/doc.go b/filelock/doc.go index 0a89b5030..6b93d0a88 100644 --- a/filelock/doc.go +++ b/filelock/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package filelock makes it easy to create and check file locks for concurrent processes. diff --git a/filelock/filelock.go b/filelock/filelock.go index 0949ded60..e3e6d8363 100644 --- a/filelock/filelock.go +++ b/filelock/filelock.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build !solaris -// +build !solaris package filelock diff --git a/filelock/filelock_solaris.go b/filelock/filelock_solaris.go index 06685254c..bc2a0af03 100644 --- a/filelock/filelock_solaris.go +++ b/filelock/filelock_solaris.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // build solaris package filelock diff --git a/filelock/noop.go b/filelock/noop.go index ebf8f1967..ba3333f2c 100644 --- a/filelock/noop.go +++ b/filelock/noop.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package filelock // this lock does nothing diff --git a/go.mod b/go.mod index 1a3aa3f6f..9f9a2c9d4 100644 --- a/go.mod +++ b/go.mod @@ -1,114 +1,128 @@ module github.com/hashicorp/packer-plugin-sdk +require github.com/zclconf/go-cty v1.13.3 // go-cty v1.11.0 removed gob encoding support so it cannot work with the Packer SDK as-is, you need to run `packer-sdc fix .' to change that + require ( - cloud.google.com/go v0.94.0 // indirect - cloud.google.com/go/storage v1.16.1 // indirect + cloud.google.com/go v0.110.8 // indirect + cloud.google.com/go/storage v1.35.1 // indirect github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/agext/levenshtein v1.2.3 github.com/antchfx/xpath v1.1.11 // indirect - github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 // indirect - github.com/armon/go-metrics v0.3.9 // indirect - github.com/aws/aws-sdk-go v1.40.34 + github.com/armon/go-metrics v0.4.1 // indirect + github.com/aws/aws-sdk-go v1.44.114 github.com/cenkalti/backoff/v3 v3.2.2 // indirect github.com/dylanmei/iso8601 v0.1.0 // indirect - github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 + github.com/dylanmei/winrmtest v0.0.0-20210303004826-fbc9ae56efb6 github.com/fatih/camelcase v1.0.0 - github.com/fatih/color v1.12.0 // indirect + github.com/fatih/color v1.14.1 // indirect github.com/fatih/structtag v1.2.0 github.com/gofrs/flock v0.8.1 github.com/gofrs/uuid v4.0.0+incompatible // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.6.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 - github.com/google/uuid v1.3.0 - github.com/hashicorp/consul/api v1.10.1 + github.com/google/uuid v1.4.0 + github.com/hashicorp/consul/api v1.25.1 github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter/gcs/v2 v2.1.0 - github.com/hashicorp/go-getter/s3/v2 v2.1.0 - github.com/hashicorp/go-getter/v2 v2.1.0 - github.com/hashicorp/go-hclog v0.16.2 // indirect + github.com/hashicorp/go-getter/gcs/v2 v2.2.2 + github.com/hashicorp/go-getter/s3/v2 v2.2.2 + github.com/hashicorp/go-getter/v2 v2.2.2 + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/go-msgpack v0.5.5 // indirect github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-retryablehttp v0.7.0 // indirect - github.com/hashicorp/go-version v1.3.0 + github.com/hashicorp/go-version v1.6.0 github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/hcl/v2 v2.13.0 - github.com/hashicorp/vault/api v1.1.1 - github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 + github.com/hashicorp/hcl/v2 v2.19.1 + github.com/hashicorp/vault/api v1.10.0 + github.com/hashicorp/yamux v0.1.1 github.com/imdario/mergo v0.3.12 // indirect github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect github.com/masterzen/winrm v0.0.0-20210623064412-3b76017826b0 - github.com/mattn/go-isatty v0.0.13 // indirect - github.com/mitchellh/cli v1.1.2 + github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mitchellh/cli v1.1.5 github.com/mitchellh/go-fs v0.0.0-20180402235330-b7b9ca407fff github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/iochan v1.0.0 - github.com/mitchellh/mapstructure v1.4.1 + github.com/mitchellh/mapstructure v1.5.0 github.com/mitchellh/reflectwalk v1.0.0 github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db - github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e github.com/pkg/errors v0.9.1 github.com/pkg/sftp v1.13.2 github.com/ryanuber/go-glob v1.0.0 - github.com/satori/go.uuid v1.2.0 // indirect - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.8.3 github.com/ugorji/go/codec v1.2.6 github.com/ulikunitz/xz v0.5.10 // indirect - github.com/zclconf/go-cty v1.10.0 - golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 + golang.org/x/crypto v0.21.0 golang.org/x/mobile v0.0.0-20210901025245-1fde1d6c3ca1 - golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect - golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect - golang.org/x/tools v0.1.10 - google.golang.org/api v0.56.0 // indirect - gopkg.in/square/go-jose.v2 v2.6.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + golang.org/x/mod v0.13.0 + golang.org/x/net v0.23.0 + golang.org/x/sync v0.5.0 + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.14.0 + google.golang.org/api v0.150.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) require ( - github.com/Masterminds/semver v1.5.0 // indirect - github.com/Masterminds/sprig v2.22.0+incompatible // indirect + cloud.google.com/go/compute v1.23.1 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v1.1.3 // indirect + github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/Masterminds/sprig/v3 v3.2.1 // indirect + github.com/antchfx/xmlquery v1.3.5 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect 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/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/googleapis/gax-go/v2 v2.1.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/go-jose/go-jose/v3 v3.0.3 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hashicorp/serf v0.9.5 // indirect - github.com/hashicorp/vault/sdk v0.2.1 // indirect + github.com/hashicorp/serf v0.10.1 // indirect github.com/huandu/xstrings v1.3.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/klauspost/compress v1.11.2 // indirect github.com/kr/fs v0.1.0 // indirect - github.com/mattn/go-colorable v0.1.8 // indirect + github.com/kr/pretty v0.2.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/posener/complete v1.2.3 // indirect - go.opencensus.io v0.23.0 // indirect - golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + github.com/shopspring/decimal v1.2.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + go.opencensus.io v0.24.0 // indirect + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect + golang.org/x/oauth2 v0.13.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 // indirect - google.golang.org/grpc v1.40.0 // indirect - google.golang.org/protobuf v1.27.1 // indirect + google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect ) -go 1.18 +go 1.20 + +retract v0.5.0 // v0.5.0 of the SDK was broken because of the replace statement for go-cty diff --git a/go.sum b/go.sum index 6c4ac2c37..3a87214db 100644 --- a/go.sum +++ b/go.sum @@ -1,52 +1,14 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.0 h1:QDB2MZHqjTt0hGKnoEWyG/iWykue/lvkLdogLgrg10U= -cloud.google.com/go v0.94.0/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.16.1 h1:sMEIc4wxvoY3NXG7Rn9iP7jb/2buJgWR1vNXCR/UPfs= -cloud.google.com/go/storage v1.16.1/go.mod h1:LaNorbty3ehnU3rEjXSNV/NRgQA0O8Y+uh6bPe5UOk4= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= +cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= +cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0= +cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/iam v1.1.3 h1:18tKG7DzydKWUnLjonWcJO6wjSCAtzh4GcRKlH/Hrzc= +cloud.google.com/go/iam v1.1.3/go.mod h1:3khUlaBXfPKKe7huYgEpDn6FtgRyMEqbkvBxrQyY5SE= +cloud.google.com/go/storage v1.35.1 h1:B59ahL//eDfx2IIKFBeT5Atm9wnNmj3+8xG/W4WB//w= +cloud.google.com/go/storage v1.35.1/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= @@ -56,44 +18,37 @@ github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nu github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 h1:w0E0fgc1YafGEh5cROhlROMWXiNoZqApk2PDN0M1+Ns= github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/sprig/v3 v3.2.1 h1:n6EPaDyLSvCEa3frruQvAiHuNp2dhBlMSmkEr+HuzGc= +github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/antchfx/xmlquery v1.3.5 h1:I7TuBRqsnfFuL11ruavGm911Awx9IqSdiU6W/ztSmVw= +github.com/antchfx/xmlquery v1.3.5/go.mod h1:64w0Xesg2sTaawIdNqMB+7qaW/bSqkQm+ssPaCMWNnc= +github.com/antchfx/xpath v1.1.10/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= github.com/antchfx/xpath v1.1.11 h1:WOFtK8TVAjLm3lbgqeP0arlHpvCEeTANeWZ/csPpJkQ= github.com/antchfx/xpath v1.1.11/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= -github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 h1:JaCC8jz0zdMLk2m+qCCVLLLM/PL93p84w4pK3aJWj60= -github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhiM5J5RFxEaFvMZVEAM1KvT1YzbEOwB2EAGjA= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.0/go.mod h1:zXjbSimjXTd7vOpY8B0/2LpvNvDoXBuplAD+gJD3GYs= -github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= -github.com/armon/go-metrics v0.3.9 h1:O2sNqxBdvq8Eq5xmzljcYzAORli6RWCvEym4cJf9m18= -github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= +github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.30.8/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/aws/aws-sdk-go v1.30.27/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/aws/aws-sdk-go v1.40.34 h1:SBYmodndE2d4AYucuuJnOXk4MD1SFbucoIdpwKVKeSA= -github.com/aws/aws-sdk-go v1.40.34/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go v1.44.114 h1:plIkWc/RsHr3DXBj4MEw9sEW4CcL/e2ryokc+CKyq1I= +github.com/aws/aws-sdk-go v1.44.114/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -101,181 +56,96 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1U github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= -github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= -github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.3.4/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200709052629-daa8e1ccc0bc/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= -github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= -github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= -github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v1.4.2-0.20200319182547-c7ad2b866182/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI= github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= -github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08 h1:0bp6/GrNOrTDtSXe9YYGCwf8jp5Fb/b+4a6MTRm4qzY= -github.com/dylanmei/winrmtest v0.0.0-20170819153634-c2fbb09e6c08/go.mod h1:VBVDFSBXCIW8JaHQpI8lldSKfYaLMzP9oyq6IJ4fhzY= +github.com/dylanmei/winrmtest v0.0.0-20210303004826-fbc9ae56efb6 h1:zWydSUQBJApHwpQ4guHi+mGyQN/8yN6xbKWdDtL3ZNM= +github.com/dylanmei/winrmtest v0.0.0-20210303004826-fbc9ae56efb6/go.mod h1:6BLLhzn1VEiJ4veuAGhINBTrBlV889Wd+aU4auxKOww= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= -github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/frankban/quicktest v1.10.0 h1:Gfh+GAJZOAoKZsIZeZbdn2JF10kN1XHNvjsvQK8gVkE= -github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k= +github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-ldap/ldap/v3 v3.1.3/go.mod h1:3rbOH3jRS2u6jg2rJnKAMLE/xQyCKIveG2Sa/Cohzb8= -github.com/go-ldap/ldap/v3 v3.1.10/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd8luAK4Q= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0 h1:6DWmvNpomjL1+3liNSZbVns3zsYzzCjm6pRBO1tLeso= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.10.1 h1:MwZJp86nlnL+6+W1Zly4JUuVn9YHhMggBirMpHGD7kw= -github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/sdk v0.8.0 h1:OJtKBtEjboEZvG6AOUdh4Z1Zbyu0WcxQ0qatRrZHTVU= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/hashicorp/consul/api v1.25.1 h1:CqrdhYzc8XZuPnhIYZWH45toM0LB9ZeYr/gvpLVI3PE= +github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g= +github.com/hashicorp/consul/sdk v0.14.1 h1:ZiwE2bKb+zro68sWzZ1SgHF3kRMBZ94TwOCFRF4ylPs= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -283,103 +153,79 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter/gcs/v2 v2.1.0 h1:1S1hvWgHrhUihP/Y4FVbjCWwE7EwxpksKoRcC7g+Hgs= -github.com/hashicorp/go-getter/gcs/v2 v2.1.0/go.mod h1:dVyTnX1BynHAjbumB4Pk14GoJ+v3VbDUJtbI7G0oOlU= -github.com/hashicorp/go-getter/s3/v2 v2.1.0 h1:8uwuP97zEQ7y7H4bLzRqiN4T8vmpXeJthigqSEjX+08= -github.com/hashicorp/go-getter/s3/v2 v2.1.0/go.mod h1:rwzJPQaBuc5riYOucPx84DOE74xIhKENOWgBjK3XVEs= -github.com/hashicorp/go-getter/v2 v2.1.0 h1:MsLbi7yFKGFPVmpK+un4/k5HFry0tqvo9JppsCmIutU= -github.com/hashicorp/go-getter/v2 v2.1.0/go.mod h1:w65fE5glbccYjndAuj1kA5lnVBGZYEaH0e5qA1kpIks= -github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= +github.com/hashicorp/go-getter/gcs/v2 v2.2.2 h1:KDbsz44Clh+qpsskK9EnlhWki8NMH18jlAjEseJXIco= +github.com/hashicorp/go-getter/gcs/v2 v2.2.2/go.mod h1:reRiCTBtE1ANT92nMmjwbDzoB6KMJ5azAoMOvQRGGH0= +github.com/hashicorp/go-getter/s3/v2 v2.2.2 h1:ProI1SMBNRt17gC3I8XCMdh35sXN68IUieYnWXwfwew= +github.com/hashicorp/go-getter/s3/v2 v2.2.2/go.mod h1:5MRjeGjI4DqzkRYa+g6OuNJDR0MamdE5VqDPdI42+vQ= +github.com/hashicorp/go-getter/v2 v2.2.2 h1:Al5bzCNW5DrlZMK6TumGrSue7Xz8beyLcen+4N4erwo= +github.com/hashicorp/go-getter/v2 v2.2.2/go.mod h1:hp5Yy0GMQvwWVUmwLs3ygivz1JSLI323hdIE9J9m7TY= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.16.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs= -github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-kms-wrapping/entropy v0.1.0/go.mod h1:d1g9WGtAunDNpek8jUIEJnBlbgKS1N2Q61QkHiZyR1g= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI= -github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-retryablehttp v0.6.2/go.mod h1:gEx6HMUGxYYhJScX7W1Il64m6cc2C1mDaW3NQ9sY1FY= -github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= -github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc= -github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= +github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI= +github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/vault/api v1.0.5-0.20200519221902-385fac77e20f/go.mod h1:euTFbi2YJgwcju3imEt919lhJKF68nN1cQPq3aA+kBE= -github.com/hashicorp/vault/api v1.1.1 h1:907ld+Z9cALyvbZK2qUX9cLwvSaEQsMVQB3x2KE8+AI= -github.com/hashicorp/vault/api v1.1.1/go.mod h1:29UXcn/1cLOPHQNMWA7bCz2By4PSd0VKPAydKXS5yN0= -github.com/hashicorp/vault/sdk v0.1.14-0.20200519221530-14615acda45f/go.mod h1:WX57W2PwkrOPQ6rVQk+dy5/htHIaB4aBM70EwKThu10= -github.com/hashicorp/vault/sdk v0.2.1 h1:S4O6Iv/dyKlE9AUTXGa7VOvZmsCvg36toPKgV4f2P4M= -github.com/hashicorp/vault/sdk v0.2.1/go.mod h1:WfUiO1vYzfBkz1TmoE4ZGU7HD0T0Cl/rZwaxjBkgN4U= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 h1:brI5vBRUlAlM34VFmnLPwjnCL/FxAJp9XvOdX6Zt+XE= -github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= +github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= +github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= +github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= +github.com/hashicorp/vault/api v1.10.0 h1:/US7sIjWN6Imp4o/Rj1Ce2Nr5bki/AXi9vAW3p2tOJQ= +github.com/hashicorp/vault/api v1.10.0/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.11.2 h1:MiK62aErc3gIiVEtyzKfeOHgW7atJb5g/KNX5m3c2nQ= +github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -390,7 +236,6 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 h1:2ZKn+w/BJeL43sCxI2jhPLRv73oVVOjEKZjKkflyqxg= github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= @@ -399,32 +244,32 @@ github.com/masterzen/winrm v0.0.0-20210623064412-3b76017826b0/go.mod h1:l31LCh9V github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= -github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/cli v1.1.2 h1:PvH+lL2B7IQ101xQL63Of8yFS2y+aDlsFcsqNc+u/Kw= -github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4= +github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng= +github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4= github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-fs v0.0.0-20180402235330-b7b9ca407fff h1:bFJ74ac7ZK/jyislqiWdzrnENesFt43sNEBRh1xk/+g= github.com/mitchellh/go-fs v0.0.0-20180402235330-b7b9ca407fff/go.mod h1:g7SZj7ABpStq3tM4zqHiVEG5un/DZ1+qJJKO7qx1EvU= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= @@ -433,524 +278,251 @@ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTS github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db h1:9uViuKtx1jrlXLBW/pMnhOfzn3iSEdLase/But/IZRU= github.com/packer-community/winrmcp v0.0.0-20180921211025-c76d91c1e7db/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= -github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.2 h1:taJnKntsWgU+qae21Rx52lIwndAdKrj0mfUNQsz1z4Q= github.com/pkg/sftp v1.13.2/go.mod h1:LzqnAvaD5TWeNBsZpfKxSYn1MbjWwOsCIAFFJbpIsK8= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ= github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= -github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0= -github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zclconf/go-cty v1.13.3 h1:m+b9q3YDbg6Bec5rr+KGy1MzEVzY/jC2X+YX4yqKtHI= +github.com/zclconf/go-cty v1.13.3/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= +github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 h1:O8uGbHCqlTp2P6QJSLmCojM4mN6UemYv8K+dCnmHmu0= -golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mobile v0.0.0-20210901025245-1fde1d6c3ca1 h1:t3ZHqovedSY8DEAUmZA99fPJhUhOb176PLACYA1sJ8Y= golang.org/x/mobile v0.0.0-20210901025245-1fde1d6c3ca1/go.mod h1:jFTmtFYCV0MFtXBU+J5V/+5AUeVS0ON/0WkE/KSrl6E= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVVPuBm92jqujBKMHMOlOQEw= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= -golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.21.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.56.0 h1:08F9XVYTLOGeSQb3xI9C0gXMuQanhdGed0cWFhDozbI= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/api v0.150.0 h1:Z9k22qD289SZ8gCJrk4DrWXkNjtfvKAUo/l1ma8eBYE= +google.golang.org/api v0.150.0/go.mod h1:ccy+MJ6nrYFgE3WgRx/AMXOxOmU8Q4hSa+jjibzhxcg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210825212027-de86158e7fda/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 h1:NHN4wOCScVzKhPenJ2dt+BTs3X/XkBVI/Rh4iDt55T8= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b h1:+YaDE2r2OG8t/z5qmsh7Y+XXwCbvadxxZ0YY6mTdrVA= +google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b h1:CIC2YMXmIhYw6evmhPxBKJ4fmLbOFtXQN/GV3XOZR8k= +google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -959,46 +531,25 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= -gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/guestexec/doc.go b/guestexec/doc.go index fb9e6e8c4..d63e4fca2 100644 --- a/guestexec/doc.go +++ b/guestexec/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package guestexec provides a shim for running common operating system commands on the guest/remote instance that is being provisioned. It helps provisioners diff --git a/guestexec/elevated.go b/guestexec/elevated.go index 1a03a64b2..94d987fe6 100644 --- a/guestexec/elevated.go +++ b/guestexec/elevated.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package guestexec import ( diff --git a/guestexec/elevated_test.go b/guestexec/elevated_test.go index b81d0c55f..930034942 100644 --- a/guestexec/elevated_test.go +++ b/guestexec/elevated_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package guestexec import ( diff --git a/guestexec/guest_commands.go b/guestexec/guest_commands.go index 549ba3ccb..dfc315747 100644 --- a/guestexec/guest_commands.go +++ b/guestexec/guest_commands.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package guestexec import ( diff --git a/guestexec/guest_commands_test.go b/guestexec/guest_commands_test.go index d6300c8e3..b29eec06b 100644 --- a/guestexec/guest_commands_test.go +++ b/guestexec/guest_commands_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package guestexec import ( diff --git a/hcl2helper/doc.go b/hcl2helper/doc.go index d213fe8da..b12083941 100644 --- a/hcl2helper/doc.go +++ b/hcl2helper/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package hcl2helper provides helper functions for parsing or getting hcl2 types to and from a Packer plugin config. */ diff --git a/hcl2helper/mock.go b/hcl2helper/mock.go index e2017c25b..5e2e49e0e 100644 --- a/hcl2helper/mock.go +++ b/hcl2helper/mock.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc mapstructure-to-hcl2 -type MockConfig,NestedMockConfig,MockTag package hcl2helper diff --git a/hcl2helper/values.go b/hcl2helper/values.go index 882fc3988..e296264fc 100644 --- a/hcl2helper/values.go +++ b/hcl2helper/values.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package hcl2helper import ( @@ -74,6 +77,26 @@ func HCL2ValueFromConfig(conf interface{}, configSpec map[string]hcldec.Spec) ct for k, v := range c { spec := configSpec[k] + // During testing, I hit this problem and this felt bad to debug + // as I was working on other parts of the code at the same time. + // + // In the end, this may happen when the generated flat configs and + // the structures returned by the plugin are not synchronised, which + // causes the object spec to be out-of-sync with the data expected. + // + // Rather than letting the hcl library panic on a nil pointer problem, + // we do it here, with suggestions for users on how to potentially + // fix the problem, without needing to delve into the behaviour of + // the SDK and the HCL libraries. + if spec == nil { + panic(`The converted value failed to have its spec inferred from it, and will panic later down the process. +This is likely due to an object spec being out of date in the plugin's code. +You may retry this configuration with an up-to-date plugin, or if this is the latest version, please report this, as it is likely a bug to be fixed. +If you are developing the plugin, please regenerate the HCL-related code with 'make generate', then rebuild the plugin with the up-to-date structures. + +If this doesn't fix your problem, this is likely a Packer bug, please consider opening an issue on the project so the team can look at it.`) + } + switch st := spec.(type) { case *hcldec.BlockListSpec: // This should be a slice of objects, so we need to take a special care diff --git a/hcl2helper/values_test.go b/hcl2helper/values_test.go index 35b613194..b5c4e3c8c 100644 --- a/hcl2helper/values_test.go +++ b/hcl2helper/values_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package hcl2helper import ( diff --git a/json/unmarshal.go b/json/unmarshal.go index cbb27f487..2958d909c 100644 --- a/json/unmarshal.go +++ b/json/unmarshal.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package json import ( diff --git a/multistep/basic_runner.go b/multistep/basic_runner.go index 308894042..733f0c1b6 100644 --- a/multistep/basic_runner.go +++ b/multistep/basic_runner.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep import ( diff --git a/multistep/basic_runner_test.go b/multistep/basic_runner_test.go index 51fbc54a9..ee36e44ff 100644 --- a/multistep/basic_runner_test.go +++ b/multistep/basic_runner_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep import ( @@ -7,8 +10,7 @@ import ( ) func TestBasicRunner_ImplRunner(t *testing.T) { - var raw interface{} - raw = &BasicRunner{} + var raw interface{} = &BasicRunner{} if _, ok := raw.(Runner); !ok { t.Fatalf("BasicRunner must be a Runner") } diff --git a/multistep/commonsteps/doc.go b/multistep/commonsteps/doc.go index d3f2717fe..aaaba8bd9 100644 --- a/multistep/commonsteps/doc.go +++ b/multistep/commonsteps/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* The commonsteps package contains the multistep runner that comprises the main architectural convention of Packer builder plugins. It enables builders diff --git a/multistep/commonsteps/extra_iso_config.go b/multistep/commonsteps/extra_iso_config.go index 649ef4321..9d5bb3dc9 100644 --- a/multistep/commonsteps/extra_iso_config.go +++ b/multistep/commonsteps/extra_iso_config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown package commonsteps diff --git a/multistep/commonsteps/extra_iso_config_test.go b/multistep/commonsteps/extra_iso_config_test.go index 70b87057f..c3d23a9b7 100644 --- a/multistep/commonsteps/extra_iso_config_test.go +++ b/multistep/commonsteps/extra_iso_config_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( diff --git a/multistep/commonsteps/floppy_config.go b/multistep/commonsteps/floppy_config.go index 2eb81de67..a80eb6bfc 100644 --- a/multistep/commonsteps/floppy_config.go +++ b/multistep/commonsteps/floppy_config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown package commonsteps @@ -18,7 +21,7 @@ import ( // is attached as the first floppy device. The summary size of the listed files // must not exceed 1.44 MB. The supported ways to move large files into the OS // are using `http_directory` or [the file -// provisioner](/docs/provisioners/file). +// provisioner](/packer/docs/provisioners/file). type FloppyConfig struct { // A list of files to place onto a floppy disk that is attached when the VM // is booted. Currently, no support exists for creating sub-directories on diff --git a/multistep/commonsteps/floppy_config_test.go b/multistep/commonsteps/floppy_config_test.go index 235652e24..dfa55cc48 100644 --- a/multistep/commonsteps/floppy_config_test.go +++ b/multistep/commonsteps/floppy_config_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( diff --git a/multistep/commonsteps/http_config.go b/multistep/commonsteps/http_config.go index d85d25780..c5577f370 100644 --- a/multistep/commonsteps/http_config.go +++ b/multistep/commonsteps/http_config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown package commonsteps @@ -14,7 +17,9 @@ import ( // // Example usage from a builder: // -// `wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/foo/bar/preseed.cfg` +// ``` +// wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/foo/bar/preseed.cfg +// ``` type HTTPConfig struct { // Path to a directory to serve using an HTTP server. The files in this // directory will be available over HTTP that will be requestable from the diff --git a/multistep/commonsteps/http_config_test.go b/multistep/commonsteps/http_config_test.go index add5c9304..29165b4d7 100644 --- a/multistep/commonsteps/http_config_test.go +++ b/multistep/commonsteps/http_config_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( diff --git a/multistep/commonsteps/iso_config.go b/multistep/commonsteps/iso_config.go index 1f2be7574..eb7ba112f 100644 --- a/multistep/commonsteps/iso_config.go +++ b/multistep/commonsteps/iso_config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown package commonsteps @@ -35,47 +38,62 @@ import ( // In JSON: // // ```json -// "iso_checksum": "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2", -// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// "iso_checksum": "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2", +// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// // ``` // // ```json -// "iso_checksum": "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum", -// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// "iso_checksum": "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum", +// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// // ``` // // ```json -// "iso_checksum": "file://./shasums.txt", -// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// "iso_checksum": "file://./shasums.txt", +// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// // ``` // // ```json -// "iso_checksum": "file:./shasums.txt", -// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// "iso_checksum": "file:./shasums.txt", +// "iso_url": "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// // ``` // // In HCL2: // // ```hcl -// iso_checksum = "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2" -// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// iso_checksum = "946a6077af6f5f95a51f82fdc44051c7aa19f9cfc5f737954845a6050543d7c2" +// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// // ``` // // ```hcl -// iso_checksum = "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum" -// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// iso_checksum = "file:ubuntu.org/..../ubuntu-14.04.1-server-amd64.iso.sum" +// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// // ``` // // ```hcl -// iso_checksum = "file://./shasums.txt" -// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// iso_checksum = "file://./shasums.txt" +// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// // ``` // // ```hcl -// iso_checksum = "file:./shasums.txt", -// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" -// ``` // +// iso_checksum = "file:./shasums.txt", +// iso_url = "ubuntu.org/.../ubuntu-14.04.1-server-amd64.iso" +// +// ``` type ISOConfig struct { // The checksum for the ISO file or virtual hard drive file. The type of // the checksum is specified within the checksum field as a prefix, ex: diff --git a/multistep/commonsteps/iso_config_test.go b/multistep/commonsteps/iso_config_test.go index 6cb674991..3dae752ed 100644 --- a/multistep/commonsteps/iso_config_test.go +++ b/multistep/commonsteps/iso_config_test.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build !windows -// +build !windows package commonsteps @@ -20,34 +22,6 @@ func testISOConfig() ISOConfig { } } -var cs_bsd_style = ` -MD5 (other.iso) = bAr -MD5 (the-OS.iso) = baZ -` - -var cs_bsd_style_subdir = ` -MD5 (other.iso) = bAr -MD5 (./subdir/the-OS.iso) = baZ -` - -var cs_gnu_style = ` -bAr0 *the-OS.iso -baZ0 other.iso -` - -var cs_gnu_style_subdir = ` -bAr0 *./subdir/the-OS.iso -baZ0 other.iso -` - -var cs_bsd_style_no_newline = ` -MD5 (other.iso) = bAr -MD5 (the-OS.iso) = baZ` - -var cs_gnu_style_no_newline = ` -bAr0 *the-OS.iso -baZ0 other.iso` - func TestISOConfigPrepare_ISOChecksum(t *testing.T) { i := testISOConfig() @@ -86,10 +60,8 @@ func TestISOConfigPrepare_ISOChecksumURLBad(t *testing.T) { } func TestISOConfigPrepare_ISOChecksumType(t *testing.T) { - i := testISOConfig() - // Test none - i = testISOConfig() + i := testISOConfig() i.ISOChecksum = "none" warns, err := i.Prepare(nil) if len(warns) == 0 { diff --git a/multistep/commonsteps/multistep_debug.go b/multistep/commonsteps/multistep_debug.go index a53071bb9..84e46bb5f 100644 --- a/multistep/commonsteps/multistep_debug.go +++ b/multistep/commonsteps/multistep_debug.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( diff --git a/multistep/commonsteps/multistep_runner.go b/multistep/commonsteps/multistep_runner.go index b4d823a8e..e47dd1f3e 100644 --- a/multistep/commonsteps/multistep_runner.go +++ b/multistep/commonsteps/multistep_runner.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( diff --git a/multistep/commonsteps/step_cleanup_temp_keys.go b/multistep/commonsteps/step_cleanup_temp_keys.go index ce643f3d1..7439b2a98 100644 --- a/multistep/commonsteps/step_cleanup_temp_keys.go +++ b/multistep/commonsteps/step_cleanup_temp_keys.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( diff --git a/multistep/commonsteps/step_create_cdrom.go b/multistep/commonsteps/step_create_cdrom.go index 4da3d3906..0396c3bb3 100644 --- a/multistep/commonsteps/step_create_cdrom.go +++ b/multistep/commonsteps/step_create_cdrom.go @@ -1,10 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( "context" "fmt" "io" - "io/ioutil" "log" "os" "os/exec" @@ -313,7 +315,7 @@ func (s *StepCreateCD) AddContent(dst, path, content string) error { if err != nil { return fmt.Errorf("error creating new directory %s: %s", dstDir, err) } - err = ioutil.WriteFile(dstPath, []byte(content), 0666) + err = os.WriteFile(dstPath, []byte(content), 0666) if err != nil { return fmt.Errorf("Error writing file %s on CD: %s", path, err) } diff --git a/multistep/commonsteps/step_create_cdrom_test.go b/multistep/commonsteps/step_create_cdrom_test.go index d384a5387..bae43facc 100644 --- a/multistep/commonsteps/step_create_cdrom_test.go +++ b/multistep/commonsteps/step_create_cdrom_test.go @@ -1,10 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( "bytes" "context" "io/fs" - "io/ioutil" "os" "path/filepath" "testing" @@ -14,8 +16,7 @@ import ( ) func TestStepCreateCD_Impl(t *testing.T) { - var raw interface{} - raw = new(StepCreateCD) + var raw interface{} = new(StepCreateCD) if _, ok := raw.(multistep.Step); !ok { t.Fatalf("StepCreateCD should be a step") } @@ -37,7 +38,7 @@ func createFiles(t *testing.T, rootFolder string, expected map[string]string) { if err != nil { t.Fatalf("mkdir -p: %s", err) } - err = ioutil.WriteFile(path, []byte(content), 0666) + err = os.WriteFile(path, []byte(content), 0666) if err != nil { t.Fatalf("writing file: %s", err) } @@ -58,7 +59,7 @@ func checkFiles(t *testing.T, rootFolder string, expected map[string]string) { t.Fatalf("unexpected file: %s", nameSlashSafe) } - content, err := ioutil.ReadFile(path) + content, err := os.ReadFile(path) if err != nil { t.Fatalf("reading file: %s", err) } @@ -86,7 +87,7 @@ func TestStepCreateCD(t *testing.T) { state := testStepCreateCDState(t) step := new(StepCreateCD) - dir, err := ioutil.TempDir("", "packer") + dir, err := os.MkdirTemp("", "packer") if err != nil { t.Fatalf("err: %s", err) } @@ -169,7 +170,7 @@ func TestStepCreateCD_missing(t *testing.T) { state := testStepCreateCDState(t) step := new(StepCreateCD) - dir, err := ioutil.TempDir("", "packer") + dir, err := os.MkdirTemp("", "packer") if err != nil { t.Fatalf("err: %s", err) } diff --git a/multistep/commonsteps/step_create_floppy.go b/multistep/commonsteps/step_create_floppy.go index 8097aaf7c..b066a9a2b 100644 --- a/multistep/commonsteps/step_create_floppy.go +++ b/multistep/commonsteps/step_create_floppy.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( @@ -136,8 +139,7 @@ func (s *StepCreateFloppy) Run(ctx context.Context, state multistep.StateBag) mu crawlDirectoryFiles = []string{} // Collect files and copy them flatly...because floppy_files is broken on purpose. - var filelist chan string - filelist = make(chan string) + var filelist = make(chan string) go globFiles(s.Files, filelist) ui.Message("Copying files flatly from floppy_files") @@ -196,9 +198,7 @@ func (s *StepCreateFloppy) Run(ctx context.Context, state multistep.StateBag) mu return multistep.ActionHalt } - for _, filename := range matches { - pathqueue = append(pathqueue, filename) - } + pathqueue = append(pathqueue, matches...) continue } pathqueue = append(pathqueue, filename) @@ -393,9 +393,7 @@ func removeBase(base string, path string) (string, error) { type directoryCache func(string) (fs.Directory, error) func fsDirectoryCache(rootDirectory fs.Directory) directoryCache { - var cache map[string]fs.Directory - - cache = make(map[string]fs.Directory) + var cache = make(map[string]fs.Directory) cache[""] = rootDirectory Input, Output, Error := make(chan string), make(chan fs.Directory), make(chan error) diff --git a/multistep/commonsteps/step_create_floppy_test.go b/multistep/commonsteps/step_create_floppy_test.go index 507c0c798..d67dd39e3 100644 --- a/multistep/commonsteps/step_create_floppy_test.go +++ b/multistep/commonsteps/step_create_floppy_test.go @@ -1,10 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( "bytes" "context" "fmt" - "io/ioutil" "log" "os" "path" @@ -19,8 +21,7 @@ import ( const TestFixtures = "test-fixtures" func TestStepCreateFloppy_Impl(t *testing.T) { - var raw interface{} - raw = new(StepCreateFloppy) + var raw interface{} = new(StepCreateFloppy) if _, ok := raw.(multistep.Step); !ok { t.Fatalf("StepCreateFloppy should be a step") } @@ -39,7 +40,7 @@ func TestStepCreateFloppy(t *testing.T) { state := testStepCreateFloppyState(t) step := new(StepCreateFloppy) - dir, err := ioutil.TempDir("", "packer") + dir, err := os.MkdirTemp("", "packer") if err != nil { t.Fatalf("err: %s", err) } @@ -102,7 +103,7 @@ func TestStepCreateFloppy_missing(t *testing.T) { state := testStepCreateFloppyState(t) step := new(StepCreateFloppy) - dir, err := ioutil.TempDir("", "packer") + dir, err := os.MkdirTemp("", "packer") if err != nil { t.Fatalf("err: %s", err) } @@ -147,7 +148,7 @@ func TestStepCreateFloppy_notfound(t *testing.T) { state := testStepCreateFloppyState(t) step := new(StepCreateFloppy) - dir, err := ioutil.TempDir("", "packer") + dir, err := os.MkdirTemp("", "packer") if err != nil { t.Fatalf("err: %s", err) } @@ -245,7 +246,7 @@ func TestStepCreateFloppyDirectories(t *testing.T) { for _, c := range test.dirs { step.Directories = append(step.Directories, filepath.Join(dir, filepath.FromSlash(c))) } - log.Println(fmt.Sprintf("Trying against floppy_dirs : %v", step.Directories)) + log.Printf("Trying against floppy_dirs : %v\n", step.Directories) // run the step if action := step.Run(context.Background(), state); action != multistep.ActionContinue { diff --git a/multistep/commonsteps/step_download.go b/multistep/commonsteps/step_download.go index a9c7cd561..8daa8ab40 100644 --- a/multistep/commonsteps/step_download.go +++ b/multistep/commonsteps/step_download.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( @@ -28,8 +31,9 @@ import ( // progress reporting, interrupt handling, etc. // // Uses: -// cache packer.Cache -// ui packersdk.Ui +// +// cache packer.Cache +// ui packersdk.Ui type StepDownload struct { // The checksum and the type of the checksum for the download Checksum string @@ -121,7 +125,7 @@ func (s *StepDownload) Run(ctx context.Context, state multistep.StateBag) multis // TODO(adrien): make go-getter allow using files in place. // ovf files usually point to a file in the same directory, so // using them in place is the only way. - ui.Say(fmt.Sprintf("Using ovf inplace")) + ui.Say("Using ovf inplace") dst = source } else { dst, err = s.download(ctx, ui, source) @@ -217,11 +221,16 @@ func (s *StepDownload) download(ctx context.Context, ui packersdk.Ui, source str } src := u.String() if u.Scheme == "" || strings.ToLower(u.Scheme) == "file" { - // If a local filepath, then we need to preprocess to make sure the - // path doens't have any multiple successive path separators; if it + // If a local filepath, then we need to pre-process to make sure the + // path doesn't have any multiple successive path separators; if it // does, go-getter will read this as a specialized go-getter-specific // subdirectory command, which it most likely isn't. src = filepath.Clean(u.String()) + // Starting with Go 1.21.0 filepath.Clean on Windows treats paths containing file: as invalid + // so they are prefixed with a dot (.) followed by the os.PathSeparator + if runtime.GOOS == "windows" && (src[0] == '.' && os.IsPathSeparator(src[1])) { + src = src[2:] + } if _, err := os.Stat(filepath.Clean(u.Path)); err != nil { // Cleaned path isn't present on system so it must be some other // scheme. Don't error right away; see if go-getter can figure it diff --git a/multistep/commonsteps/step_download_test.go b/multistep/commonsteps/step_download_test.go index 95cf02a4e..2534e4f63 100644 --- a/multistep/commonsteps/step_download_test.go +++ b/multistep/commonsteps/step_download_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( @@ -5,7 +8,6 @@ import ( "context" "crypto/sha1" "encoding/hex" - "io/ioutil" "log" "net/http" "net/http/httptest" @@ -323,7 +325,7 @@ func createTempDir(t *testing.T) string { } func listFiles(t *testing.T, dir string) []string { - fs, err := ioutil.ReadDir(dir) + fs, err := os.ReadDir(dir) if err != nil { log.Fatal(err) } diff --git a/multistep/commonsteps/step_http_server.go b/multistep/commonsteps/step_http_server.go index 3b4f7dc5b..43462aac6 100644 --- a/multistep/commonsteps/step_http_server.go +++ b/multistep/commonsteps/step_http_server.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( @@ -30,10 +33,12 @@ func HTTPServerFromHTTPConfig(cfg *HTTPConfig) *StepHTTPServer { // template. // // Uses: -// ui packersdk.Ui +// +// ui packersdk.Ui // // Produces: -// http_port int - The port the HTTP server started on. +// +// http_port int - The port the HTTP server started on. type StepHTTPServer struct { HTTPDir string HTTPContent map[string]string diff --git a/multistep/commonsteps/step_http_server_test.go b/multistep/commonsteps/step_http_server_test.go index 6634a0235..29e97ab5a 100644 --- a/multistep/commonsteps/step_http_server_test.go +++ b/multistep/commonsteps/step_http_server_test.go @@ -1,9 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( "context" "fmt" - "io/ioutil" + "io" "net/http" "reflect" "testing" @@ -70,7 +73,7 @@ func TestStepHTTPServer_Run(t *testing.T) { if err != nil { t.Fatalf("http.Get: %v", err) } - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { t.Fatalf("readall: %v", err) } diff --git a/multistep/commonsteps/step_output_dir.go b/multistep/commonsteps/step_output_dir.go index 94bc6fe1d..0b5d54dae 100644 --- a/multistep/commonsteps/step_output_dir.go +++ b/multistep/commonsteps/step_output_dir.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( diff --git a/multistep/commonsteps/step_output_dir_test.go b/multistep/commonsteps/step_output_dir_test.go index 5b723c5dd..9d9368661 100644 --- a/multistep/commonsteps/step_output_dir_test.go +++ b/multistep/commonsteps/step_output_dir_test.go @@ -1,9 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( "bytes" "context" - "io/ioutil" "os" "testing" @@ -22,7 +24,7 @@ func testState(t *testing.T) multistep.StateBag { } func testStepOutputDir(t *testing.T) *StepOutputDir { - td, err := ioutil.TempDir("", "packer") + td, err := os.MkdirTemp("", "packer") if err != nil { t.Fatalf("err: %s", err) } diff --git a/multistep/commonsteps/step_provision.go b/multistep/commonsteps/step_provision.go index 3b02dcea5..b132a80a1 100644 --- a/multistep/commonsteps/step_provision.go +++ b/multistep/commonsteps/step_provision.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( @@ -104,7 +107,7 @@ func (s *StepProvision) runWithHook(ctx context.Context, state multistep.StateBa if comm == nil { raw, ok := state.Get("communicator").(packersdk.Communicator) if ok { - comm = raw.(packersdk.Communicator) + comm = raw } } diff --git a/multistep/commonsteps/step_provision_test.go b/multistep/commonsteps/step_provision_test.go index 18a809041..f8984afa0 100644 --- a/multistep/commonsteps/step_provision_test.go +++ b/multistep/commonsteps/step_provision_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package commonsteps import ( @@ -26,8 +29,7 @@ func testCommConfig() *communicator.Config { } func TestStepProvision_Impl(t *testing.T) { - var raw interface{} - raw = new(StepProvision) + var raw interface{} = new(StepProvision) if _, ok := raw.(multistep.Step); !ok { t.Fatalf("provision should be a step") } diff --git a/multistep/debug_runner.go b/multistep/debug_runner.go index 48b509a7f..e61c263a0 100644 --- a/multistep/debug_runner.go +++ b/multistep/debug_runner.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep import ( diff --git a/multistep/debug_runner_test.go b/multistep/debug_runner_test.go index 5cd744139..7407e0fff 100644 --- a/multistep/debug_runner_test.go +++ b/multistep/debug_runner_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep import ( @@ -9,8 +12,7 @@ import ( ) func TestDebugRunner_Impl(t *testing.T) { - var raw interface{} - raw = &DebugRunner{} + var raw interface{} = &DebugRunner{} if _, ok := raw.(Runner); !ok { t.Fatal("DebugRunner must be a runner.") } diff --git a/multistep/doc.go b/multistep/doc.go index 002069fc9..c751d5129 100644 --- a/multistep/doc.go +++ b/multistep/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* multistep is a Go library for building up complex actions using discrete, individual "steps." These steps are strung together and run in sequence @@ -12,41 +15,44 @@ which is passed between steps by the runner. ```go type stepAdd struct{} -func (s *stepAdd) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { - // Read our value and assert that it is they type we want - value := state.Get("value").(int) - fmt.Printf("Value is %d\n", value) + func (s *stepAdd) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { + // Read our value and assert that it is they type we want + value := state.Get("value").(int) + fmt.Printf("Value is %d\n", value) + + // Store some state back + state.Put("value", value + 1) + return multistep.ActionContinue + } - // Store some state back - state.Put("value", value + 1) - return multistep.ActionContinue -} + func (s *stepAdd) Cleanup(multistep.StateBag) { + // This is called after all the steps have run or if the runner is + // cancelled so that cleanup can be performed. + } -func (s *stepAdd) Cleanup(multistep.StateBag) { - // This is called after all the steps have run or if the runner is - // cancelled so that cleanup can be performed. -} ``` Make a runner and call your array of Steps. ```go -func main() { - // Our "bag of state" that we read the value from - state := new(multistep.BasicStateBag) - state.Put("value", 0) - - steps := []multistep.Step{ - &stepAdd{}, - &stepAdd{}, - &stepAdd{}, - } - - runner := &multistep.BasicRunner{Steps: steps} - - // Executes the steps - runner.Run(context.Background(), state) -} + + func main() { + // Our "bag of state" that we read the value from + state := new(multistep.BasicStateBag) + state.Put("value", 0) + + steps := []multistep.Step{ + &stepAdd{}, + &stepAdd{}, + &stepAdd{}, + } + + runner := &multistep.BasicRunner{Steps: steps} + + // Executes the steps + runner.Run(context.Background(), state) + } + ``` This will produce: diff --git a/multistep/if.go b/multistep/if.go index f9705af62..b2d406afb 100644 --- a/multistep/if.go +++ b/multistep/if.go @@ -1,8 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep // if returns step only if on is true. func If(on bool, step Step) Step { - if on == false { + if !on { return &nullStep{} } return step diff --git a/multistep/multistep.go b/multistep/multistep.go index a3e427c0c..e7912b685 100644 --- a/multistep/multistep.go +++ b/multistep/multistep.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // multistep is a library for building up complex actions using individual, // discrete steps. package multistep diff --git a/multistep/multistep_test.go b/multistep/multistep_test.go index 592990184..360b5b809 100644 --- a/multistep/multistep_test.go +++ b/multistep/multistep_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep import "context" diff --git a/multistep/statebag.go b/multistep/statebag.go index 02a69871f..8bc4012b6 100644 --- a/multistep/statebag.go +++ b/multistep/statebag.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep import "sync" diff --git a/multistep/statebag_test.go b/multistep/statebag_test.go index 1793ee6e2..76eb1004e 100644 --- a/multistep/statebag_test.go +++ b/multistep/statebag_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package multistep import ( @@ -5,8 +8,7 @@ import ( ) func TestBasicStateBag_ImplRunner(t *testing.T) { - var raw interface{} - raw = &BasicStateBag{} + var raw interface{} = &BasicStateBag{} if _, ok := raw.(StateBag); !ok { t.Fatalf("must be a StateBag") } diff --git a/net/configure_port.go b/net/configure_port.go index 6cc3d3d6c..c0c4e981a 100644 --- a/net/configure_port.go +++ b/net/configure_port.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package net contains some helper wrapping functions for the http and net // golang libraries that meet Packer-specific needs. package net diff --git a/net/configure_port_test.go b/net/configure_port_test.go index 2d81afdc9..7aeac2738 100644 --- a/net/configure_port_test.go +++ b/net/configure_port_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package net import ( diff --git a/net/default_client.go b/net/default_client.go index ae9b30b29..a090f33ec 100644 --- a/net/default_client.go +++ b/net/default_client.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package net import ( diff --git a/packer/artifact.go b/packer/artifact.go index 8eaf3bcd5..2f897343a 100644 --- a/packer/artifact.go +++ b/packer/artifact.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer // An Artifact is the result of a build, and is the metadata that documents diff --git a/packer/artifact_mock.go b/packer/artifact_mock.go index 8f195c571..d914ae402 100644 --- a/packer/artifact_mock.go +++ b/packer/artifact_mock.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer // MockArtifact is an implementation of Artifact that can be used for tests. diff --git a/packer/artifact_test.go b/packer/artifact_test.go index 2bbb172a6..5b100712d 100644 --- a/packer/artifact_test.go +++ b/packer/artifact_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer type TestArtifact struct { diff --git a/packer/build.go b/packer/build.go index 7bfbb1420..15e8c977f 100644 --- a/packer/build.go +++ b/packer/build.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import "context" diff --git a/packer/builder.go b/packer/builder.go index 11bdc3046..0954ea13a 100644 --- a/packer/builder.go +++ b/packer/builder.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/builder_mock.go b/packer/builder_mock.go index f76ca6d44..f53141efa 100644 --- a/packer/builder_mock.go +++ b/packer/builder_mock.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc mapstructure-to-hcl2 -type MockBuilder package packer diff --git a/packer/cache.go b/packer/cache.go index 70f381b11..7b367e7b3 100644 --- a/packer/cache.go +++ b/packer/cache.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( @@ -12,18 +15,21 @@ import ( // // NOTE: cache directory will change depending on operating system dependent // For Windows: -// PACKER_CACHE_DIR="" CacheDir() => "./packer_cache/ -// PACKER_CACHE_DIR="" CacheDir("foo") => "./packer_cache/foo -// PACKER_CACHE_DIR="bar" CacheDir("foo") => "./bar/foo -// PACKER_CACHE_DIR="/home/there" CacheDir("foo", "bar") => "/home/there/foo/bar +// +// PACKER_CACHE_DIR="" CacheDir() => "./packer_cache/ +// PACKER_CACHE_DIR="" CacheDir("foo") => "./packer_cache/foo +// PACKER_CACHE_DIR="bar" CacheDir("foo") => "./bar/foo +// PACKER_CACHE_DIR="/home/there" CacheDir("foo", "bar") => "/home/there/foo/bar +// // For Unix: // NOTE: PACKER_CACHE_DIR will be used over XDG_CACHE_HOME environment variable -// PACKER_CACHE_DIR="", XDG_CACHE_HOME="", CacheDir() => "$HOME/cache/packer" -// PACKER_CACHE_DIR="", XDG_CACHE_HOME="", CacheDir("foo") => "$HOME/cache/packer/foo" -// PACKER_CACHE_DIR="bar", XDG_CACHE_HOME="", CacheDir("foo") => "./bar/foo" -// PACKER_CACHE_DIR="/home/there", XDG_CACHE_HOME="", CacheDir("foo", "bar") => "/home/there/foo/bar" -// PACKER_CACHE_DIR="", XDG_CACHE_HOME="/home/there", CacheDir("foo", "bar") => "/home/there/foo/bar" -// PACKER_CACHE_DIR="/foo", XDG_CACHE_HOME="/bar", CacheDir("a", "b") => "/foo/a/b" +// +// PACKER_CACHE_DIR="", XDG_CACHE_HOME="", CacheDir() => "$HOME/cache/packer" +// PACKER_CACHE_DIR="", XDG_CACHE_HOME="", CacheDir("foo") => "$HOME/cache/packer/foo" +// PACKER_CACHE_DIR="bar", XDG_CACHE_HOME="", CacheDir("foo") => "./bar/foo" +// PACKER_CACHE_DIR="/home/there", XDG_CACHE_HOME="", CacheDir("foo", "bar") => "/home/there/foo/bar" +// PACKER_CACHE_DIR="", XDG_CACHE_HOME="/home/there", CacheDir("foo", "bar") => "/home/there/foo/bar" +// PACKER_CACHE_DIR="/foo", XDG_CACHE_HOME="/bar", CacheDir("a", "b") => "/foo/a/b" func CachePath(paths ...string) (path string, err error) { defer func() { // create the dir based on return path if it doesn't exist diff --git a/packer/cache_config_unix.go b/packer/cache_config_unix.go index f05dd1677..4037c9588 100644 --- a/packer/cache_config_unix.go +++ b/packer/cache_config_unix.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build darwin || freebsd || linux || netbsd || openbsd || solaris -// +build darwin freebsd linux netbsd openbsd solaris package packer diff --git a/packer/cache_config_unix_test.go b/packer/cache_config_unix_test.go index ec7cb1bb0..df75e951d 100644 --- a/packer/cache_config_unix_test.go +++ b/packer/cache_config_unix_test.go @@ -1,10 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build darwin || freebsd || linux || netbsd || openbsd || solaris -// +build darwin freebsd linux netbsd openbsd solaris package packer import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -12,12 +13,12 @@ import ( func TestCachePath(t *testing.T) { // temporary directories for env vars - xdgCacheHomeTempDir, err := ioutil.TempDir(os.TempDir(), "*") + xdgCacheHomeTempDir, err := os.MkdirTemp(os.TempDir(), "*") if err != nil { t.Fatalf("Failed to create temp test directory: failing test: %v", err) } defer os.RemoveAll(xdgCacheHomeTempDir) - packerCacheTempDir, err := ioutil.TempDir(os.TempDir(), "*") + packerCacheTempDir, err := os.MkdirTemp(os.TempDir(), "*") if err != nil { t.Fatalf("Failed to create temp test directory: failing test: %v", err) } diff --git a/packer/cache_config_windows.go b/packer/cache_config_windows.go index a5b128c28..d0d031fc8 100644 --- a/packer/cache_config_windows.go +++ b/packer/cache_config_windows.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build windows -// +build windows package packer diff --git a/packer/cache_config_windows_test.go b/packer/cache_config_windows_test.go index 92e8dcb50..585f2ce93 100644 --- a/packer/cache_config_windows_test.go +++ b/packer/cache_config_windows_test.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build windows -// +build windows package packer diff --git a/packer/communicator.go b/packer/communicator.go index 026737d4b..0317aa5aa 100644 --- a/packer/communicator.go +++ b/packer/communicator.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/communicator_mock.go b/packer/communicator_mock.go index 00b043a91..e27a6c162 100644 --- a/packer/communicator_mock.go +++ b/packer/communicator_mock.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/communicator_mock_test.go b/packer/communicator_mock_test.go index 7aa92b070..6fe40de47 100644 --- a/packer/communicator_mock_test.go +++ b/packer/communicator_mock_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( @@ -5,8 +8,7 @@ import ( ) func TestMockCommunicator_impl(t *testing.T) { - var raw interface{} - raw = new(MockCommunicator) + var raw interface{} = new(MockCommunicator) if _, ok := raw.(Communicator); !ok { t.Fatal("should be a communicator") } diff --git a/packer/communicator_test.go b/packer/communicator_test.go index e334d0d52..25e475a21 100644 --- a/packer/communicator_test.go +++ b/packer/communicator_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/datasource.go b/packer/datasource.go index 556aac22f..d68e12e29 100644 --- a/packer/datasource.go +++ b/packer/datasource.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/datasource_mock.go b/packer/datasource_mock.go index 65b11ba6b..18c030cd0 100644 --- a/packer/datasource_mock.go +++ b/packer/datasource_mock.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc mapstructure-to-hcl2 -type MockDatasource,MockDatasourceResponse package packer diff --git a/packer/doc.go b/packer/doc.go index ada2bbd4c..6f7704c09 100644 --- a/packer/doc.go +++ b/packer/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package packer contains all of the interfaces for key Packer objects. diff --git a/packer/hcl2spec.go b/packer/hcl2spec.go index bbba47ec3..6ea525b28 100644 --- a/packer/hcl2spec.go +++ b/packer/hcl2spec.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import "github.com/hashicorp/hcl/v2/hcldec" diff --git a/packer/hook.go b/packer/hook.go index ee8104ac9..3270a6565 100644 --- a/packer/hook.go +++ b/packer/hook.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/hook_mock.go b/packer/hook_mock.go index 16571f1fe..e56e0b627 100644 --- a/packer/hook_mock.go +++ b/packer/hook_mock.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/hook_test.go b/packer/hook_test.go index efe0f0fd0..7574b9ce9 100644 --- a/packer/hook_test.go +++ b/packer/hook_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/logs.go b/packer/logs.go index 209b66ca3..2445cb0ac 100644 --- a/packer/logs.go +++ b/packer/logs.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( @@ -47,15 +50,6 @@ func (l *secretFilter) FilterString(message string) string { return message } -func (l *secretFilter) get() (s []string) { - l.m.Lock() - defer l.m.Unlock() - for k := range l.s { - s = append(s, k) - } - return -} - var LogSecretFilter secretFilter func init() { diff --git a/packer/maps.go b/packer/maps.go index 86ef6ab28..470e3aa97 100644 --- a/packer/maps.go +++ b/packer/maps.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/multi_error.go b/packer/multi_error.go index 5880612d5..4bddd7bf1 100644 --- a/packer/multi_error.go +++ b/packer/multi_error.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/multi_error_test.go b/packer/multi_error_test.go index 05463e690..8e0880cdf 100644 --- a/packer/multi_error_test.go +++ b/packer/multi_error_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( @@ -6,8 +9,7 @@ import ( ) func TestMultiError_Impl(t *testing.T) { - var raw interface{} - raw = &MultiError{} + var raw interface{} = &MultiError{} if _, ok := raw.(error); !ok { t.Fatal("MultiError must implement error") } diff --git a/packer/post_processor.go b/packer/post_processor.go index e99bcdd8a..c125d403f 100644 --- a/packer/post_processor.go +++ b/packer/post_processor.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( diff --git a/packer/provisioner.go b/packer/provisioner.go index 1f70e70a9..4a3619d89 100644 --- a/packer/provisioner.go +++ b/packer/provisioner.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import "context" diff --git a/packer/provisioner_mock.go b/packer/provisioner_mock.go index 73bae6b8a..b4b667a5b 100644 --- a/packer/provisioner_mock.go +++ b/packer/provisioner_mock.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc mapstructure-to-hcl2 -type MockProvisioner package packer diff --git a/packer/registry/image/fromartifact_example_test.go b/packer/registry/image/fromartifact_example_test.go index b6c1e7390..b8b239a8e 100644 --- a/packer/registry/image/fromartifact_example_test.go +++ b/packer/registry/image/fromartifact_example_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package image_test import ( diff --git a/packer/registry/image/frommappeddata_example_test.go b/packer/registry/image/frommappeddata_example_test.go index 4e1489c3f..c8acdef82 100644 --- a/packer/registry/image/frommappeddata_example_test.go +++ b/packer/registry/image/frommappeddata_example_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package image_test import ( diff --git a/packer/registry/image/image.go b/packer/registry/image/image.go index 9c86e16b4..834a603d8 100644 --- a/packer/registry/image/image.go +++ b/packer/registry/image/image.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package image allows for the management of image metadata that can be stored in a HCP Packer registry. */ package image diff --git a/packer/registry/image/image_test.go b/packer/registry/image/image_test.go index 57b0479fd..e1192f027 100644 --- a/packer/registry/image/image_test.go +++ b/packer/registry/image/image_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package image import ( diff --git a/packer/ui.go b/packer/ui.go index 7d75fc5a8..eb16239e0 100644 --- a/packer/ui.go +++ b/packer/ui.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( @@ -24,9 +27,12 @@ type TTY interface { // is formatted and various levels of output. type Ui interface { Ask(string) (string, error) + Askf(string, ...any) (string, error) Say(string) + Sayf(string, ...any) Message(string) Error(string) + Errorf(string, ...any) Machine(string, ...string) // TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser) getter.ProgressTracker @@ -49,6 +55,10 @@ type BasicUi struct { var _ Ui = new(BasicUi) +func (rw *BasicUi) Askf(query string, args ...any) (string, error) { + return rw.Ask(fmt.Sprintf(query, args...)) +} + func (rw *BasicUi) Ask(query string) (string, error) { rw.l.Lock() defer rw.l.Unlock() @@ -96,6 +106,10 @@ func (rw *BasicUi) Ask(query string) (string, error) { } } +func (rw *BasicUi) Sayf(message string, args ...any) { + rw.Say(fmt.Sprintf(message, args...)) +} + func (rw *BasicUi) Say(message string) { rw.l.Lock() defer rw.l.Unlock() @@ -124,6 +138,10 @@ func (rw *BasicUi) Message(message string) { } } +func (rw *BasicUi) Errorf(message string, args ...any) { + rw.Error(fmt.Sprintf(message, args...)) +} + func (rw *BasicUi) Error(message string) { rw.l.Lock() defer rw.l.Unlock() @@ -161,6 +179,13 @@ type SafeUi struct { var _ Ui = new(SafeUi) +func (u *SafeUi) Askf(s string, args ...any) (string, error) { + u.Sem <- 1 + ret, err := u.Ui.Askf(s, args...) + <-u.Sem + + return ret, err +} func (u *SafeUi) Ask(s string) (string, error) { u.Sem <- 1 ret, err := u.Ui.Ask(s) @@ -169,6 +194,11 @@ func (u *SafeUi) Ask(s string) (string, error) { return ret, err } +func (u *SafeUi) Sayf(s string, args ...any) { + u.Sem <- 1 + u.Ui.Sayf(s, args...) + <-u.Sem +} func (u *SafeUi) Say(s string) { u.Sem <- 1 u.Ui.Say(s) @@ -181,6 +211,11 @@ func (u *SafeUi) Message(s string) { <-u.Sem } +func (u *SafeUi) Errorf(s string, args ...any) { + u.Sem <- 1 + u.Ui.Errorf(s, args...) + <-u.Sem +} func (u *SafeUi) Error(s string) { u.Sem <- 1 u.Ui.Error(s) diff --git a/packer/ui_mock.go b/packer/ui_mock.go index fcf935fa9..a5467d769 100644 --- a/packer/ui_mock.go +++ b/packer/ui_mock.go @@ -1,9 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packer import ( "bytes" + "fmt" "io" - "io/ioutil" "testing" "time" ) @@ -14,8 +17,8 @@ func TestUi(t *testing.T) Ui { var buf bytes.Buffer return &BasicUi{ Reader: &buf, - Writer: ioutil.Discard, - ErrorWriter: ioutil.Discard, + Writer: io.Discard, + ErrorWriter: io.Discard, PB: &NoopProgressTracker{}, } } @@ -43,12 +46,18 @@ type MockUi struct { ProgressBarCloseCalled bool } +func (u *MockUi) Askf(query string, args ...any) (string, error) { + return u.Ask(fmt.Sprintf(query, args...)) +} func (u *MockUi) Ask(query string) (string, error) { u.AskCalled = true u.AskQuery = query return "foo", nil } +func (u *MockUi) Errorf(message string, args ...any) { + u.Error(fmt.Sprintf(message, args...)) +} func (u *MockUi) Error(message string) { u.ErrorCalled = true u.ErrorMessage = message @@ -65,6 +74,9 @@ func (u *MockUi) Message(message string) { u.MessageMessage = message } +func (u *MockUi) Sayf(message string, args ...any) { + u.Say(fmt.Sprintf(message, args...)) +} func (u *MockUi) Say(message string) { u.SayCalled = true sayMessage := SayMessage{ diff --git a/packerbuilderdata/generated_data.go b/packerbuilderdata/generated_data.go index ba78fbbac..3f8e982d3 100644 --- a/packerbuilderdata/generated_data.go +++ b/packerbuilderdata/generated_data.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package packerbuilderdata provides tooling for setting and getting special // builder-generated data that will be passed to the provisioners. This data // should be limited to runtime data like instance id, ip address, and other diff --git a/packerbuilderdata/generated_data_test.go b/packerbuilderdata/generated_data_test.go index 0f47b00ad..666a0816a 100644 --- a/packerbuilderdata/generated_data_test.go +++ b/packerbuilderdata/generated_data_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package packerbuilderdata import ( diff --git a/pathing/config_file.go b/pathing/config_file.go index f21deff2f..120a6d3e5 100644 --- a/pathing/config_file.go +++ b/pathing/config_file.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package pathing determines where to put the Packer config directory based on // host OS architecture and user environment variables. package pathing @@ -21,17 +24,19 @@ func ConfigFile() (string, error) { // ConfigDir returns the configuration directory for Packer. // NOTE: config directory will change depending on operating system dependent // For Windows: -// PACKER_CONFIG_DIR="" ConfigDir() => "/{homeDir()}/packer.config/ -// PACKER_CONFIG_DIR="bar" ConfigDir() => "/bar/packer.config/ +// +// PACKER_CONFIG_DIR="" ConfigDir() => "/{homeDir()}/packer.config/ +// PACKER_CONFIG_DIR="bar" ConfigDir() => "/bar/packer.config/ // // NOTE: Default_config_present=TRUE means that there is configuration directory at old location => $HOME/.packer.d // NOTE: This is not list all permutations, just some examples, view the // configDir function for your OS for the exact logic // For Unix: -// PACKER_CONFIG_DIR="" Default_config_present=FALSE XDG_CONFIG_HOME="" ConfigDir() => "$HOME/.config/packer -// PACKER_CONFIG_DIR="bar" Default_config_present=FALSE XDG_CONFIG_HOME="" ConfigDir() => "/bar/.packer.d/ -// PACKER_CONFIG_DIR="" Default_config_present=TRUE XDG_CONFIG_HOME="" ConfigDir() => "/$HOME/.packer.d/ -// PACKER_CONFIG_DIR="" Default_config_present=TRUE XDG_CONFIG_HOME="bar" ConfigDir() => "/bar/.packer.d/ +// +// PACKER_CONFIG_DIR="" Default_config_present=FALSE XDG_CONFIG_HOME="" ConfigDir() => "$HOME/.config/packer +// PACKER_CONFIG_DIR="bar" Default_config_present=FALSE XDG_CONFIG_HOME="" ConfigDir() => "/bar/.packer.d/ +// PACKER_CONFIG_DIR="" Default_config_present=TRUE XDG_CONFIG_HOME="" ConfigDir() => "/$HOME/.packer.d/ +// PACKER_CONFIG_DIR="" Default_config_present=TRUE XDG_CONFIG_HOME="bar" ConfigDir() => "/bar/.packer.d/ func ConfigDir() (string, error) { return configDir() } diff --git a/pathing/config_file_test.go b/pathing/config_file_test.go index 26db9997e..3286e3f81 100644 --- a/pathing/config_file_test.go +++ b/pathing/config_file_test.go @@ -1,7 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package pathing import ( "fmt" + "os" "os/user" "path/filepath" "runtime" @@ -14,6 +18,9 @@ func platform_user() string { // on the windows platform, whereas the correct way is to use // the api or to scrape `net user`. if runtime.GOOS == "windows" { + if loginUser := os.Getenv("USERNAME"); loginUser != "" { + return loginUser + } return "Administrator" } return "root" diff --git a/pathing/config_file_unix.go b/pathing/config_file_unix.go index 8396e9f62..fcdb458d0 100644 --- a/pathing/config_file_unix.go +++ b/pathing/config_file_unix.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build darwin || freebsd || linux || netbsd || openbsd || solaris -// +build darwin freebsd linux netbsd openbsd solaris package pathing diff --git a/pathing/config_file_unix_test.go b/pathing/config_file_unix_test.go index a6b1ad910..13b44081f 100644 --- a/pathing/config_file_unix_test.go +++ b/pathing/config_file_unix_test.go @@ -1,10 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build darwin || freebsd || linux || netbsd || openbsd || solaris -// +build darwin freebsd linux netbsd openbsd solaris package pathing import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -12,25 +13,25 @@ import ( func TestConfigPath(t *testing.T) { // temporary directories for env vars - xdgConfigHomeTempDir, err := ioutil.TempDir(os.TempDir(), "*") + xdgConfigHomeTempDir, err := os.MkdirTemp(os.TempDir(), "*") if err != nil { t.Fatalf("Failed to create temp test directory: failing test: %v", err) } defer os.RemoveAll(xdgConfigHomeTempDir) - packerConfigTempDir, err := ioutil.TempDir(os.TempDir(), "*") + packerConfigTempDir, err := os.MkdirTemp(os.TempDir(), "*") if err != nil { t.Fatalf("Failed to create temp test directory: failing test: %v", err) } defer os.RemoveAll(packerConfigTempDir) - homeTempDir, err := ioutil.TempDir(os.TempDir(), "*") + homeTempDir, err := os.MkdirTemp(os.TempDir(), "*") if err != nil { t.Fatalf("Failed to create temp test directory: failing test: %v", err) } defer os.RemoveAll(homeTempDir) - homeDirDefaultConfigTempDir, err := ioutil.TempDir(os.TempDir(), "*") + homeDirDefaultConfigTempDir, err := os.MkdirTemp(os.TempDir(), "*") if err != nil { t.Fatalf("Failed to create temp test directory: failing test: %v", err) } diff --git a/pathing/config_file_windows.go b/pathing/config_file_windows.go index b19f73c5a..62b01f45f 100644 --- a/pathing/config_file_windows.go +++ b/pathing/config_file_windows.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build windows -// +build windows package pathing diff --git a/pathing/config_file_windows_test.go b/pathing/config_file_windows_test.go index 1e03c9157..81c44da5c 100644 --- a/pathing/config_file_windows_test.go +++ b/pathing/config_file_windows_test.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build windows -// +build windows package pathing diff --git a/plugin/server.go b/plugin/server.go index d7395e40b..5c657efab 100644 --- a/plugin/server.go +++ b/plugin/server.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // The plugin package provides the functionality to both expose a Packer // plugin binary and to connect to an existing Packer plugin binary. // diff --git a/plugin/server_test.go b/plugin/server_test.go index 027c8d897..4fc032928 100644 --- a/plugin/server_test.go +++ b/plugin/server_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package plugin import ( diff --git a/plugin/set.go b/plugin/set.go index 0555b26d0..9211e7ea5 100644 --- a/plugin/set.go +++ b/plugin/set.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package plugin import ( @@ -15,7 +18,9 @@ import ( // Use this name to make the name of the plugin in the packer template match // the multiplugin suffix, instead of requiring a second part. // For example, calling : -// pps.RegisterProvisioner(plugin.DEFAULT_NAME, new(CommentProvisioner)) +// +// pps.RegisterProvisioner(plugin.DEFAULT_NAME, new(CommentProvisioner)) +// // On a plugin named `packer-plugin-foo`, will make the `foo` provisioner available // with your CommentProvisioner doing that. There can only be one unnamed // plugin per plugin type. @@ -93,9 +98,9 @@ func (i *Set) RegisterDatasource(name string, datasource packersdk.Datasource) { } // Run takes the os Args and runs a packer plugin command from it. -// * "describe" command makes the plugin set describe itself. -// * "start builder builder-name" starts the builder "builder-name" -// * "start post-processor example" starts the post-processor "example" +// - "describe" command makes the plugin set describe itself. +// - "start builder builder-name" starts the builder "builder-name" +// - "start post-processor example" starts the post-processor "example" func (i *Set) Run() error { args := os.Args[1:] return i.RunCommand(args...) diff --git a/plugin/set_test.go b/plugin/set_test.go index 980b91c47..f29ecc8f4 100644 --- a/plugin/set_test.go +++ b/plugin/set_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package plugin import ( @@ -42,12 +45,12 @@ func TestSet(t *testing.T) { set.RegisterProvisioner("example-2", new(MockProvisioner)) set.RegisterDatasource("example", new(MockDatasource)) set.RegisterDatasource("example-2", new(MockDatasource)) - set.SetVersion(pluginVersion.InitializePluginVersion( - "1.1.1", "")) + set.SetVersion(pluginVersion.NewPluginVersion( + "1.1.1", "", "")) outputDesc := set.description() - sdkVersion := pluginVersion.InitializePluginVersion(pluginVersion.Version, pluginVersion.VersionPrerelease) + sdkVersion := pluginVersion.NewPluginVersion(pluginVersion.Version, pluginVersion.VersionPrerelease, "") if diff := cmp.Diff(SetDescription{ Version: "1.1.1", SDKVersion: sdkVersion.String(), diff --git a/random/string.go b/random/string.go index 21c286532..508f64952 100644 --- a/random/string.go +++ b/random/string.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package random is a helper for generating random alphanumeric strings. package random diff --git a/retry/retry.go b/retry/retry.go index 7b36f3c61..3675a6959 100644 --- a/retry/retry.go +++ b/retry/retry.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package retry provides tooling to retry API calls which are known to be // vulnerable to throttling or flakiness due to eventual consistency. package retry @@ -40,12 +43,13 @@ func (err *RetryExhaustedError) Error() string { // Run will repeatedly retry the proivided fn within the constraints set in the // retry Config. It will retry until one of the following conditions is met: -// - The provided context is cancelled. -// - The Config.StartTimeout time has passed. -// - The function returns without an error. -// - The maximum number of tries, Config.Tries is exceeded. -// - The function returns with an error that does not satisfy conditions -// set in the Config.ShouldRetry function. +// - The provided context is cancelled. +// - The Config.StartTimeout time has passed. +// - The function returns without an error. +// - The maximum number of tries, Config.Tries is exceeded. +// - The function returns with an error that does not satisfy conditions +// set in the Config.ShouldRetry function. +// // If the given function (fn) does not return an error, then Run will return // nil. Otherwise, Run will return a relevant error. func (cfg Config) Run(ctx context.Context, fn func(context.Context) error) error { @@ -102,7 +106,9 @@ type Backoff struct { } // Linear Backoff returns a linearly increasing Duration. -// n = n * Multiplier. +// +// n = n * Multiplier. +// // the first value of n is InitialBackoff. n is maxed by MaxBackoff. func (lb *Backoff) Linear() time.Duration { wait := lb.InitialBackoff diff --git a/retry/retry_test.go b/retry/retry_test.go index 41ecc16c3..5ed73a3ef 100644 --- a/retry/retry_test.go +++ b/retry/retry_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package retry import ( diff --git a/retry/utils_test.go b/retry/utils_test.go index a23a7d578..7ac24b235 100644 --- a/retry/utils_test.go +++ b/retry/utils_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package retry import ( diff --git a/rpc/artifact.go b/rpc/artifact.go index dde49c8fe..285fd6764 100644 --- a/rpc/artifact.go +++ b/rpc/artifact.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/artifact_test.go b/rpc/artifact_test.go index 7a0fb8fa3..668226858 100644 --- a/rpc/artifact_test.go +++ b/rpc/artifact_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/build.go b/rpc/build.go index b5eb851ed..30af72c9d 100644 --- a/rpc/build.go +++ b/rpc/build.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/build_test.go b/rpc/build_test.go index 2f35eb34a..1ac54191f 100644 --- a/rpc/build_test.go +++ b/rpc/build_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/builder.go b/rpc/builder.go index 99761d42e..3b73b4b25 100644 --- a/rpc/builder.go +++ b/rpc/builder.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( @@ -123,7 +126,10 @@ func (b *BuilderServer) Run(streamId uint32, reply *uint32) error { if artifact != nil { streamId = b.mux.NextId() artifactServer := newServerWithMux(b.mux, streamId) - artifactServer.RegisterArtifact(artifact) + err := artifactServer.RegisterArtifact(artifact) + if err != nil { + return err + } go artifactServer.Serve() *reply = streamId } diff --git a/rpc/builder_test.go b/rpc/builder_test.go index 0cf1c4ba8..4589ed256 100644 --- a/rpc/builder_test.go +++ b/rpc/builder_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/client.go b/rpc/client.go index 90e3244da..5c660c638 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/client_test.go b/rpc/client_test.go index d38d88d0e..52e6f4acd 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/common.go b/rpc/common.go index 7044ebcaf..2a0dadc34 100644 --- a/rpc/common.go +++ b/rpc/common.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( @@ -11,7 +14,7 @@ import ( ) // commonClient allows to rpc call funcs that can be defined on the different -// build blocks of packer +// build blocks of Packer. type commonClient struct { // endpoint is usually the type of build block we are connecting to. // @@ -22,7 +25,8 @@ type commonClient struct { } type commonServer struct { - mux *muxBroker + mux *muxBroker + // a HCL2 enabled component such as a Builder selfConfigurable interface { ConfigSpec() hcldec.ObjectSpec } diff --git a/rpc/common_test.go b/rpc/common_test.go new file mode 100644 index 000000000..b4b508a88 --- /dev/null +++ b/rpc/common_test.go @@ -0,0 +1,88 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package rpc + +import ( + "testing" + + "github.com/hashicorp/hcl/v2/hcldec" + packersdk "github.com/hashicorp/packer-plugin-sdk/packer" +) + +func TestCommonServer_ConfigSpec(t *testing.T) { + tt := []struct { + name string + component packersdk.HCL2Speccer + }{ + { + name: "Builder Component Server", + component: new(packersdk.MockBuilder), + }, + { + name: "Datasource Component Server", + component: new(packersdk.MockDatasource), + }, + { + name: "Provisioner Component Server", + component: new(packersdk.MockProvisioner), + }, + } + + for _, tc := range tt { + tc := tc + t.Run(tc.name, func(t *testing.T) { + // Start the server + client, server := testClientServer(t) + defer client.Close() + defer server.Close() + + var configSpecTestFn func() hcldec.ObjectSpec + switch v := tc.component.(type) { + case packersdk.Builder: + configSpecTestFn = func() hcldec.ObjectSpec { + server.RegisterBuilder(v) + remote := client.Builder() + spec := remote.ConfigSpec() + return spec + } + case packersdk.Datasource: + configSpecTestFn = func() hcldec.ObjectSpec { + server.RegisterDatasource(v) + remote := client.Datasource() + spec := remote.ConfigSpec() + return spec + } + case packersdk.Provisioner: + configSpecTestFn = func() hcldec.ObjectSpec { + server.RegisterProvisioner(v) + remote := client.Provisioner() + spec := remote.ConfigSpec() + return spec + } + case packersdk.PostProcessor: + configSpecTestFn = func() hcldec.ObjectSpec { + server.RegisterPostProcessor(v) + remote := client.PostProcessor() + spec := remote.ConfigSpec() + return spec + } + default: + t.Fatalf("Unknown component type %T", v) + } + + defer func() { + if r := recover(); r != nil { + t.Errorf("Call to ConfigSpec for %s panicked: %v", tc.name, r) + } + }() + + spec := configSpecTestFn() + if len(spec) == 0 { + t.Errorf("expected remote.ConfigSpec for %T to return a valid hcldec.ObjectSpec, but return %v", tc.component, spec) + } + + }) + } + +} diff --git a/rpc/communicator.go b/rpc/communicator.go index 02b55eeca..8a8808eff 100644 --- a/rpc/communicator.go +++ b/rpc/communicator.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/communicator_test.go b/rpc/communicator_test.go index ade2bda8b..966daae74 100644 --- a/rpc/communicator_test.go +++ b/rpc/communicator_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( @@ -161,8 +164,7 @@ func TestCommunicatorRPC(t *testing.T) { } func TestCommunicator_ImplementsCommunicator(t *testing.T) { - var raw interface{} - raw = Communicator(nil) + var raw interface{} = Communicator(nil) if _, ok := raw.(packersdk.Communicator); !ok { t.Fatal("should be a Communicator") } diff --git a/rpc/cty_encode.go b/rpc/cty_encode.go index 570e0ee13..429abc4db 100644 --- a/rpc/cty_encode.go +++ b/rpc/cty_encode.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/datasource.go b/rpc/datasource.go index d07d16729..6370fa590 100644 --- a/rpc/datasource.go +++ b/rpc/datasource.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/datasource_test.go b/rpc/datasource_test.go index 520fb80e0..180adae2f 100644 --- a/rpc/datasource_test.go +++ b/rpc/datasource_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( @@ -63,6 +66,12 @@ func TestDatasource(t *testing.T) { d.outputSpec = map[string]hcldec.Spec{ "foo": &hcldec.AttrSpec{Name: "foo", Type: cty.String, Required: false}, } + + defer func() { + if r := recover(); r != nil { + t.Errorf("Call to ConfigSpec for datasource panicked: %v", r) + } + }() spec := dsClient.OutputSpec() if !reflect.DeepEqual(spec, d.outputSpec) { t.Fatalf("unknown outputSpec value: %#v", spec) @@ -80,8 +89,7 @@ func TestDatasource(t *testing.T) { } func TestDatasource_Implements(t *testing.T) { - var raw interface{} - raw = new(datasource) + var raw interface{} = new(datasource) if _, ok := raw.(packer.Datasource); !ok { t.Fatal("not a datasource") } diff --git a/rpc/error.go b/rpc/error.go index c3ab7b1a4..c9a831e5b 100644 --- a/rpc/error.go +++ b/rpc/error.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc // This is a type that wraps error types so that they can be messaged diff --git a/rpc/error_test.go b/rpc/error_test.go index 8c5cbd7fa..991c38833 100644 --- a/rpc/error_test.go +++ b/rpc/error_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/fileinfo.go b/rpc/fileinfo.go index 299a93138..3e9a17a86 100644 --- a/rpc/fileinfo.go +++ b/rpc/fileinfo.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/fileinfo_test.go b/rpc/fileinfo_test.go index 8eefd0f57..ed9da3907 100644 --- a/rpc/fileinfo_test.go +++ b/rpc/fileinfo_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/hook.go b/rpc/hook.go index 7971501ff..bd9cd42e1 100644 --- a/rpc/hook.go +++ b/rpc/hook.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/hook_test.go b/rpc/hook_test.go index ddf996580..22be0ffef 100644 --- a/rpc/hook_test.go +++ b/rpc/hook_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/init.go b/rpc/init.go index eeeb9e0c1..23fe95a59 100644 --- a/rpc/init.go +++ b/rpc/init.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package rpc contains the implementation of the remote procedure call code that the Packer core uses to communicate with packer plugins. As a plugin maintainer, @@ -6,7 +9,16 @@ underpins the packer server that all plugins must implement. */ package rpc -import "encoding/gob" +import ( + "encoding/gob" + + "github.com/zclconf/go-cty/cty" +) + +// Test that cty types implement the gob.GobEncoder interface. +// Support for encoding/gob was removed in github.com/zclconf/go-cty@v1.11.0. +// Refer to issue https://github.com/hashicorp/packer-plugin-sdk/issues/187 +var _ gob.GobEncoder = cty.Value{} func init() { gob.Register(new(map[string]string)) diff --git a/rpc/mux_broker.go b/rpc/mux_broker.go index 64653b1ed..6d0b10593 100644 --- a/rpc/mux_broker.go +++ b/rpc/mux_broker.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/mux_broker_test.go b/rpc/mux_broker_test.go index 9f3f7bcd9..12fbc5f6b 100644 --- a/rpc/mux_broker_test.go +++ b/rpc/mux_broker_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/post_processor.go b/rpc/post_processor.go index 9c2de87b6..04c87db9d 100644 --- a/rpc/post_processor.go +++ b/rpc/post_processor.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/post_processor_test.go b/rpc/post_processor_test.go index 3dd4d874b..77f6831e7 100644 --- a/rpc/post_processor_test.go +++ b/rpc/post_processor_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( @@ -131,8 +134,7 @@ func TestPostProcessorRPC_cancel(t *testing.T) { } func TestPostProcessor_Implements(t *testing.T) { - var raw interface{} - raw = new(postProcessor) + var raw interface{} = new(postProcessor) if _, ok := raw.(packersdk.PostProcessor); !ok { t.Fatal("not a postprocessor") } diff --git a/rpc/provisioner.go b/rpc/provisioner.go index ebf6b640f..8bd98e783 100644 --- a/rpc/provisioner.go +++ b/rpc/provisioner.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/provisioner_test.go b/rpc/provisioner_test.go index 1ac4e64c3..e9be74a6d 100644 --- a/rpc/provisioner_test.go +++ b/rpc/provisioner_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( diff --git a/rpc/server.go b/rpc/server.go index 2c2863f84..759f0594f 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( @@ -11,16 +14,16 @@ import ( const ( DefaultArtifactEndpoint string = "Artifact" - DefaultBuildEndpoint = "Build" - DefaultBuilderEndpoint = "Builder" - DefaultCacheEndpoint = "Cache" - DefaultCommandEndpoint = "Command" - DefaultCommunicatorEndpoint = "Communicator" - DefaultHookEndpoint = "Hook" - DefaultPostProcessorEndpoint = "PostProcessor" - DefaultProvisionerEndpoint = "Provisioner" - DefaultDatasourceEndpoint = "Datasource" - DefaultUiEndpoint = "Ui" + DefaultBuildEndpoint string = "Build" + DefaultBuilderEndpoint string = "Builder" + DefaultCacheEndpoint string = "Cache" + DefaultCommandEndpoint string = "Command" + DefaultCommunicatorEndpoint string = "Communicator" + DefaultHookEndpoint string = "Hook" + DefaultPostProcessorEndpoint string = "PostProcessor" + DefaultProvisionerEndpoint string = "Provisioner" + DefaultDatasourceEndpoint string = "Datasource" + DefaultUiEndpoint string = "Ui" ) // PluginServer represents an RPC server for Packer. This must be paired on the diff --git a/rpc/server_test.go b/rpc/server_test.go index 9ab1e3e8e..ac74610e6 100644 --- a/rpc/server_test.go +++ b/rpc/server_test.go @@ -1 +1,4 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc diff --git a/rpc/ui.go b/rpc/ui.go index 61032413a..3b5a951c4 100644 --- a/rpc/ui.go +++ b/rpc/ui.go @@ -1,6 +1,10 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( + "fmt" "log" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" @@ -28,11 +32,17 @@ type UiMachineArgs struct { Args []string } +func (u *Ui) Askf(query string, args ...any) (string, error) { + return u.Ask(fmt.Sprintf(query, args...)) +} func (u *Ui) Ask(query string) (result string, err error) { err = u.client.Call("Ui.Ask", query, &result) return } +func (u *Ui) Errorf(message string, args ...any) { + u.Error(fmt.Sprintf(message, args...)) +} func (u *Ui) Error(message string) { if err := u.client.Call("Ui.Error", message, new(interface{})); err != nil { log.Printf("Error in Ui.Error RPC call: %s", err) @@ -56,6 +66,9 @@ func (u *Ui) Message(message string) { } } +func (u *Ui) Sayf(message string, args ...any) { + u.Say(fmt.Sprintf(message, args...)) +} func (u *Ui) Say(message string) { if err := u.client.Call("Ui.Say", message, new(interface{})); err != nil { log.Printf("Error in Ui.Say RPC call: %s", err) diff --git a/rpc/ui_progress_tracking.go b/rpc/ui_progress_tracking.go index 92fd5dd59..c66a7911a 100644 --- a/rpc/ui_progress_tracking.go +++ b/rpc/ui_progress_tracking.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( @@ -82,7 +85,7 @@ type ProgressTrackingServer struct { } func (t *ProgressTrackingServer) Add(size int, _ *interface{}) error { - stubBytes := make([]byte, size, size) + stubBytes := make([]byte, size) t.stream.Read(stubBytes) return nil } diff --git a/rpc/ui_test.go b/rpc/ui_test.go index a3df10df1..aacf8d279 100644 --- a/rpc/ui_test.go +++ b/rpc/ui_test.go @@ -1,9 +1,12 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package rpc import ( "bytes" + "fmt" "io" - "io/ioutil" "reflect" "testing" ) @@ -26,12 +29,18 @@ type testUi struct { progressBarCloseCalled bool } +func (u *testUi) Askf(query string, args ...any) (string, error) { + return u.Ask(fmt.Sprintf(query, args...)) +} func (u *testUi) Ask(query string) (string, error) { u.askCalled = true u.askQuery = query return "foo", nil } +func (u *testUi) Errorf(message string, args ...any) { + u.Error(fmt.Sprintf(message, args...)) +} func (u *testUi) Error(message string) { u.errorCalled = true u.errorMessage = message @@ -48,6 +57,9 @@ func (u *testUi) Message(message string) { u.messageMessage = message } +func (u *testUi) Sayf(message string, args ...any) { + u.Say(fmt.Sprintf(message, args...)) +} func (u *testUi) Say(message string) { u.sayCalled = true u.sayMessage = message @@ -119,7 +131,7 @@ func TestUiRPC(t *testing.T) { } ctt := []byte("foo bar baz !!!") - rc := ioutil.NopCloser(bytes.NewReader(ctt)) + rc := io.NopCloser(bytes.NewReader(ctt)) stream := uiClient.TrackProgress("stuff.txt", 0, int64(len(ctt)), rc) if ui.trackProgressCalled != true { diff --git a/sdk-internals/communicator/none/communicator.go b/sdk-internals/communicator/none/communicator.go index d37804961..c0232bba7 100644 --- a/sdk-internals/communicator/none/communicator.go +++ b/sdk-internals/communicator/none/communicator.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package none implements the 'none' communicator. Plugin maintainers should not // import this package directly, instead using the tooling in the // "packer-plugin-sdk/communicator" module. diff --git a/sdk-internals/communicator/none/communicator_test.go b/sdk-internals/communicator/none/communicator_test.go index 4a73a6c8d..20a7d12ac 100644 --- a/sdk-internals/communicator/none/communicator_test.go +++ b/sdk-internals/communicator/none/communicator_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package none import ( @@ -7,8 +10,7 @@ import ( ) func TestCommIsCommunicator(t *testing.T) { - var raw interface{} - raw = &comm{} + var raw interface{} = &comm{} if _, ok := raw.(packersdk.Communicator); !ok { t.Fatalf("comm must be a communicator") } diff --git a/sdk-internals/communicator/ssh/communicator.go b/sdk-internals/communicator/ssh/communicator.go index 9b08af181..5dc682c47 100644 --- a/sdk-internals/communicator/ssh/communicator.go +++ b/sdk-internals/communicator/ssh/communicator.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package ssh implements the SSH communicator. Plugin maintainers should not // import this package directly, instead using the tooling in the // "packer-plugin-sdk/communicator" module. @@ -10,7 +13,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "net" "os" @@ -158,9 +160,9 @@ func (c *comm) Start(ctx context.Context, cmd *packersdk.RemoteCmd) (err error) err := session.Wait() exitStatus := 0 if err != nil { - switch err.(type) { + switch err := err.(type) { case *ssh.ExitError: - exitStatus = err.(*ssh.ExitError).ExitStatus() + exitStatus = err.ExitStatus() log.Printf("[ERROR] Remote command exited with '%d': %s", exitStatus, cmd.Command) case *ssh.ExitMissingError: log.Printf("[ERROR] Remote command exited without exit status or exit signal.") @@ -204,7 +206,7 @@ func (c *comm) DownloadDir(src string, dst string, excl []string) error { return err } - if len(fi) < 0 { + if len(fi) == 0 { return fmt.Errorf("empty response from server") } @@ -487,7 +489,6 @@ func (c *comm) connectToAgent() { } log.Printf("[INFO] agent forwarding enabled") - return } func (c *comm) sftpUploadSession(path string, input io.Reader, fi *os.FileInfo) error { @@ -525,8 +526,9 @@ func (c *comm) sftpUploadDirSession(dst string, src string, excl []string) error sftpFunc := func(client *sftp.Client) error { rootDst := dst if src[len(src)-1] != '/' { - log.Printf("[DEBUG] No trailing slash, creating the source directory name") - rootDst = filepath.Join(dst, filepath.Base(src)) + srcBase := filepath.Base(src) + log.Printf("[DEBUG] sftp: No trailing slash, creating directory %s/%s", dst, srcBase) + rootDst = filepath.Join(dst, srcBase) } walkFunc := func(path string, info os.FileInfo, err error) error { if err != nil { @@ -544,9 +546,12 @@ func (c *comm) sftpUploadDirSession(dst string, src string, excl []string) error // to the sftp server finalDst = filepath.ToSlash(finalDst) + log.Printf("[DEBUG] sftp: uploading %q to %q", relSrc, finalDst) + // Skip the creation of the target destination directory since // it should exist and we might not even own it if finalDst == dst { + log.Printf("[DEBUG] sftp: skipping creation of %q", dst) return nil } @@ -688,12 +693,13 @@ func (c *comm) scpUploadDirSession(dst string, src string, excl []string) error } if src[len(src)-1] != '/' { - log.Printf("[DEBUG] No trailing slash, creating the source directory name") + srcBase := filepath.Base(src) + log.Printf("[DEBUG] scp: No trailing slash, creating directory %s/%s", dst, srcBase) fi, err := os.Stat(src) if err != nil { return err } - return scpUploadDirProtocol(filepath.Base(src), w, r, uploadEntries, fi) + return scpUploadDirProtocol(srcBase, w, r, uploadEntries, fi) } else { // Trailing slash, so only upload the contents return uploadEntries() @@ -713,7 +719,7 @@ func (c *comm) scpDownloadSession(path string, output io.Writer) error { return err } - if len(fi) < 0 { + if len(fi) == 0 { return fmt.Errorf("empty response from server") } @@ -819,7 +825,7 @@ func (c *comm) scpSession(scpCommand string, f func(io.Writer, *bufio.Reader) er // Otherwise, we have an ExitError, meaning we can just read the // exit status log.Printf("[DEBUG] non-zero exit status: %d, %v", exitErr.ExitStatus(), err) - stdoutB, err := ioutil.ReadAll(stdoutR) + stdoutB, err := io.ReadAll(stdoutR) if err != nil { return err } @@ -897,7 +903,7 @@ func scpUploadFile(dst string, src io.Reader, w io.Writer, r *bufio.Reader, fi * if _, err := io.Copy(tf, src); err != nil { return fmt.Errorf("Error copying input data into local temporary "+ "file. Check that TEMPDIR has enough space. Please see "+ - "https://www.packer.io/docs/other/environment-variables#tmpdir"+ + "https://developer.hashicorp.com/packer/docs/configure#tmpdir"+ "for more info. Error: %s", err) } @@ -960,6 +966,8 @@ func scpUploadDirProtocol(name string, w io.Writer, r *bufio.Reader, f func() er } func scpUploadDir(root string, fs []os.FileInfo, w io.Writer, r *bufio.Reader) error { + log.Printf("[DEBUG] scp: uploading directory %s", root) + for _, fi := range fs { realPath := filepath.Join(root, fi.Name()) diff --git a/sdk-internals/communicator/ssh/communicator_test.go b/sdk-internals/communicator/ssh/communicator_test.go index 9d1680755..059f486ca 100644 --- a/sdk-internals/communicator/ssh/communicator_test.go +++ b/sdk-internals/communicator/ssh/communicator_test.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build !race -// +build !race package ssh @@ -121,8 +123,7 @@ func newMockBrokenServer(t *testing.T) string { } func TestCommIsCommunicator(t *testing.T) { - var raw interface{} - raw = &comm{} + var raw interface{} = &comm{} if _, ok := raw.(packersdk.Communicator); !ok { t.Fatalf("comm must be a communicator") } diff --git a/sdk-internals/communicator/ssh/connect.go b/sdk-internals/communicator/ssh/connect.go index 4216ec35d..4e134c9aa 100644 --- a/sdk-internals/communicator/ssh/connect.go +++ b/sdk-internals/communicator/ssh/connect.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( diff --git a/sdk-internals/communicator/ssh/connect_test.go b/sdk-internals/communicator/ssh/connect_test.go index a241eeb44..ac288cfb5 100644 --- a/sdk-internals/communicator/ssh/connect_test.go +++ b/sdk-internals/communicator/ssh/connect_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh_test import ( diff --git a/sdk-internals/communicator/ssh/connection.go b/sdk-internals/communicator/ssh/connection.go index c3df04543..9d9e88cae 100644 --- a/sdk-internals/communicator/ssh/connection.go +++ b/sdk-internals/communicator/ssh/connection.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( diff --git a/sdk-internals/communicator/ssh/keyboard_interactive.go b/sdk-internals/communicator/ssh/keyboard_interactive.go index 417ab00ae..19cbbaecd 100644 --- a/sdk-internals/communicator/ssh/keyboard_interactive.go +++ b/sdk-internals/communicator/ssh/keyboard_interactive.go @@ -1,15 +1,18 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( + "golang.org/x/term" "io" "log" "golang.org/x/crypto/ssh" - "golang.org/x/crypto/ssh/terminal" ) func KeyboardInteractive(c io.ReadWriter) ssh.KeyboardInteractiveChallenge { - t := terminal.NewTerminal(c, "") + t := term.NewTerminal(c, "") return func(user, instruction string, questions []string, echos []bool) ([]string, error) { if len(questions) == 0 { return []string{}, nil @@ -26,7 +29,7 @@ func KeyboardInteractive(c io.ReadWriter) ssh.KeyboardInteractiveChallenge { if err != nil { return nil, err } - answers[i] = string(s) + answers[i] = s } return answers, nil } diff --git a/sdk-internals/communicator/ssh/keyboard_interactive_test.go b/sdk-internals/communicator/ssh/keyboard_interactive_test.go index fc1bbfd45..00968a9f8 100644 --- a/sdk-internals/communicator/ssh/keyboard_interactive_test.go +++ b/sdk-internals/communicator/ssh/keyboard_interactive_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( diff --git a/sdk-internals/communicator/ssh/password.go b/sdk-internals/communicator/ssh/password.go index 774be47f1..865e5618e 100644 --- a/sdk-internals/communicator/ssh/password.go +++ b/sdk-internals/communicator/ssh/password.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( diff --git a/sdk-internals/communicator/ssh/password_test.go b/sdk-internals/communicator/ssh/password_test.go index 47a4c7782..37901cf5e 100644 --- a/sdk-internals/communicator/ssh/password_test.go +++ b/sdk-internals/communicator/ssh/password_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( @@ -8,8 +11,7 @@ import ( ) func TestPasswordKeyboardInteractive_Impl(t *testing.T) { - var raw interface{} - raw = PasswordKeyboardInteractive("foo") + var raw interface{} = PasswordKeyboardInteractive("foo") if _, ok := raw.(ssh.KeyboardInteractiveChallenge); !ok { t.Fatal("PasswordKeyboardInteractive must implement KeyboardInteractiveChallenge") } diff --git a/sdk-internals/communicator/ssh/tunnel.go b/sdk-internals/communicator/ssh/tunnel.go index c99a1d1d8..cf8037433 100644 --- a/sdk-internals/communicator/ssh/tunnel.go +++ b/sdk-internals/communicator/ssh/tunnel.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package ssh import ( diff --git a/sdk-internals/communicator/winrm/communicator.go b/sdk-internals/communicator/winrm/communicator.go index 11398c994..1ca4e95c3 100644 --- a/sdk-internals/communicator/winrm/communicator.go +++ b/sdk-internals/communicator/winrm/communicator.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package winrm implements the WinRM communicator. Plugin maintainers should not // import this package directly, instead using the tooling in the // "packer-plugin-sdk/communicator" module. @@ -8,7 +11,6 @@ import ( "encoding/base64" "fmt" "io" - "io/ioutil" "log" "os" "path/filepath" @@ -167,7 +169,7 @@ func (c *Communicator) Download(src string, dst io.Writer) error { base64DecodePipe := &Base64Pipe{w: dst} cmd := winrm.Powershell(fmt.Sprintf(encodeScript, src)) - _, err = client.Run(cmd, base64DecodePipe, ioutil.Discard) + _, err = client.Run(cmd, base64DecodePipe, io.Discard) return err } @@ -204,8 +206,7 @@ func (c *Communicator) newWinRMClient() (*winrm.Client, error) { // winrmcp uses even we we aren't using winrmcp. This ensures similar // behavior between upload, download, and copy functions. We can't use the // one generated by winrmcp because it isn't exported. - var endpoint *winrm.Endpoint - endpoint = &winrm.Endpoint{ + var endpoint = &winrm.Endpoint{ Host: c.endpoint.Host, Port: c.endpoint.Port, HTTPS: conf.Https, @@ -233,7 +234,7 @@ type Base64Pipe struct { } func (d *Base64Pipe) ReadFrom(r io.Reader) (int64, error) { - b, err := ioutil.ReadAll(r) + b, err := io.ReadAll(r) if err != nil { return 0, err } diff --git a/sdk-internals/communicator/winrm/communicator_test.go b/sdk-internals/communicator/winrm/communicator_test.go index 207f0b075..2355a3a03 100644 --- a/sdk-internals/communicator/winrm/communicator_test.go +++ b/sdk-internals/communicator/winrm/communicator_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package winrm import ( diff --git a/sdk-internals/communicator/winrm/config.go b/sdk-internals/communicator/winrm/config.go index 728336734..a7e1bfd31 100644 --- a/sdk-internals/communicator/winrm/config.go +++ b/sdk-internals/communicator/winrm/config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package winrm import ( diff --git a/sdk-internals/communicator/winrm/time.go b/sdk-internals/communicator/winrm/time.go index f8fb6fe8d..d5eccd3ca 100644 --- a/sdk-internals/communicator/winrm/time.go +++ b/sdk-internals/communicator/winrm/time.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package winrm import ( diff --git a/sdk-internals/communicator/winrm/time_test.go b/sdk-internals/communicator/winrm/time_test.go index 4daf4cedf..56f2cc732 100644 --- a/sdk-internals/communicator/winrm/time_test.go +++ b/sdk-internals/communicator/winrm/time_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package winrm import ( diff --git a/shell-local/communicator.go b/shell-local/communicator.go index 4c2cc0c98..01c996cde 100644 --- a/shell-local/communicator.go +++ b/shell-local/communicator.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package shell_local import ( diff --git a/shell-local/communicator_test.go b/shell-local/communicator_test.go index fb75de6a7..05d5229a7 100644 --- a/shell-local/communicator_test.go +++ b/shell-local/communicator_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package shell_local import ( diff --git a/shell-local/config.go b/shell-local/config.go index cb04e62b2..f4c51a795 100644 --- a/shell-local/config.go +++ b/shell-local/config.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc mapstructure-to-hcl2 -type Config package shell_local @@ -147,7 +150,7 @@ func Validate(config *Config) error { break } } - if supported_os != true { + if !supported_os { return fmt.Errorf("Invalid OS specified in only_on: '%s'\n"+ "Supported OS names: %s", provided_os, strings.Join(supportedSyslist, ", ")) } @@ -185,11 +188,7 @@ func Validate(config *Config) error { } // drop unnecessary "." in extension; we add this later. - if config.TempfileExtension != "" { - if strings.HasPrefix(config.TempfileExtension, ".") { - config.TempfileExtension = config.TempfileExtension[1:] - } - } + config.TempfileExtension = strings.TrimPrefix(config.TempfileExtension, ".") // Do a check for bad environment variables, such as '=foo', 'foobar' for _, kv := range config.Vars { diff --git a/shell-local/config_test.go b/shell-local/config_test.go index 7c74581ae..4e74c8117 100644 --- a/shell-local/config_test.go +++ b/shell-local/config_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package shell_local import ( diff --git a/shell-local/doc.go b/shell-local/doc.go index 1c7a21ead..c1c57f108 100644 --- a/shell-local/doc.go +++ b/shell-local/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package shell-local is designed to make it easier to shell out locally on the machine running Packer. The top level tools in this package are probably not diff --git a/shell-local/localexec/run_and_stream.go b/shell-local/localexec/run_and_stream.go index b4c595309..2691a7ec5 100644 --- a/shell-local/localexec/run_and_stream.go +++ b/shell-local/localexec/run_and_stream.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package localexec import ( diff --git a/shell-local/localexec/run_and_stream_test.go b/shell-local/localexec/run_and_stream_test.go index 533b72801..a290e9379 100644 --- a/shell-local/localexec/run_and_stream_test.go +++ b/shell-local/localexec/run_and_stream_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package localexec import ( diff --git a/shell-local/run.go b/shell-local/run.go index 71404db7c..99e734f70 100644 --- a/shell-local/run.go +++ b/shell-local/run.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package shell_local import ( @@ -36,7 +39,7 @@ func Run(ctx context.Context, ui packersdk.Ui, config *Config, generatedData map } } if !runCommand { - ui.Say(fmt.Sprintf("Skipping shell-local due to runtime OS")) + ui.Say("Skipping shell-local due to runtime OS") log.Printf("[INFO] (shell-local): skipping shell-local due to missing runtime OS") return true, nil } diff --git a/shell/exit_code.go b/shell/exit_code.go index f39ac1940..4e620289c 100644 --- a/shell/exit_code.go +++ b/shell/exit_code.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package shell import "fmt" diff --git a/shell/exit_code_test.go b/shell/exit_code_test.go index c0ce58e99..3ce90f929 100644 --- a/shell/exit_code_test.go +++ b/shell/exit_code_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package shell import ( diff --git a/shell/shell.go b/shell/shell.go index 0e69cd955..ca3ed87be 100644 --- a/shell/shell.go +++ b/shell/shell.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package shell defines configuration fields that are common to many different // kinds of shell. For example, this common configuration is imported by the // "shell", "shell-local", and "powershell" provisioners. This provides diff --git a/shutdowncommand/config.go b/shutdowncommand/config.go index 64def8c3e..5727ff51e 100644 --- a/shutdowncommand/config.go +++ b/shutdowncommand/config.go @@ -1,6 +1,9 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc struct-markdown -//Package shutdowncommand is a helper module for builder plugin configuration. +// Package shutdowncommand is a helper module for builder plugin configuration. package shutdowncommand import ( diff --git a/shutdowncommand/config_test.go b/shutdowncommand/config_test.go index e5ff042ec..7323f918d 100644 --- a/shutdowncommand/config_test.go +++ b/shutdowncommand/config_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package shutdowncommand import ( diff --git a/template/config/custom_types.go b/template/config/custom_types.go index f7f4b6121..216fdedfa 100644 --- a/template/config/custom_types.go +++ b/template/config/custom_types.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc mapstructure-to-hcl2 -type KeyValue,KeyValues,KeyValueFilter,NameValue,NameValues,NameValueFilter package config @@ -43,17 +46,11 @@ func (t Trilean) ToBoolPointer() *bool { } func (t Trilean) True() bool { - if t == TriTrue { - return true - } - return false + return t == TriTrue } func (t Trilean) False() bool { - if t == TriFalse { - return true - } - return false + return t == TriFalse } func TrileanFromString(s string) (Trilean, error) { @@ -64,7 +61,7 @@ func TrileanFromString(s string) (Trilean, error) { b, err := strconv.ParseBool(s) if err != nil { return TriUnset, err - } else if b == true { + } else if b { return TriTrue, nil } else { return TriFalse, nil diff --git a/template/config/custom_types_test.go b/template/config/custom_types_test.go index 2a7cb933a..1b214c230 100644 --- a/template/config/custom_types_test.go +++ b/template/config/custom_types_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package config import ( diff --git a/template/config/decode.go b/template/config/decode.go index 96b5a553a..902ee21fa 100644 --- a/template/config/decode.go +++ b/template/config/decode.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package config import ( @@ -186,7 +189,7 @@ func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error { } } } - if fixable == true { + if fixable { break } } diff --git a/template/config/decode_test.go b/template/config/decode_test.go index 3776e0aae..3ca94e65a 100644 --- a/template/config/decode_test.go +++ b/template/config/decode_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package config import ( diff --git a/template/config/deprecated_options.go b/template/config/deprecated_options.go index bb53c7d01..1572b5511 100644 --- a/template/config/deprecated_options.go +++ b/template/config/deprecated_options.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // package config diff --git a/template/doc.go b/template/doc.go index 355460e5b..f69fc0c0f 100644 --- a/template/doc.go +++ b/template/doc.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + /* Package template helps plugins parse the Packer template into golang structures. @@ -8,35 +11,35 @@ validation, custom type decoding, and template variable interpolation. A simple usage example that defines a config and then unpacks a user-provided json template into the provided config: - import ( - // ... - "github.com/hashicorp/packer-plugin-sdk/template/config" - "github.com/hashicorp/packer-plugin-sdk/template/interpolate" - ) - - type Config struct { - Field1 string `mapstructure:"field_1"` - Field2 bool `mapstructure:"field_2"` - Field3 bool `mapstructure:"field_3"` - - ctx interpolate.Context - } - - type Provisioner struct { - config Config - } - - func (p *CommentProvisioner) Prepare(raws ...interface{}) error { - err := config.Decode(&p.config, &config.DecodeOpts{ - Interpolate: true, - InterpolateContext: &p.config.ctx, - }, raws...) - if err != nil { - return err - } - - return nil - } + import ( + // ... + "github.com/hashicorp/packer-plugin-sdk/template/config" + "github.com/hashicorp/packer-plugin-sdk/template/interpolate" + ) + + type Config struct { + Field1 string `mapstructure:"field_1"` + Field2 bool `mapstructure:"field_2"` + Field3 bool `mapstructure:"field_3"` + + ctx interpolate.Context + } + + type Provisioner struct { + config Config + } + + func (p *CommentProvisioner) Prepare(raws ...interface{}) error { + err := config.Decode(&p.config, &config.DecodeOpts{ + Interpolate: true, + InterpolateContext: &p.config.ctx, + }, raws...) + if err != nil { + return err + } + + return nil + } More implementation details for plugins can be found in the [extending packer](https://www.packer.io/docs/extending) section of the website. diff --git a/template/funcs.go b/template/funcs.go index cf1e691dd..13cd2e344 100644 --- a/template/funcs.go +++ b/template/funcs.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package template import ( diff --git a/template/interpolate/aws/secretsmanager/secretsmanager.go b/template/interpolate/aws/secretsmanager/secretsmanager.go index b7e77ab5e..9fd0d18f3 100644 --- a/template/interpolate/aws/secretsmanager/secretsmanager.go +++ b/template/interpolate/aws/secretsmanager/secretsmanager.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package secretsmanager provide methods to get data from // AWS Secret Manager package secretsmanager @@ -81,7 +84,7 @@ func getSecretValue(s *SecretString, spec *SecretSpec) (string, error) { blob := []byte(s.SecretString) //For those plaintext secrets just return the value - if json.Valid(blob) != true { + if !json.Valid(blob) { return s.SecretString, nil } diff --git a/template/interpolate/aws/secretsmanager/secretsmanager_test.go b/template/interpolate/aws/secretsmanager/secretsmanager_test.go index eacd41f83..a2d872a5a 100644 --- a/template/interpolate/aws/secretsmanager/secretsmanager_test.go +++ b/template/interpolate/aws/secretsmanager/secretsmanager_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package secretsmanager import ( diff --git a/template/interpolate/aws/secretsmanager/types.go b/template/interpolate/aws/secretsmanager/types.go index 6cd1dc46e..37a30cbc7 100644 --- a/template/interpolate/aws/secretsmanager/types.go +++ b/template/interpolate/aws/secretsmanager/types.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package secretsmanager // AWSConfig store configuration used to initialize diff --git a/template/interpolate/funcs.go b/template/interpolate/funcs.go index f2878742c..930c4832f 100644 --- a/template/interpolate/funcs.go +++ b/template/interpolate/funcs.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/interpolate/funcs_test.go b/template/interpolate/funcs_test.go index 5be7298fd..7eec8c3f3 100644 --- a/template/interpolate/funcs_test.go +++ b/template/interpolate/funcs_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/interpolate/i.go b/template/interpolate/i.go index 8ad4e50df..ef092695f 100644 --- a/template/interpolate/i.go +++ b/template/interpolate/i.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/interpolate/i_test.go b/template/interpolate/i_test.go index a678afbc4..a71e105a3 100644 --- a/template/interpolate/i_test.go +++ b/template/interpolate/i_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/interpolate/parse.go b/template/interpolate/parse.go index b18079510..a4c9bfcb3 100644 --- a/template/interpolate/parse.go +++ b/template/interpolate/parse.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/interpolate/parse_test.go b/template/interpolate/parse_test.go index abe499e54..916e89eca 100644 --- a/template/interpolate/parse_test.go +++ b/template/interpolate/parse_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/interpolate/render.go b/template/interpolate/render.go index 7893e8745..64f0d258a 100644 --- a/template/interpolate/render.go +++ b/template/interpolate/render.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/interpolate/render_test.go b/template/interpolate/render_test.go index ae9ff2474..f6d98221e 100644 --- a/template/interpolate/render_test.go +++ b/template/interpolate/render_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package interpolate import ( diff --git a/template/parse.go b/template/parse.go index 5d1f04cc1..4fae27f5d 100644 --- a/template/parse.go +++ b/template/parse.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package template import ( diff --git a/template/parse_test.go b/template/parse_test.go index b79dc59f2..f79ca665d 100644 --- a/template/parse_test.go +++ b/template/parse_test.go @@ -1,5 +1,7 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:build !windows -// +build !windows package template diff --git a/template/template.go b/template/template.go index d7f0eb981..1118d061e 100644 --- a/template/template.go +++ b/template/template.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + //go:generate packer-sdc mapstructure-to-hcl2 -type Provisioner package template diff --git a/template/template_test.go b/template/template_test.go index 7dc5b87d6..d4cd84812 100644 --- a/template/template_test.go +++ b/template/template_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package template import ( diff --git a/test-fixtures/floppies/foo.ps1 b/test-fixtures/floppies/foo.ps1 index 672daeb89..8c70081fb 100644 --- a/test-fixtures/floppies/foo.ps1 +++ b/test-fixtures/floppies/foo.ps1 @@ -1 +1,4 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + Write-Host "I am a floppy with some Powershell" \ No newline at end of file diff --git a/tmp/tmp.go b/tmp/tmp.go index 147673b9f..9c6e72a26 100644 --- a/tmp/tmp.go +++ b/tmp/tmp.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package tmp provides temporary directory helpers. // // tmp stores temporary items in the system's @@ -14,7 +17,6 @@ package tmp import ( - "io/ioutil" "os" ) @@ -28,7 +30,7 @@ var tmpDir = os.TempDir() // It is the caller's responsibility // to remove the file when no longer needed. func Dir(prefix string) (string, error) { - return ioutil.TempDir(tmpDir, prefix) + return os.MkdirTemp(tmpDir, prefix) } // File creates a new temporary file in the system temporary @@ -42,5 +44,5 @@ func Dir(prefix string) (string, error) { // to find the pathname of the file. It is the caller's responsibility // to remove the file when no longer needed. func File(pattern string) (*os.File, error) { - return ioutil.TempFile(tmpDir, pattern) + return os.CreateTemp(tmpDir, pattern) } diff --git a/useragent/useragent.go b/useragent/useragent.go index bbb72f47b..dedff0dbe 100644 --- a/useragent/useragent.go +++ b/useragent/useragent.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package useragent creates a user agent for builders to use when calling out // to cloud APIs or other addresses. package useragent diff --git a/useragent/useragent_test.go b/useragent/useragent_test.go index 639e1b4fb..f3b74a286 100644 --- a/useragent/useragent_test.go +++ b/useragent/useragent_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package useragent import ( diff --git a/uuid/uuid.go b/uuid/uuid.go index bf5d922ab..10f705adb 100644 --- a/uuid/uuid.go +++ b/uuid/uuid.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package uuid provides helper functions for creating time-ordered UUIDs. package uuid diff --git a/uuid/uuid_test.go b/uuid/uuid_test.go index 8a853f1be..5588f62ee 100644 --- a/uuid/uuid_test.go +++ b/uuid/uuid_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package uuid import ( diff --git a/version/version.go b/version/version.go index 98973aea4..53a08fa4d 100644 --- a/version/version.go +++ b/version/version.go @@ -1,9 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + // Package version helps plugin creators set and track the plugin version using // the same convenience functions used by the Packer core. package version import ( - "bytes" "fmt" "github.com/hashicorp/go-version" @@ -13,36 +15,78 @@ import ( var GitCommit string // Package version helps plugin creators set and track the sdk version using -var Version = "0.3.2" +var Version = "0.5.4" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release // such as "dev" (in development), "beta", "rc1", etc. var VersionPrerelease = "" +// The metadata for the version, this is optional information to add around +// a particular release. +// +// This has no impact on the ordering of plugins, and is ignored for non-human eyes. +var VersionMetadata = "" + // SDKVersion is used by the plugin set to allow Packer to recognize // what version of the sdk the plugin is. -var SDKVersion = InitializePluginVersion(Version, VersionPrerelease) +var SDKVersion = NewPluginVersion(Version, VersionPrerelease, VersionMetadata) // InitializePluginVersion initializes the SemVer and returns a version var. -// If the provided "version" string is not valid, the call to version.Must -// will panic. Therefore, this function should always be called in a package -// init() function to make sure that plugins are following proper semantic -// versioning and to make sure that plugins which aren't following proper -// semantic versioning crash immediately rather than later. +// +// Deprecated: InitializePluginVersion does not support metadata out of the +// box, and should be replaced by either NewPluginVersion or NewRawVersion. func InitializePluginVersion(vers, versionPrerelease string) *PluginVersion { - if vers == "" { + return NewPluginVersion(vers, versionPrerelease, "") +} + +// NewRawVersion is made for more freeform version strings. It won't accept +// much more than what `NewPluginVersion` already does, but is another +// convenient form to create a version if preferred. +// +// As NewRawVersion, if the version is invalid, it will panic. +func NewRawVersion(rawSemVer string) *PluginVersion { + vers := version.Must(version.NewVersion(rawSemVer)) + + if len(vers.Segments()) != 3 { + panic(fmt.Sprintf("versions should only have 3 segments, %q had %d", rawSemVer, len(vers.Segments()))) + } + + return &PluginVersion{ + version: vers.Core().String(), + versionPrerelease: vers.Prerelease(), + versionMetadata: vers.Metadata(), + semVer: vers, + } +} + +// NewPluginVersion initializes the SemVer and returns a PluginVersion from it. +// If the provided "version" string is not valid, the call to version.Must +// will panic. +// +// This function should always be called in a package init() function to make +// sure that plugins are following proper semantic versioning and to make sure +// that plugins which aren't following proper semantic versioning crash +// immediately rather than later. +// +// If the core version number is empty, it will default to 0.0.0. +func NewPluginVersion(vers, versionPrerelease, versionMetadata string) *PluginVersion { + var versionRawString = vers + + if versionRawString == "" { // Defaults to "0.0.0". Useful when binary is created for development purpose. - vers = "0.0.0" + versionRawString = "0.0.0" } - pv := PluginVersion{ - version: vers, - versionPrerelease: versionPrerelease, + + if versionPrerelease != "" { + versionRawString = fmt.Sprintf("%s-%s", versionRawString, versionPrerelease) + } + + if versionMetadata != "" { + versionRawString = fmt.Sprintf("%s+%s", versionRawString, versionMetadata) } - // This call initializes the SemVer to make sure that if Packer crashes due - // to an invalid SemVer it's at the very beginning of the Packer run. - pv.semVer = version.Must(version.NewVersion(vers)) - return &pv + + return NewRawVersion(versionRawString) } type PluginVersion struct { @@ -52,31 +96,33 @@ type PluginVersion struct { // then it means that it is a final release. Otherwise, this is a pre-release // such as "dev" (in development), "beta", "rc1", etc. versionPrerelease string + // Extra metadata that can be part of the version. + // + // This is legal in semver, and has to be the last part of the version + // string, starting with a `+`. + versionMetadata string // The Semantic Version of the plugin. Used for version constraint comparisons semVer *version.Version } +func (p *PluginVersion) SetMetadata(meta string) { + p.versionMetadata = meta +} + func (p *PluginVersion) FormattedVersion() string { - var versionString bytes.Buffer - fmt.Fprintf(&versionString, "%s", p.version) - if p.versionPrerelease != "" { - fmt.Fprintf(&versionString, "-%s", p.versionPrerelease) - - if GitCommit != "" { - fmt.Fprintf(&versionString, " (%s)", GitCommit) - } + versionString := p.semVer.String() + + // Given there could be some metadata already, we add the commit to the + // reported version as part of the metadata, with a `-` spearator if + // the metadata is already there, otherwise we make it the metadata + if GitCommit != "" { + versionString = fmt.Sprintf("%s (%s)", versionString, GitCommit) } - return versionString.String() + return versionString } func (p *PluginVersion) SemVer() *version.Version { - if p.semVer != nil { - // SemVer is an instance of version.Version. This has the secondary - // benefit of verifying during tests and init time that our version is a - // proper semantic version, which should always be the case. - p.semVer = version.Must(version.NewVersion(p.version)) - } return p.semVer } @@ -88,10 +134,11 @@ func (p *PluginVersion) GetVersionPrerelease() string { return p.versionPrerelease } +func (p *PluginVersion) GetMetadata() string { + return p.versionMetadata +} + // String returns the complete version string, including prerelease func (p *PluginVersion) String() string { - if p.versionPrerelease != "" { - return fmt.Sprintf("%s-%s", p.version, p.versionPrerelease) - } - return p.version + return p.semVer.String() } diff --git a/version/version_test.go b/version/version_test.go new file mode 100644 index 000000000..c6c175f0b --- /dev/null +++ b/version/version_test.go @@ -0,0 +1,124 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package version + +import ( + "fmt" + "testing" +) + +func Test_PluginVersionCreate(t *testing.T) { + tests := []struct { + name string + coreVersion string + preVersion string + metaVersion string + expectError bool + expectVersionString string + }{ + { + "Valid semver core only version", + "1.0.0", + "", + "", + false, + "1.0.0", + }, + { + "Valid semver, should get canonical version", + "01.001.001", + "", + "", + false, + "1.1.1", + }, + { + "Valid semver with prerelease, should get canonical version", + "1.001.010", + "dev", + "", + false, + "1.1.10-dev", + }, + { + "Valid semver with metadata, should get canonical version", + "1.001.010", + "", + "123abcdef", + false, + "1.1.10+123abcdef", + }, + { + "Valid semver with prerelease and metadata, should get canonical version", + "1.001.010", + "dev", + "123abcdef", + false, + "1.1.10-dev+123abcdef", + }, + { + "Invalid version, should fail", + ".1.1", + "", + "", + true, + "", + }, + { + "4-parts version, should not be accepted", + "1.1.1.1", + "", + "", + true, + "", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + defer func() { + panicMsg := recover() + if !tt.expectError && panicMsg != nil { + t.Errorf("creating version panicked, should not have.") + } + + if tt.expectError && panicMsg == nil { + t.Errorf("creating version should have panicked, but did not.") + } + + if panicMsg != nil { + t.Logf("panic message was: %v", panicMsg) + } + }() + + ver := NewPluginVersion(tt.coreVersion, tt.preVersion, tt.metaVersion) + verStr := ver.String() + if verStr != tt.expectVersionString { + t.Errorf("string format mismatch, version created is %q, expected %q", verStr, tt.expectVersionString) + } + }) + } +} + +func TestFormattedVersionString(t *testing.T) { + GitCommit = "abcdef12345" + defer func() { + GitCommit = "" + }() + + expectedVersion := fmt.Sprintf("1.0.0-dev (%s)", GitCommit) + + ver := InitializePluginVersion("1.0.0", "dev") + formatted := ver.FormattedVersion() + if formatted != expectedVersion { + t.Errorf("Expected formatted version %q; got %q", expectedVersion, formatted) + } + + expectedVersion = fmt.Sprintf("1.0.0-dev+meta (%s)", GitCommit) + ver = NewPluginVersion("1.0.0", "dev", "meta") + formatted = ver.FormattedVersion() + if formatted != expectedVersion { + t.Errorf("Expected formatted version %q; got %q", expectedVersion, formatted) + } +}