fix: minor example issues (#676)

* lint: pin golangci-lint version

* fix: minor example issues

* Update lint.yml

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
This commit is contained in:
Nathan Baulch
2025-09-25 06:52:23 +10:00
committed by GitHub
parent 3210326df6
commit 5196e100c3
3 changed files with 5 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ func ExampleWithoutBy() {
filteredUsers := WithoutBy(users, extractID, excludedIDs...)
// output the filtered users
fmt.Printf("%v\n", filteredUsers)
fmt.Printf("%v", filteredUsers)
// Output:
// [{1 Alice}]
}

View File

@@ -217,7 +217,7 @@ func ExampleMapEntries() {
return v, k
})
fmt.Printf("%v\n", result)
fmt.Printf("%v", result)
// Output: map[1:foo 2:bar]
}
@@ -228,7 +228,7 @@ func ExampleMapToSlice() {
return fmt.Sprintf("%d_%d", k, v)
})
sort.StringSlice(result).Sort()
sort.Strings(result)
fmt.Printf("%v", result)
// Output: [1_1 2_2 3_3 4_4]
}
@@ -240,7 +240,7 @@ func ExampleFilterMapToSlice() {
return fmt.Sprintf("%d_%d", k, v), k%2 == 0
})
sort.StringSlice(result).Sort()
sort.Strings(result)
fmt.Printf("%v", result)
// Output: [2_2 4_4]
}

View File

@@ -508,7 +508,7 @@ func ExampleReplace() {
// [42 1 42 1 2 3 42]
}
func ExampleReplaceAll() {
func ExampleCompact() {
list := []string{"", "foo", "", "bar", ""}
result := Compact(list)