Skip to content

Commit dcf1013

Browse files
committed
[engine] Use result of slices.Compact
slices.Compact returns a value instead of mutating the input, so the old code was not actually removing duplicates. This only mattered when files were based as positional arguments to `shac check`, which is not super common, and even less common that someone would list the same file twice, hence why we didn't notice it until it started being raised by the "lint" GitHub workflow. I also updated the `govet` shac check to include the analyzer that was catching this in the GitHub workflow. Change-Id: I4a0eb6014d9d9dc1edc225ea60bf76d1fcc3f950
1 parent eff781f commit dcf1013

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

checks/go.star

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def govet(
269269
# analyzers that aren't enforced by the other linters.
270270
analyzers = [
271271
"copylocks",
272+
"unusedresult",
272273
]):
273274
"""Enforces `go vet`.
274275

internal/engine/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ func normalizeFiles(files []string, root string) ([]file, error) {
612612
}
613613

614614
slices.Sort(relativized)
615-
slices.Compact(relativized)
615+
relativized = slices.Compact(relativized)
616616

617617
var res []file
618618
for _, f := range relativized {

internal/engine/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var (
2626
// Version is the current tool version.
2727
//
2828
// TODO(maruel): Add proper version, preferably from git tag.
29-
Version = shacVersion{0, 1, 20}
29+
Version = shacVersion{0, 1, 21}
3030
)
3131

3232
func (v shacVersion) String() string {

0 commit comments

Comments
 (0)