Skip to content

Commit 1a098cc

Browse files
a-orenclaude
andcommitted
fix(go): support semicolon format for exhortignore in indirect deps
The JS client (PR #416) changed the ignore marker format for indirect dependencies from "// indirect exhortignore" to "// indirect; exhortignore" to prevent Go tooling from misclassifying indirect deps as direct. Updated the regex in IgnoredLine() to accept both formats (with and without semicolon). Updated test fixture to use the new format. Fixes TC-4345 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 421b4f1 commit 1a098cc

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/io/github/guacsec/trustifyda/providers/GoModulesProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,8 @@ public boolean IgnoredLine(String line) {
566566
// comment ( e.g // indirect //exhort)
567567
// then this line is to be checked if it's a comment after a package name.
568568
if (Pattern.matches(".+//\\s*(exhortignore|trustify-da-ignore)", line)
569-
|| Pattern.matches(".+//\\sindirect (//)?\\s*(exhortignore|trustify-da-ignore)", line)) {
569+
|| Pattern.matches(
570+
".+//\\s*indirect\\s*;?\\s*(//)?\\s*(exhortignore|trustify-da-ignore)", line)) {
570571
String trimmedRow = line.trim();
571572
// filter out lines where exhortignore or trustify-da-ignore has no meaning
572573
if (!trimmedRow.startsWith("module ")

src/test/resources/tst_manifests/golang/go_mod_with_ignore/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ require (
1515
require (
1616
github.com/davecgh/go-spew v1.1.1 // indirect
1717
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
18-
github.com/go-logr/logr v1.2.3 // indirect trustify-da-ignore
18+
github.com/go-logr/logr v1.2.3 // indirect; trustify-da-ignore
1919
github.com/go-openapi/jsonpointer v0.19.5 // indirect
2020
github.com/go-openapi/jsonreference v0.20.0 // indirect
2121
github.com/go-openapi/swag v0.19.14 // indirect
2222
github.com/gogo/protobuf v1.3.2 // indirect
2323
github.com/golang/protobuf v1.5.2 // indirect
24-
github.com/google/gnostic v0.5.7-v3refs // indirect //trustify-da-ignore
24+
github.com/google/gnostic v0.5.7-v3refs // indirect; //trustify-da-ignore
2525
github.com/google/go-cmp v0.5.9 // indirect
2626
github.com/google/gofuzz v1.1.0 // indirect
2727
github.com/imdario/mergo v0.3.6 // indirect

0 commit comments

Comments
 (0)