Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[testdata/*]
trim_trailing_whitespace = false

[*.md]
indent_size = 4

Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
language: go

go:
- 1.23.x
- 1.24.x

os:
- osx
Expand Down
62 changes: 33 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,61 +1,65 @@
module github.com/goss-org/goss

go 1.22
go 1.24.0

toolchain go1.24.2

require (
github.com/Masterminds/sprig/v3 v3.3.0
github.com/achanda/go-sysctl v0.0.0-20160222034550-6be7678c45d2
github.com/blang/semver/v4 v4.0.0
github.com/cheekybits/genny v1.0.0
github.com/fatih/color v1.17.0
github.com/fatih/color v1.18.0
github.com/goss-org/GOnetstat v0.0.0-20230101144325-22be0bd9e64d
github.com/goss-org/go-ps v0.0.0-20230609005227-7b318e6a56e5
github.com/hashicorp/logutils v1.0.0
github.com/miekg/dns v1.1.61
github.com/moby/sys/mountinfo v0.7.1
github.com/oleiade/reflections v1.0.1
github.com/onsi/gomega v1.33.1
github.com/miekg/dns v1.1.68
github.com/moby/sys/mountinfo v0.7.2
github.com/oleiade/reflections v1.1.0
github.com/onsi/gomega v1.38.2
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.55.0
github.com/samber/lo v1.46.0
github.com/stretchr/testify v1.9.0
github.com/tidwall/gjson v1.17.1
github.com/urfave/cli v1.22.14
github.com/prometheus/client_golang v1.23.2
github.com/prometheus/common v0.66.1
github.com/samber/lo v1.51.0
github.com/stretchr/testify v1.11.1
github.com/tidwall/gjson v1.18.0
github.com/urfave/cli v1.22.17
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.1
)

require (
dario.cat/mergo v1.0.1 // indirect
dario.cat/mergo v1.0.2 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/procfs v0.17.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/mod v0.28.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/tools v0.37.0 // indirect
google.golang.org/protobuf v1.36.9 // indirect
)
144 changes: 77 additions & 67 deletions go.sum

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestMatchers(t *testing.T) {
t.Fatal(err)
}
actualOut := output.String()
actualOut = sanitizeOutput(actualOut)
actualOut = sanitizeTrailingWhitespace(sanitizeOutput(actualOut))

if *update {
os.WriteFile(outFile, []byte(actualOut), 0644)
Expand All @@ -71,7 +71,7 @@ func TestMatchers(t *testing.T) {
if err != nil {
t.Fatal(err)
}
wantOut := string(wantOutB)
wantOut := sanitizeTrailingWhitespace(string(wantOutB))
if actualOut != wantOut {
assert.Equal(t, wantOut, actualOut)
}
Expand All @@ -87,3 +87,8 @@ func sanitizeOutput(s string) string {
re := regexp.MustCompile(`\d\.\d\d\ds`)
return re.ReplaceAllString(s, "")
}

func sanitizeTrailingWhitespace(s string) string {
re := regexp.MustCompile(` +\n`)
return re.ReplaceAllString(s, "\n")
}
14 changes: 7 additions & 7 deletions testdata/out_matching_basic_failing.1.documentation
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ diff
@@ -1,2 +1,2 @@
-this is a test9
+this is a test1

Matching: basic_string_regexp: matches:
Expected
"this is a test"
Expand Down Expand Up @@ -153,10 +153,10 @@ not to be numerically eq
42
Matching: negated_basic_reader: matches:
Error
ContainElements matcher expects an array/slice/map. Got:
ContainElements matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:
<string>: foo bar
moo cow

Matching: negated_basic_string: matches:
Expected
"this is a test"
Expand Down Expand Up @@ -338,7 +338,7 @@ diff
@@ -1,2 +1,2 @@
-this is a test9
+this is a test1


Matching: basic_string_regexp: matches:
Expected
Expand Down Expand Up @@ -390,10 +390,10 @@ not to be numerically eq

Matching: negated_basic_reader: matches:
Error
ContainElements matcher expects an array/slice/map. Got:
ContainElements matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:
<string>: foo bar
moo cow


Matching: negated_basic_string: matches:
Expected
Expand Down Expand Up @@ -455,5 +455,5 @@ diff
-^this
+this is a test

Total Duration:
Total Duration:
Count: 27, Failed: 27, Skipped: 0
8 changes: 4 additions & 4 deletions testdata/out_matching_basic_failing.1.rspecish
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ diff
@@ -1,2 +1,2 @@
-this is a test9
+this is a test1


Matching: basic_string_regexp: matches:
Expected
Expand Down Expand Up @@ -177,10 +177,10 @@ not to be numerically eq

Matching: negated_basic_reader: matches:
Error
ContainElements matcher expects an array/slice/map. Got:
ContainElements matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got:
<string>: foo bar
moo cow


Matching: negated_basic_string: matches:
Expected
Expand Down Expand Up @@ -242,5 +242,5 @@ diff
-^this
+this is a test

Total Duration:
Total Duration:
Count: 27, Failed: 27, Skipped: 0
2 changes: 1 addition & 1 deletion testdata/out_matching_basic_failing.1.tap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ not ok 17 - Matching: negated_basic_array_consists_of: matches: Expected ["foo",
not ok 18 - Matching: negated_basic_array_contain_element: matches: Expected ["foo","bar","moo"] not to contain element matching "foo"
not ok 19 - Matching: negated_basic_array_matchers: matches: Expected ["foo","bar","moo"] to satisfy at least one of these matchers [{"not":{"contain-elements":["foo","bar"]}},{"not":{"contain-elements":["foo","bar"]}},{"not":["foo","bar","moo"]},{"not":{"consist-of":["foo",{"have-prefix":"m"},"bar"]}},{"not":{"contain-element":{"have-prefix":"b"}}}]
not ok 20 - Matching: negated_basic_int: matches: Expected 42 not to be numerically eq 42
not ok 21 - Matching: negated_basic_reader: matches: Error ContainElements matcher expects an array/slice/map. Got: <string>: foo bar moo cow
not ok 21 - Matching: negated_basic_reader: matches: Error ContainElements matcher expects an array/slice/map/iter.Seq/iter.Seq2. Got: <string>: foo bar moo cow
not ok 22 - Matching: negated_basic_string: matches: Expected "this is a test" not to equal "this is a test"
not ok 23 - Matching: negatedbasic_len: matches: Expected "123" not to have length 3
not ok 24 - Matching: negatedbasic_string_contain_substring: matches: Expected "foo" not to contain substring "oo"
Expand Down