Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --skip flag to crosslink tidylist #662

Merged
merged 1 commit into from
Jan 15, 2025
Merged
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
Add --skip flag to crosslink tidylist
  • Loading branch information
jade-guiton-dd committed Jan 14, 2025
commit b9659cdafb2734411c4a43edfce75945f3fcee2c
16 changes: 16 additions & 0 deletions .chloggen/crosslink-tidy-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'enhancement'

# The name of the component, or a single word describing the area of concern, (e.g. crosslink)
component: crosslink

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Added `--skip` flag to `crosslink tidylist` subcommand

# One or more tracking issues related to the change
issues: [662]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 2 additions & 0 deletions crosslink/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ func init() {
comCfg.workCommand.Flags().StringVar(&comCfg.runConfig.GoVersion, "go", "1.22", "Go version applied when new go.work file is created")
comCfg.tidyListCommand.Flags().StringVar(&comCfg.runConfig.AllowCircular, "allow-circular", "", "path to list of go modules that are allowed to have circular dependencies")
comCfg.tidyListCommand.Flags().BoolVar(&comCfg.runConfig.Validate, "validate", false, "enables brute force validation of the tidy schedule")
comCfg.tidyListCommand.Flags().StringSliceVar(&comCfg.skipFlags, "skip", []string{}, "list of comma separated go.mod files that will be ignored by crosslink. "+
"multiple calls of --skip can be made")
}

// transform array slice into map
Expand Down
3 changes: 3 additions & 0 deletions crosslink/internal/mock_test_data/testTidyListOrder/gomod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot

go 1.20
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testA

go 1.20

require go.opentelemetry.io/build-tools/crosslink/testroot/testC v1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testB

go 1.20
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module go.opentelemetry.io/build-tools/crosslink/testroot/testC

go 1.20
16 changes: 16 additions & 0 deletions crosslink/internal/tidylist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ func TestTidy(t *testing.T) {
},
expSched: []string{".", "testC", "testB", "testA", "testB"},
},
{ // A -> C, B should give CAB (default to alphabetical order when no contraint)
name: "testTidyListOrder",
mock: "testTidyListOrder",
config: func(*RunConfig) {},
expSched: []string{".", "testC", "testA", "testB"},
},
{ // A -> C, B with A skipped should give BC (prune the graph, not just filter the output)
name: "testTidyListSkip",
mock: "testTidyListOrder",
config: func(config *RunConfig) {
config.SkippedPaths = map[string]struct{}{
"testA/go.mod": {},
}
},
expSched: []string{".", "testB", "testC"},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down
Loading