Skip to content

Commit 9f4a509

Browse files
prattmicgopherbot
authored andcommitted
gopls/internal/telemetry/cmd/stacks: add dry run flag
This flag avoids updating existing issues. It still requires a GitHub auth token to determine which issues would get updated. It also still opens a browser window for new issues. For golang/go#71045. Change-Id: I6a6a636c26a402c9ea66160e14cd388b490b74b9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/642421 Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
1 parent 38d0631 commit 9f4a509

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gopls/internal/telemetry/cmd/stacks/stacks.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ var (
9494

9595
daysFlag = flag.Int("days", 7, "number of previous days of telemetry data to read")
9696

97+
dryRun = flag.Bool("n", false, "dry run, avoid updating issues")
98+
9799
authToken string // mandatory GitHub authentication token (for R/W issues access)
98100
)
99101

@@ -559,6 +561,12 @@ func updateIssues(issues []*Issue, stacks map[string]map[Info]int64, stackToURL
559561
newStackIDs = append(newStackIDs, id)
560562
writeStackComment(comment, stack, id, stackToURL[stack], stacks[stack])
561563
}
564+
565+
if *dryRun {
566+
log.Printf("DRY RUN: would add stacks %s to issue #%d", newStackIDs, issue.Number)
567+
continue
568+
}
569+
562570
if err := addIssueComment(issue.Number, comment.String()); err != nil {
563571
log.Println(err)
564572
continue

0 commit comments

Comments
 (0)