Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hashicorp/go-getter
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.7.6
Choose a base ref
...
head repository: hashicorp/go-getter
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.7.7
Choose a head ref
  • 12 commits
  • 127 files changed
  • 5 contributors

Commits on Aug 19, 2024

  1. [COMPLIANCE] Add Copyright and License Headers

    hashicorp-copywrite[bot] authored Aug 19, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Copy the full SHA
    73b1e2a View commit details

Commits on Oct 9, 2024

  1. Copy the full SHA
    768e85f View commit details

Commits on Nov 6, 2024

  1. Merge pull request #504 from hashicorp/james-warren0/git-bad-ref-clea…

    …n-up
    
    Clean up git repo on disk when the ref checkout fails
    james-warren0 authored Nov 6, 2024
    Copy the full SHA
    b19f8af View commit details

Commits on Nov 7, 2024

  1. Merge pull request #409 from hashicorp/compliance/add-headers

    [COMPLIANCE] Add Copyright and License Headers
    james-warren0 authored Nov 7, 2024
    Copy the full SHA
    6077ad5 View commit details

Commits on Nov 18, 2024

  1. Copy the full SHA
    7edd4e0 View commit details
  2. Merge pull request #505 from mukeshjc/main

    Add CODEOWNERS file in .github/CODEOWNERS
    mukeshjc authored Nov 18, 2024
    Copy the full SHA
    842d6c3 View commit details

Commits on Jan 9, 2025

  1. Copy the full SHA
    2e56c18 View commit details
  2. Merge pull request #513 from hashicorp/Vulnerability_Fix_v1

    IND-1804 Bump up dependencies to remediate vulnerabiities
    mohanmanikanta2299 authored Jan 9, 2025
    Copy the full SHA
    6552f72 View commit details
  3. Copy the full SHA
    d315d97 View commit details
  4. Merge pull request #514 from hashicorp/Vulnerability_Fix_v1

    Updating arguments in github release CI
    mohanmanikanta2299 authored Jan 9, 2025
    Copy the full SHA
    81c6950 View commit details
  5. Copy the full SHA
    0f05341 View commit details
  6. Merge pull request #515 from hashicorp/Vulnerability_Fix_v1

    Updating .goreleaser.yml file with valid version
    mohanmanikanta2299 authored Jan 9, 2025
    Copy the full SHA
    7dddd13 View commit details
Showing with 1,187 additions and 41 deletions.
  1. +13 −0 .github/CODEOWNERS
  2. +0 −2 .github/workflows/go-getter.yml
  3. +1 −1 .github/workflows/release.yml
  4. +6 −1 .goreleaser.yml
  5. +3 −0 checksum.go
  6. +3 −0 client.go
  7. +3 −0 client_mode.go
  8. +3 −0 client_option.go
  9. +3 −0 client_option_insecure.go
  10. +3 −0 client_option_progress.go
  11. +3 −0 client_option_progress_test.go
  12. +3 −0 cmd/go-getter/main.go
  13. +3 −0 cmd/go-getter/progress_tracking.go
  14. +3 −0 common.go
  15. +3 −0 copy_dir.go
  16. +3 −0 decompress.go
  17. +3 −0 decompress_bzip2.go
  18. +3 −0 decompress_bzip2_test.go
  19. +3 −0 decompress_gzip.go
  20. +3 −0 decompress_gzip_test.go
  21. +3 −0 decompress_tar.go
  22. +3 −0 decompress_tar_test.go
  23. +3 −0 decompress_tbz2.go
  24. +3 −0 decompress_tbz2_test.go
  25. +3 −0 decompress_test.go
  26. +3 −0 decompress_testing.go
  27. +3 −0 decompress_tgz.go
  28. +3 −0 decompress_tgz_test.go
  29. +3 −0 decompress_txz.go
  30. +3 −0 decompress_txz_test.go
  31. +3 −0 decompress_tzst.go
  32. +3 −0 decompress_tzst_test.go
  33. +3 −0 decompress_xz.go
  34. +3 −0 decompress_xz_test.go
  35. +3 −0 decompress_zip.go
  36. +3 −0 decompress_zip_test.go
  37. +3 −0 decompress_zstd.go
  38. +3 −0 decompress_zstd_test.go
  39. +3 −0 detect.go
  40. +3 −0 detect_bitbucket.go
  41. +3 −0 detect_bitbucket_test.go
  42. +3 −0 detect_file.go
  43. +3 −0 detect_file_test.go
  44. +3 −0 detect_file_unix_test.go
  45. +3 −0 detect_gcs.go
  46. +3 −0 detect_gcs_test.go
  47. +3 −0 detect_git.go
  48. +3 −0 detect_git_test.go
  49. +3 −0 detect_github.go
  50. +3 −0 detect_github_test.go
  51. +3 −0 detect_gitlab.go
  52. +3 −0 detect_gitlab_test.go
  53. +3 −0 detect_s3.go
  54. +3 −0 detect_s3_test.go
  55. +3 −0 detect_ssh.go
  56. +3 −0 detect_test.go
  57. +3 −0 folder_storage.go
  58. +3 −0 folder_storage_test.go
  59. +3 −0 get.go
  60. +3 −0 get_base.go
  61. +3 −0 get_file.go
  62. +3 −0 get_file_copy.go
  63. +3 −0 get_file_copy_test.go
  64. +3 −0 get_file_test.go
  65. +3 −0 get_file_unix.go
  66. +3 −0 get_file_windows.go
  67. +3 −0 get_gcs.go
  68. +3 −0 get_gcs_test.go
  69. +9 −1 get_git.go
  70. +35 −0 get_git_test.go
  71. +3 −0 get_hg.go
  72. +3 −0 get_hg_test.go
  73. +3 −0 get_http.go
  74. +3 −0 get_http_test.go
  75. +3 −0 get_mock.go
  76. +3 −0 get_s3.go
  77. +3 −0 get_s3_test.go
  78. +3 −0 get_test.go
  79. +6 −7 go.mod
  80. +760 −29 go.sum
  81. +3 −0 helper/url/url.go
  82. +3 −0 helper/url/url_test.go
  83. +3 −0 helper/url/url_unix.go
  84. +3 −0 helper/url/url_windows.go
  85. +3 −0 module_test.go
  86. +3 −0 netrc.go
  87. +3 −0 netrc_test.go
  88. +3 −0 source.go
  89. +3 −0 source_test.go
  90. +3 −0 storage.go
  91. +3 −0 testdata/basic%2Ftest/foo/main.tf
  92. +3 −0 testdata/basic%2Ftest/main.tf
  93. +3 −0 testdata/basic%2Ftest/subdir/sub.tf
  94. +3 −0 testdata/basic-dot/.test/foo.tf
  95. +3 −0 testdata/basic-dot/main.tf
  96. +3 −0 testdata/basic-hg/main.tf
  97. +3 −0 testdata/basic-parent/a/a.tf
  98. +3 −0 testdata/basic-parent/c/c.tf
  99. +3 −0 testdata/basic-parent/main.tf
  100. +3 −0 testdata/basic-subdir/foo/sub/baz/main.tf
  101. +3 −0 testdata/basic-subdir/foo/sub/main.tf
  102. +3 −0 testdata/basic-subdir/main.tf
  103. +3 −0 testdata/basic-tgz/main.tf
  104. +3 −0 testdata/basic/foo/main.tf
  105. +3 −0 testdata/basic/main.tf
  106. +3 −0 testdata/basic/subdir/sub.tf
  107. +3 −0 testdata/child/foo/bar/main.tf
  108. +3 −0 testdata/child/foo/main.tf
  109. +3 −0 testdata/child/main.tf
  110. +3 −0 testdata/dup/foo/main.tf
  111. +3 −0 testdata/dup/main.tf
  112. +3 −0 testdata/validate-bad-output-to-module/child/main.tf
  113. +3 −0 testdata/validate-bad-output-to-module/main.tf
  114. +3 −0 testdata/validate-bad-output/child/main.tf
  115. +3 −0 testdata/validate-bad-output/main.tf
  116. +3 −0 testdata/validate-bad-var/child/main.tf
  117. +3 −0 testdata/validate-bad-var/main.tf
  118. +3 −0 testdata/validate-child-bad/child/main.tf
  119. +3 −0 testdata/validate-child-bad/main.tf
  120. +3 −0 testdata/validate-child-good/child/main.tf
  121. +3 −0 testdata/validate-child-good/main.tf
  122. +3 −0 testdata/validate-required-var/child/main.tf
  123. +3 −0 testdata/validate-required-var/main.tf
  124. +3 −0 testdata/validate-root-bad/main.tf
  125. +3 −0 url.go
  126. +3 −0 url_test.go
  127. +3 −0 util_test.go
13 changes: 13 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Each line is a file pattern followed by one or more owners.
# More on CODEOWNERS files: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

# Default owner
* @hashicorp/team-ip-compliance

# Add override rules below. Each line is a file/folder pattern followed by one or more owners.
# Being an owner means those groups or individuals will be added as reviewers to PRs affecting
# those areas of the code.
# Examples:
# /docs/ @docs-team
# *.js @js-team
# *.go @go-team
2 changes: 0 additions & 2 deletions .github/workflows/go-getter.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ jobs:
strategy:
matrix:
go-version:
- 1.17
- 1.18
- 1.19
permissions:
@@ -92,7 +91,6 @@ jobs:
strategy:
matrix:
go-version:
- 1.17
- 1.18
- 1.19
permissions:
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ jobs:
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
version: latest
args: release --skip-validate --timeout "60m"
args: release --skip=validate --timeout "60m"
env:
PGP_KEY_ID: ${{ secrets.PGP_KEY_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 6 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

version: 2

env:
- GOPRIVATE=github.com/hashicorp

@@ -46,4 +51,4 @@ signs:
artifacts: checksum

changelog:
skip: true
disable: true
3 changes: 3 additions & 0 deletions checksum.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions client_mode.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

// ClientMode is the mode that the client operates in.
3 changes: 3 additions & 0 deletions client_option.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions client_option_insecure.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

// WithInsecure allows for a user to avoid
3 changes: 3 additions & 0 deletions client_option_progress.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions client_option_progress_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions cmd/go-getter/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package main

import (
3 changes: 3 additions & 0 deletions cmd/go-getter/progress_tracking.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package main

import (
3 changes: 3 additions & 0 deletions common.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions copy_dir.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_bzip2.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_bzip2_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_gzip.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_gzip_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tar.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tar_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tbz2.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tbz2_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_testing.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tgz.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tgz_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_txz.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_txz_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tzst.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_tzst_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_xz.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_xz_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_zip.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_zip_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_zstd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions decompress_zstd_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_bitbucket.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_bitbucket_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_file.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_file_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_file_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// +build test unix

package getter
3 changes: 3 additions & 0 deletions detect_gcs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_gcs_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_git.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

// GitDetector implements Detector to detect Git SSH URLs such as
3 changes: 3 additions & 0 deletions detect_git_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_github.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_github_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_gitlab.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_gitlab_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_s3.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_s3_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_ssh.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions detect_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions folder_storage.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions folder_storage_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// getter is a package for downloading files or directories from a variety of
// protocols.
//
3 changes: 3 additions & 0 deletions get_base.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import "context"
3 changes: 3 additions & 0 deletions get_file.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_file_copy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_file_copy_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_file_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_file_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// +build !windows

package getter
3 changes: 3 additions & 0 deletions get_file_windows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// +build windows

package getter
3 changes: 3 additions & 0 deletions get_gcs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_gcs_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
10 changes: 9 additions & 1 deletion get_git.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
@@ -223,7 +226,12 @@ func (g *GitGetter) clone(ctx context.Context, dst, sshKeyFile string, u *url.UR
// If we didn't add --depth and --branch above then we will now be
// on the remote repository's default branch, rather than the selected
// ref, so we'll need to fix that before we return.
return g.checkout(ctx, dst, originalRef)
err := g.checkout(ctx, dst, originalRef)
if err != nil {
// Clean up git repository on disk
_ = os.RemoveAll(dst)
return err
}
}
return nil
}
35 changes: 35 additions & 0 deletions get_git_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
@@ -984,6 +987,38 @@ func TestGitGetter_BadGitDirName(t *testing.T) {
}
}

func TestGitGetter_BadRef(t *testing.T) {
if !testHasGit {
t.Log("git not found, skipping")
t.Skip()
}

ctx := context.Background()
g := new(GitGetter)
dst := tempDir(t)

url, err := url.Parse("https://github.com/hashicorp/go-getter")
if err != nil {
t.Fatal(err)
}

_, err = os.Stat(dst)
if err != nil && !os.IsNotExist(err) {
t.Fatalf(err.Error())
}

// Clone a repository with non-existent ref
err = g.clone(ctx, dst, "", url, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0)
if err == nil {
t.Fatalf(err.Error())
}

// Expect that the dst was cleaned up after failed ref checkout
if _, err := os.Stat(dst); !os.IsNotExist(err) {
t.Fatalf("cloned repository still exists after bad ref checkout")
}
}

// gitRepo is a helper struct which controls a single temp git repo.
type gitRepo struct {
t *testing.T
3 changes: 3 additions & 0 deletions get_hg.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_hg_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_http.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_http_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_mock.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_s3.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_s3_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions get_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
module github.com/hashicorp/go-getter

require (
cloud.google.com/go/iam v0.5.0 // indirect
cloud.google.com/go/storage v1.27.0
cloud.google.com/go/storage v1.29.0
github.com/aws/aws-sdk-go v1.44.122
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d
github.com/cheggaaa/pb v1.0.27
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-safetemp v1.0.0
github.com/hashicorp/go-version v1.6.0
github.com/klauspost/compress v1.15.11
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-testing-interface v1.14.1
github.com/ulikunitz/xz v0.5.10
golang.org/x/oauth2 v0.1.0
google.golang.org/api v0.100.0
google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.7.0
google.golang.org/api v0.114.0
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/cheggaaa/pb.v1 v1.0.27 // indirect
)

789 changes: 760 additions & 29 deletions go.sum

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions helper/url/url.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package url

import (
3 changes: 3 additions & 0 deletions helper/url/url_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package url

import (
3 changes: 3 additions & 0 deletions helper/url/url_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// +build !windows

package url
3 changes: 3 additions & 0 deletions helper/url/url_windows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package url

import (
3 changes: 3 additions & 0 deletions module_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions netrc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions netrc_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions source.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions source_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions storage.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

// Storage is an interface that knows how to lookup downloaded directories
3 changes: 3 additions & 0 deletions testdata/basic%2Ftest/foo/main.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello
3 changes: 3 additions & 0 deletions testdata/basic%2Ftest/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello

module "foo" {
3 changes: 3 additions & 0 deletions testdata/basic%2Ftest/subdir/sub.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

3 changes: 3 additions & 0 deletions testdata/basic-dot/.test/foo.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hi
3 changes: 3 additions & 0 deletions testdata/basic-dot/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello

module "foo" {
3 changes: 3 additions & 0 deletions testdata/basic-hg/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello

module "foo" {
3 changes: 3 additions & 0 deletions testdata/basic-parent/a/a.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "b" {
source = "../c"
}
3 changes: 3 additions & 0 deletions testdata/basic-parent/c/c.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello
3 changes: 3 additions & 0 deletions testdata/basic-parent/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "a" {
source = "./a"
}
3 changes: 3 additions & 0 deletions testdata/basic-subdir/foo/sub/baz/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

3 changes: 3 additions & 0 deletions testdata/basic-subdir/foo/sub/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "bar" {
source = "./baz"
}
3 changes: 3 additions & 0 deletions testdata/basic-subdir/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "foo" {
source = "./foo//sub"
}
3 changes: 3 additions & 0 deletions testdata/basic-tgz/main.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello
3 changes: 3 additions & 0 deletions testdata/basic/foo/main.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello
3 changes: 3 additions & 0 deletions testdata/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello

module "foo" {
3 changes: 3 additions & 0 deletions testdata/basic/subdir/sub.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

3 changes: 3 additions & 0 deletions testdata/child/foo/bar/main.tf
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello

3 changes: 3 additions & 0 deletions testdata/child/foo/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello

module "bar" {
3 changes: 3 additions & 0 deletions testdata/child/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Hello

module "foo" {
3 changes: 3 additions & 0 deletions testdata/dup/foo/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

3 changes: 3 additions & 0 deletions testdata/dup/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "foo" {
source = "./foo"
}
3 changes: 3 additions & 0 deletions testdata/validate-bad-output-to-module/child/main.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "memory" { default = "foo" }
3 changes: 3 additions & 0 deletions testdata/validate-bad-output-to-module/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "child" {
source = "./child"
}
3 changes: 3 additions & 0 deletions testdata/validate-bad-output/child/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

3 changes: 3 additions & 0 deletions testdata/validate-bad-output/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "child" {
source = "./child"
}
3 changes: 3 additions & 0 deletions testdata/validate-bad-var/child/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

3 changes: 3 additions & 0 deletions testdata/validate-bad-var/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "child" {
source = "./child"

3 changes: 3 additions & 0 deletions testdata/validate-child-bad/child/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Duplicate resources
resource "aws_instance" "foo" {}
resource "aws_instance" "foo" {}
3 changes: 3 additions & 0 deletions testdata/validate-child-bad/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "foo" {
source = "./child"
}
3 changes: 3 additions & 0 deletions testdata/validate-child-good/child/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "memory" {}

output "result" {}
3 changes: 3 additions & 0 deletions testdata/validate-child-good/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "child" {
source = "./child"
memory = "1G"
3 changes: 3 additions & 0 deletions testdata/validate-required-var/child/main.tf
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

variable "memory" {}
3 changes: 3 additions & 0 deletions testdata/validate-required-var/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

module "child" {
source = "./child"
}
3 changes: 3 additions & 0 deletions testdata/validate-root-bad/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# Duplicate resources
resource "aws_instance" "foo" {}
resource "aws_instance" "foo" {}
3 changes: 3 additions & 0 deletions url.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import "net/url"
3 changes: 3 additions & 0 deletions url_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (
3 changes: 3 additions & 0 deletions util_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package getter

import (