Skip to content

Commit

Permalink
Add deprecation notice to WriteLines and ReadLines and update depreca…
Browse files Browse the repository at this point in the history
…tion notices on other functions to use similar formatting
  • Loading branch information
MatthewJohn committed May 31, 2024
1 parent 936961f commit f9c2f0e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion lib/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ func createDirIfNotExist(dir string) {
}

// WriteLines : writes into file
//
// Deprecated: This method has been deprecated and will be removed in v2.0.0
func WriteLines(lines []string, path string) (err error) {
var (
file *os.File
Expand All @@ -132,7 +134,8 @@ func WriteLines(lines []string, path string) (err error) {
}

// ReadLines : Read a whole file into the memory and store it as array of lines
// @TODO This isn't used - should we keep it?
//
// Deprecated: This method has been deprecated and will be removed in v2.0.0
func ReadLines(path string) (lines []string, err error) {
var (
file *os.File
Expand Down
16 changes: 10 additions & 6 deletions lib/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ func installableBinLocation(product Product, userBinPath string) string {
}

// InstallLatestVersion install latest stable tf version
// This is a legacy method that is deprecated in favor of InstallLatestProductVersion
//
// Deprecated: This function has been deprecated in favor of InstallLatestProductVersion and will be removed in v2.0.0
func InstallLatestVersion(dryRun bool, customBinaryPath, installPath string, mirrorURL string) {
product := getLegacyProduct()
InstallLatestProductVersion(product, dryRun, customBinaryPath, installPath, mirrorURL)
Expand All @@ -203,7 +204,8 @@ func InstallLatestProductVersion(product Product, dryRun bool, customBinaryPath,
}

// InstallLatestImplicitVersion install latest - argument (version) must be provided
// This is a legacy method that is deprecated in favor of InstallLatestProductImplicitVersion
//
// Deprecated: This function has been deprecated in favor of InstallLatestProductImplicitVersion and will be removed in v2.0.0
func InstallLatestImplicitVersion(dryRun bool, requestedVersion, customBinaryPath, installPath string, mirrorURL string, preRelease bool) {
product := getLegacyProduct()
InstallLatestProductImplicitVersion(product, dryRun, requestedVersion, customBinaryPath, installPath, mirrorURL, preRelease)
Expand All @@ -224,7 +226,8 @@ func InstallLatestProductImplicitVersion(product Product, dryRun bool, requested
}

// InstallVersion install Terraform product
// This is a legacy method that is deprecated in favor of InstallProductVersion
//
// Deprecated: This function has been deprecated in favor of InstallProductVersion and will be removed in v2.0.0
func InstallVersion(dryRun bool, version, customBinaryPath, installPath, mirrorURL string) {
product := getLegacyProduct()
InstallProductVersion(product, dryRun, version, customBinaryPath, installPath, mirrorURL)
Expand Down Expand Up @@ -268,9 +271,10 @@ func InstallProductVersion(product Product, dryRun bool, version, customBinaryPa
}

// InstallProductOption displays & installs tf version
// This is a legacy method that will be deprecated in favor of InstallProductOption
/* listAll = true - all versions including beta and rc will be displayed */
/* listAll = false - only official stable release are displayed */
// listAll = true - all versions including beta and rc will be displayed */
// listAll = false - only official stable release are displayed */
//
// Deprecated: This function has been deprecated in favor of InstallProductOption and will be removed in v2.0.0
func InstallOption(listAll, dryRun bool, customBinaryPath, installPath string, mirrorURL string) {
product := getLegacyProduct()
InstallProductOption(product, listAll, dryRun, customBinaryPath, installPath, mirrorURL)
Expand Down
3 changes: 2 additions & 1 deletion lib/symlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func CheckSymlink(symlinkPath string) bool {
}

// ChangeSymlink : move symlink to existing binary for Terraform
// This function has been deprecated in favor of ChangeProductSymlink
//
// Deprecated: This function has been deprecated in favor of ChangeProductSymlink and will be removed in v2.0.0
func ChangeSymlink(binVersionPath string, binPath string) {
product := getLegacyProduct()
ChangeProductSymlink(product, binVersionPath, binPath)
Expand Down

0 comments on commit f9c2f0e

Please sign in to comment.