deps: Remove github.com/andybalholm/crlf (#289)
Replaced via trivial `strings` handling as the strings are not large.
diff --git a/go.mod b/go.mod
index 03262ea..dc47e30 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,6 @@
go 1.17
require (
- github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f
github.com/google/go-cmp v0.5.7
github.com/hashicorp/go-version v1.4.0
github.com/hashicorp/hc-install v0.3.1
diff --git a/go.sum b/go.sum
index bada279..96819fc 100644
--- a/go.sum
+++ b/go.sum
@@ -5,8 +5,6 @@
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
-github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f h1:NNJE6p4LchkmNfNskDUaSbrwxZzr7t2/lj2aS+q4oF0=
-github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
diff --git a/tfexec/internal/e2etest/show_test.go b/tfexec/internal/e2etest/show_test.go
index 5556e64..c8636d2 100644
--- a/tfexec/internal/e2etest/show_test.go
+++ b/tfexec/internal/e2etest/show_test.go
@@ -5,11 +5,11 @@
"encoding/json"
"errors"
"io/ioutil"
+ "os"
"runtime"
"strings"
"testing"
- "github.com/andybalholm/crlf"
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/go-version"
tfjson "github.com/hashicorp/terraform-json"
@@ -588,8 +588,7 @@
t.Skip("plan file created in 0.12 on Linux is not compatible with other systems")
}
- // crlf will standardize our line endings for us
- f, err := crlf.Open("testdata/non_default_planfile_012/human_readable_output.txt")
+ f, err := os.Open("testdata/non_default_planfile_012/human_readable_output.txt")
if err != nil {
t.Fatal(err)
}
@@ -609,7 +608,7 @@
t.Fatal(err)
}
- if diff := cmp.Diff(strings.TrimSpace(actual), strings.TrimSpace(string(expected))); diff != "" {
+ if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(string(expected))); diff != "" {
t.Fatalf("unexpected difference: %s", diff)
}
})
@@ -617,8 +616,7 @@
func TestShowPlanFileRaw013(t *testing.T) {
runTestVersions(t, []string{testutil.Latest013}, "non_default_planfile_013", func(t *testing.T, tfv *version.Version, tf *tfexec.Terraform) {
- // crlf will standardize our line endings for us
- f, err := crlf.Open("testdata/non_default_planfile_013/human_readable_output.txt")
+ f, err := os.Open("testdata/non_default_planfile_013/human_readable_output.txt")
if err != nil {
t.Fatal(err)
}
@@ -638,7 +636,7 @@
t.Fatal(err)
}
- if diff := cmp.Diff(strings.TrimSpace(actual), strings.TrimSpace(string(expected))); diff != "" {
+ if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(string(expected))); diff != "" {
t.Fatalf("unexpected difference: %s", diff)
}
})
@@ -646,8 +644,7 @@
func TestShowPlanFileRaw014(t *testing.T) {
runTestVersions(t, []string{testutil.Latest014}, "non_default_planfile_014", func(t *testing.T, tfv *version.Version, tf *tfexec.Terraform) {
- // crlf will standardize our line endings for us
- f, err := crlf.Open("testdata/non_default_planfile_013/human_readable_output.txt")
+ f, err := os.Open("testdata/non_default_planfile_013/human_readable_output.txt")
if err != nil {
t.Fatal(err)
}
@@ -666,7 +663,7 @@
if err != nil {
t.Fatal(err)
}
- if diff := cmp.Diff(strings.TrimSpace(actual), strings.TrimSpace(string(expected))); diff != "" {
+ if diff := cmp.Diff(normalizePlanOutput(actual), normalizePlanOutput(string(expected))); diff != "" {
t.Fatalf("unexpected difference: %s", diff)
}
})
@@ -739,3 +736,14 @@
}
})
}
+
+// Since our plan strings are not large, prefer simple cross-platform
+// normalization handling over pulling in a dependency.
+func normalizePlanOutput(str string) string {
+ // Ignore any extra newlines at the beginning or end of output
+ str = strings.TrimSpace(str)
+ // Normalize CRLF to LF for cross-platform testing
+ str = strings.Replace(str, "\r\n", "\n", -1)
+
+ return str
+}