[tools] internal/server: add instrumentation to track vulncheck codelens usage

10 views
Skip to first unread message

Ethan Lee (Gerrit)

unread,
Oct 7, 2025, 4:28:17 PMOct 7
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Ethan Lee has uploaded the change for review

Commit message

internal/server: add instrumentation to track vulncheck codelens usage

- Instrument users' clicking on vulncheck codelens.
Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37

Change diff

diff --git a/gopls/internal/mod/code_lens.go b/gopls/internal/mod/code_lens.go
index 038fd20..2373830 100644
--- a/gopls/internal/mod/code_lens.go
+++ b/gopls/internal/mod/code_lens.go
@@ -164,8 +164,9 @@
}

vulncheck := command.NewVulncheckCommand("Run govulncheck", command.VulncheckArgs{
- URI: uri,
- Pattern: "./...",
+ URI: uri,
+ Pattern: "./...",
+ FromCodeLens: true,
})
return []protocol.CodeLens{
{Range: rng, Command: vulncheck},
@@ -192,8 +193,9 @@
}

vulncheck := command.NewRunGovulncheckCommand("Run govulncheck", command.VulncheckArgs{
- URI: uri,
- Pattern: "./...",
+ URI: uri,
+ Pattern: "./...",
+ FromCodeLens: true,
})
return []protocol.CodeLens{
{Range: rng, Command: vulncheck},
diff --git a/gopls/internal/protocol/command/interface.go b/gopls/internal/protocol/command/interface.go
index f3e6f01..d34a2f8 100644
--- a/gopls/internal/protocol/command/interface.go
+++ b/gopls/internal/protocol/command/interface.go
@@ -528,6 +528,9 @@
// Package pattern. E.g. "", ".", "./...".
Pattern string

+ // Record if vulncheck has been been triggered via codelens.
+ FromCodeLens bool
+
// TODO: -tests
}

diff --git a/gopls/internal/server/command.go b/gopls/internal/server/command.go
index 532a353..9407d71 100644
--- a/gopls/internal/server/command.go
+++ b/gopls/internal/server/command.go
@@ -1236,6 +1236,10 @@
dir := args.URI.DirPath()
pattern := args.Pattern

+ if args.FromCodeLens {
+ countVulncheckLensesMethod.Inc()
+ }
+
result, err := scan.RunGovulncheck(ctx, pattern, deps.snapshot, dir, workDoneWriter)
if err != nil {
return err
@@ -1322,6 +1326,10 @@
dir := filepath.Dir(args.URI.Path())
pattern := args.Pattern

+ if args.FromCodeLens {
+ countRunGovulncheckLensesMethod.Inc()
+ }
+
result, err := scan.RunGovulncheck(ctx, pattern, deps.snapshot, dir, workDoneWriter)
if err != nil {
return err
diff --git a/gopls/internal/server/counters.go b/gopls/internal/server/counters.go
index 72095d7..388eb92 100644
--- a/gopls/internal/server/counters.go
+++ b/gopls/internal/server/counters.go
@@ -43,3 +43,10 @@

countRemoveStructTags = counter.New("gopls/structtags:remove")
)
+
+// Proposed counters for mod codelens usage. These counters
+// increment when the user attempts invokes a go.mod codelens.
+var (
+ countVulncheckLensesMethod = counter.New("gopls/mod/codelenses:vulncheck")
+ countRunGovulncheckLensesMethod = counter.New("gopls/mod/codelenses:go_vulncheck")
+)

Change information

Files:
  • M gopls/internal/mod/code_lens.go
  • M gopls/internal/protocol/command/interface.go
  • M gopls/internal/server/command.go
  • M gopls/internal/server/counters.go
Change size: S
Delta: 4 files changed, 24 insertions(+), 4 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
Gerrit-Change-Number: 709956
Gerrit-PatchSet: 1
Gerrit-Owner: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ethan Lee (Gerrit)

unread,
Oct 7, 2025, 4:47:28 PMOct 7
to goph...@pubsubhelper.golang.org, Hongxiang Jiang, Go LUCI, golang-co...@googlegroups.com
Attention needed from Hongxiang Jiang

Ethan Lee voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Hongxiang Jiang
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
Gerrit-Change-Number: 709956
Gerrit-PatchSet: 1
Gerrit-Owner: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Comment-Date: Tue, 07 Oct 2025 20:47:25 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Ethan Lee (Gerrit)

unread,
Oct 8, 2025, 12:36:57 PMOct 8
to goph...@pubsubhelper.golang.org, Hongxiang Jiang, Go LUCI, golang-co...@googlegroups.com
Gerrit-Comment-Date: Wed, 08 Oct 2025 16:36:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
Oct 8, 2025, 12:40:09 PMOct 8
to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com

Hongxiang Jiang added 1 comment

File gopls/internal/mod/code_lens.go
Line 169, Patchset 1 (Latest): FromCodeLens: true,
Hongxiang Jiang . unresolved

since the codelens counter is for all the go mod file codelenses, maybe we can put a more generalized field here, like "source".

maybe we need to re-think about the model, maybe we should do something like

```
gopls/executeCommand/source:{vulncheck-codelens,go_vulncheck-codelens}
```

so we can extend this to `vulncheck-codeaction` and other command that can be triggered from both code action, codelens or even vscode command pallette.

I'm very sorry that during our previous conversation, I did not think deeper enough into how the gopls command execution works.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
    Gerrit-Change-Number: 709956
    Gerrit-PatchSet: 1
    Gerrit-Owner: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Comment-Date: Wed, 08 Oct 2025 16:40:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Ethan Lee (Gerrit)

    unread,
    Oct 8, 2025, 1:19:32 PMOct 8
    to goph...@pubsubhelper.golang.org, Hongxiang Jiang, Go LUCI, golang-co...@googlegroups.com
    Attention needed from Hongxiang Jiang

    Ethan Lee added 1 comment

    File gopls/internal/mod/code_lens.go
    Line 169, Patchset 1 (Latest): FromCodeLens: true,
    Hongxiang Jiang . unresolved

    since the codelens counter is for all the go mod file codelenses, maybe we can put a more generalized field here, like "source".

    maybe we need to re-think about the model, maybe we should do something like

    ```
    gopls/executeCommand/source:{vulncheck-codelens,go_vulncheck-codelens}
    ```

    so we can extend this to `vulncheck-codeaction` and other command that can be triggered from both code action, codelens or even vscode command pallette.

    I'm very sorry that during our previous conversation, I did not think deeper enough into how the gopls command execution works.

    Ethan Lee

    I see what you mean and it is a good idea to generalize this so that we can capture both the command and its trigger.

    Let's discuss this further and devise a more scalable method.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hongxiang Jiang
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
    Gerrit-Change-Number: 709956
    Gerrit-PatchSet: 1
    Gerrit-Owner: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Comment-Date: Wed, 08 Oct 2025 17:19:29 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Hongxiang Jiang <hxj...@golang.org>
    unsatisfied_requirement
    open
    diffy

    Ethan Lee (Gerrit)

    unread,
    Oct 13, 2025, 6:07:59 AMOct 13
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Ethan Lee

    Ethan Lee uploaded new patchset

    Ethan Lee uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ethan Lee
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
    Gerrit-Change-Number: 709956
    Gerrit-PatchSet: 2
    Gerrit-Owner: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
    Gerrit-Attention: Ethan Lee <etha...@google.com>
    unsatisfied_requirement
    open
    diffy

    Ethan Lee (Gerrit)

    unread,
    Oct 13, 2025, 7:08:49 AMOct 13
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Ethan Lee

    Ethan Lee uploaded new patchset

    Ethan Lee uploaded patch set #3 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ethan Lee
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
    Gerrit-Change-Number: 709956
    Gerrit-PatchSet: 3
    unsatisfied_requirement
    open
    diffy

    Ethan Lee (Gerrit)

    unread,
    Oct 13, 2025, 7:11:00 AMOct 13
    to goph...@pubsubhelper.golang.org, Hongxiang Jiang, Go LUCI, golang-co...@googlegroups.com
    Attention needed from Hongxiang Jiang

    Ethan Lee added 1 comment

    File gopls/internal/mod/code_lens.go
    Line 169, Patchset 1: FromCodeLens: true,
    Hongxiang Jiang . resolved

    since the codelens counter is for all the go mod file codelenses, maybe we can put a more generalized field here, like "source".

    maybe we need to re-think about the model, maybe we should do something like

    ```
    gopls/executeCommand/source:{vulncheck-codelens,go_vulncheck-codelens}
    ```

    so we can extend this to `vulncheck-codeaction` and other command that can be triggered from both code action, codelens or even vscode command pallette.

    I'm very sorry that during our previous conversation, I did not think deeper enough into how the gopls command execution works.

    Ethan Lee

    I see what you mean and it is a good idea to generalize this so that we can capture both the command and its trigger.

    Let's discuss this further and devise a more scalable method.

    Ethan Lee

    Discussed offline regarding generalizing instrumentation for different commands and sources.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hongxiang Jiang
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: tools
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
      Gerrit-Change-Number: 709956
      Gerrit-PatchSet: 3
      Gerrit-Owner: Ethan Lee <etha...@google.com>
      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
      Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
      Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
      Gerrit-Comment-Date: Mon, 13 Oct 2025 11:10:53 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Hongxiang Jiang <hxj...@golang.org>
      Comment-In-Reply-To: Ethan Lee <etha...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Ethan Lee (Gerrit)

      unread,
      Oct 13, 2025, 7:22:39 AMOct 13
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Hongxiang Jiang

      Ethan Lee uploaded new patchset

      Ethan Lee uploaded patch set #4 to this change.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hongxiang Jiang
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: tools
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
      Gerrit-Change-Number: 709956
      Gerrit-PatchSet: 4
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Ethan Lee (Gerrit)

      unread,
      Oct 13, 2025, 7:33:48 AMOct 13
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Hongxiang Jiang

      Ethan Lee uploaded new patchset

      Ethan Lee uploaded patch set #5 to this change.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hongxiang Jiang
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: tools
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
      Gerrit-Change-Number: 709956
      Gerrit-PatchSet: 5
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Hongxiang Jiang (Gerrit)

      unread,
      Oct 28, 2025, 8:46:12 PM (8 days ago) Oct 28
      to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
      Attention needed from Ethan Lee

      Hongxiang Jiang added 2 comments

      File gopls/internal/mod/code_lens.go
      Line 169, Patchset 5 (Latest): Source: command.CodeLens,
      Hongxiang Jiang . unresolved

      I think we should do it in a different place instead of here. Let's make it more general.

      `server/code_lens.go` is a better place which will handle not only the go mod file but also other go files...

      But maybe the best place is `gopls/internal/protocol/tsserver.go`

      ```
      case "textDocument/codeLens":
      var params CodeLensParams
      if err := UnmarshalJSON(raw, &params); err != nil {
      return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err)
      }
      resp, err := server.CodeLens(ctx, &params)
      if err != nil {
      return nil, true, err
      }
      // TODO: let's example the response, if any of the codelen.command
      // is not nil, let's add the "source: codelens" to it.
      return resp, true, nil

      ```

      Same can also be applied to codeaction. You can leave it a TODO there if you think this is beyond the scope.

      But the tsserver.go is auto generate, please take a look at the auto-gen code to make the change.

      File gopls/internal/server/command.go
      Line 80, Patchset 5 (Latest):
      if source := getCommandSource(params.Arguments); source != "" {
      commandName := strings.TrimPrefix(params.Command, "gopls.")
      counterName := fmt.Sprintf("gopls/cmd/source:%s-%s", commandName, source)
      counter.New(counterName).Inc()
      }
      Hongxiang Jiang . unresolved

      Same thing here. I think this is a reasonable place. Since all the command execution will arrive in this place.

      But if we are already making changes in tsserver.go, it make more sense to handle both "source" injection and "source" retrieval in there.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ethan Lee
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: tools
        Gerrit-Branch: master
        Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
        Gerrit-Change-Number: 709956
        Gerrit-PatchSet: 5
        Gerrit-Owner: Ethan Lee <etha...@google.com>
        Gerrit-Reviewer: Ethan Lee <etha...@google.com>
        Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
        Gerrit-Attention: Ethan Lee <etha...@google.com>
        Gerrit-Comment-Date: Wed, 29 Oct 2025 00:46:08 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        unsatisfied_requirement
        open
        diffy

        Ethan Lee (Gerrit)

        unread,
        Oct 30, 2025, 4:51:59 PM (7 days ago) Oct 30
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Ethan Lee

        Ethan Lee uploaded new patchset

        Ethan Lee uploaded patch set #6 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ethan Lee
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: tools
        Gerrit-Branch: master
        Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
        Gerrit-Change-Number: 709956
        Gerrit-PatchSet: 6
        unsatisfied_requirement
        open
        diffy

        Ethan Lee (Gerrit)

        unread,
        Oct 30, 2025, 4:53:49 PM (7 days ago) Oct 30
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Ethan Lee

        Ethan Lee uploaded new patchset

        Ethan Lee uploaded patch set #7 to this change.
        Following approvals got outdated and were removed:
        • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ethan Lee
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: tools
        Gerrit-Branch: master
        Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
        Gerrit-Change-Number: 709956
        Gerrit-PatchSet: 7
        unsatisfied_requirement
        open
        diffy

        Ethan Lee (Gerrit)

        unread,
        Oct 30, 2025, 4:55:57 PM (7 days ago) Oct 30
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Ethan Lee

        Ethan Lee uploaded new patchset

        Ethan Lee uploaded patch set #8 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ethan Lee
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: tools
        Gerrit-Branch: master
        Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
        Gerrit-Change-Number: 709956
        Gerrit-PatchSet: 8
        unsatisfied_requirement
        open
        diffy

        Ethan Lee (Gerrit)

        unread,
        Oct 30, 2025, 4:57:41 PM (7 days ago) Oct 30
        to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
        Attention needed from Hongxiang Jiang

        Ethan Lee added 2 comments

        File gopls/internal/mod/code_lens.go
        Line 169, Patchset 5: Source: command.CodeLens,
        Hongxiang Jiang . resolved

        I think we should do it in a different place instead of here. Let's make it more general.

        `server/code_lens.go` is a better place which will handle not only the go mod file but also other go files...

        But maybe the best place is `gopls/internal/protocol/tsserver.go`

        ```
        case "textDocument/codeLens":
        var params CodeLensParams
        if err := UnmarshalJSON(raw, &params); err != nil {
        return nil, true, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err)
        }
        resp, err := server.CodeLens(ctx, &params)
        if err != nil {
        return nil, true, err
        }
        // TODO: let's example the response, if any of the codelen.command
        // is not nil, let's add the "source: codelens" to it.
        return resp, true, nil

        ```

        Same can also be applied to codeaction. You can leave it a TODO there if you think this is beyond the scope.

        But the tsserver.go is auto generate, please take a look at the auto-gen code to make the change.

        Ethan Lee

        Sure, let's leave a TODO until we want to add instrumentation for codelens invocation.

        File gopls/internal/server/command.go

        if source := getCommandSource(params.Arguments); source != "" {
        commandName := strings.TrimPrefix(params.Command, "gopls.")
        counterName := fmt.Sprintf("gopls/cmd/source:%s-%s", commandName, source)
        counter.New(counterName).Inc()
        }
        Hongxiang Jiang . resolved

        Same thing here. I think this is a reasonable place. Since all the command execution will arrive in this place.

        But if we are already making changes in tsserver.go, it make more sense to handle both "source" injection and "source" retrieval in there.

        Ethan Lee

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Hongxiang Jiang
        Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: tools
          Gerrit-Branch: master
          Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
          Gerrit-Change-Number: 709956
          Gerrit-PatchSet: 8
          Gerrit-Owner: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
          Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
          Gerrit-Comment-Date: Thu, 30 Oct 2025 20:57:36 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Hongxiang Jiang <hxj...@golang.org>
          unsatisfied_requirement
          satisfied_requirement
          open
          diffy

          Ethan Lee (Gerrit)

          unread,
          Oct 30, 2025, 5:03:22 PM (7 days ago) Oct 30
          to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
          Attention needed from Ethan Lee and Hongxiang Jiang

          Ethan Lee uploaded new patchset

          Ethan Lee uploaded patch set #9 to this change.
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ethan Lee
          • Hongxiang Jiang
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: tools
          Gerrit-Branch: master
          Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
          Gerrit-Change-Number: 709956
          Gerrit-PatchSet: 9
          Gerrit-Owner: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
          Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
          Gerrit-Attention: Ethan Lee <etha...@google.com>
          unsatisfied_requirement
          satisfied_requirement
          open
          diffy

          Ethan Lee (Gerrit)

          unread,
          Oct 31, 2025, 4:53:00 AM (6 days ago) Oct 31
          to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
          Attention needed from Hongxiang Jiang

          Ethan Lee voted Commit-Queue+1

          Commit-Queue+1
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Hongxiang Jiang
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: tools
          Gerrit-Branch: master
          Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
          Gerrit-Change-Number: 709956
          Gerrit-PatchSet: 9
          Gerrit-Owner: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
          Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
          Gerrit-Comment-Date: Fri, 31 Oct 2025 08:52:56 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          unsatisfied_requirement
          satisfied_requirement
          open
          diffy

          Hongxiang Jiang (Gerrit)

          unread,
          Nov 3, 2025, 1:44:39 PM (3 days ago) Nov 3
          to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
          Attention needed from Ethan Lee

          Hongxiang Jiang added 1 comment

          Patchset-level comments
          File-level comment, Patchset 9 (Latest):
          Hongxiang Jiang . unresolved

          You need rebase to fix the test issues in the x/tools module.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ethan Lee
          Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: tools
            Gerrit-Branch: master
            Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
            Gerrit-Change-Number: 709956
            Gerrit-PatchSet: 9
            Gerrit-Owner: Ethan Lee <etha...@google.com>
            Gerrit-Reviewer: Ethan Lee <etha...@google.com>
            Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
            Gerrit-Attention: Ethan Lee <etha...@google.com>
            Gerrit-Comment-Date: Mon, 03 Nov 2025 18:44:33 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            unsatisfied_requirement
            open
            diffy

            Ethan Lee (Gerrit)

            unread,
            Nov 3, 2025, 1:46:03 PM (3 days ago) Nov 3
            to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
            Attention needed from Hongxiang Jiang

            Ethan Lee voted and added 1 comment

            Votes added by Ethan Lee

            Auto-Submit+1
            Commit-Queue+1

            1 comment

            Patchset-level comments
            File-level comment, Patchset 9:
            Hongxiang Jiang . resolved

            You need rebase to fix the test issues in the x/tools module.

            Ethan Lee

            Done

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Hongxiang Jiang
            Submit Requirements:
              • requirement is not satisfiedCode-Review
              • requirement satisfiedNo-Unresolved-Comments
              • requirement is not satisfiedReview-Enforcement
              • requirement is not satisfiedTryBots-Pass
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: tools
              Gerrit-Branch: master
              Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
              Gerrit-Change-Number: 709956
              Gerrit-PatchSet: 10
              Gerrit-Owner: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
              Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
              Gerrit-Comment-Date: Mon, 03 Nov 2025 18:45:57 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: Yes
              Comment-In-Reply-To: Hongxiang Jiang <hxj...@golang.org>
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              Hongxiang Jiang (Gerrit)

              unread,
              Nov 3, 2025, 1:59:25 PM (3 days ago) Nov 3
              to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
              Attention needed from Ethan Lee

              Hongxiang Jiang added 1 comment

              File gopls/internal/protocol/generate/main.go
              Line 186, Patchset 10 (Latest): args["source"] = "codelens"
              Hongxiang Jiang . unresolved

              I had a chat with Alan today on this topic. I made a wrong suggestion to your CL and I'm very sorry for this confusion.

              So, it's actually better to put it in the server/code_lens.go and server/command.go.

              The generator should only contains the protocol level changes. We can have a function at the end of the codelens that inject a "source" to all the Command.

              and we can have a similar function for workspace/executeCommand that retrieve the source from the Command.

              Please also take a look and see if we can get rid of the source argument once we receive it. Let it serve as a middle ware so the command writer will not observer this argument ever.

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Ethan Lee
              Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: comment
                Gerrit-Project: tools
                Gerrit-Branch: master
                Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                Gerrit-Change-Number: 709956
                Gerrit-PatchSet: 10
                Gerrit-Owner: Ethan Lee <etha...@google.com>
                Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                Gerrit-Attention: Ethan Lee <etha...@google.com>
                Gerrit-Comment-Date: Mon, 03 Nov 2025 18:59:20 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: No
                unsatisfied_requirement
                open
                diffy

                Ethan Lee (Gerrit)

                unread,
                Nov 3, 2025, 3:20:19 PM (3 days ago) Nov 3
                to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                Attention needed from Ethan Lee

                Ethan Lee uploaded new patchset

                Ethan Lee uploaded patch set #11 to this change.
                Following approvals got outdated and were removed:
                • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Ethan Lee
                Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: newpatchset
                Gerrit-Project: tools
                Gerrit-Branch: master
                Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                Gerrit-Change-Number: 709956
                Gerrit-PatchSet: 11
                unsatisfied_requirement
                open
                diffy

                Ethan Lee (Gerrit)

                unread,
                Nov 3, 2025, 3:20:41 PM (3 days ago) Nov 3
                to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
                Attention needed from Hongxiang Jiang

                Ethan Lee added 1 comment

                File gopls/internal/protocol/generate/main.go
                Line 186, Patchset 10: args["source"] = "codelens"
                Hongxiang Jiang . resolved

                I had a chat with Alan today on this topic. I made a wrong suggestion to your CL and I'm very sorry for this confusion.

                So, it's actually better to put it in the server/code_lens.go and server/command.go.

                The generator should only contains the protocol level changes. We can have a function at the end of the codelens that inject a "source" to all the Command.

                and we can have a similar function for workspace/executeCommand that retrieve the source from the Command.

                Please also take a look and see if we can get rid of the source argument once we receive it. Let it serve as a middle ware so the command writer will not observer this argument ever.

                Ethan Lee

                Done

                Open in Gerrit

                Related details

                Attention is currently required from:
                • Hongxiang Jiang
                Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: tools
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                  Gerrit-Change-Number: 709956
                  Gerrit-PatchSet: 11
                  Gerrit-Owner: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Comment-Date: Mon, 03 Nov 2025 20:20:38 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  Comment-In-Reply-To: Hongxiang Jiang <hxj...@golang.org>
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  Ethan Lee (Gerrit)

                  unread,
                  Nov 3, 2025, 3:21:26 PM (3 days ago) Nov 3
                  to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                  Attention needed from Ethan Lee and Hongxiang Jiang

                  Ethan Lee uploaded new patchset

                  Ethan Lee uploaded patch set #12 to this change.
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ethan Lee
                  • Hongxiang Jiang
                  Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: newpatchset
                  Gerrit-Project: tools
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                  Gerrit-Change-Number: 709956
                  Gerrit-PatchSet: 12
                  Gerrit-Owner: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Attention: Ethan Lee <etha...@google.com>
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  Ethan Lee (Gerrit)

                  unread,
                  Nov 3, 2025, 3:21:58 PM (3 days ago) Nov 3
                  to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                  Attention needed from Ethan Lee and Hongxiang Jiang

                  Ethan Lee uploaded new patchset

                  Ethan Lee uploaded patch set #13 to this change.
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ethan Lee
                  • Hongxiang Jiang
                  Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: newpatchset
                  Gerrit-Project: tools
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                  Gerrit-Change-Number: 709956
                  Gerrit-PatchSet: 13
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  Ethan Lee (Gerrit)

                  unread,
                  Nov 3, 2025, 3:34:31 PM (3 days ago) Nov 3
                  to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
                  Attention needed from Hongxiang Jiang

                  Ethan Lee voted

                  Auto-Submit+1
                  Commit-Queue+1
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Hongxiang Jiang
                  Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: tools
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                  Gerrit-Change-Number: 709956
                  Gerrit-PatchSet: 14
                  Gerrit-Owner: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Comment-Date: Mon, 03 Nov 2025 20:34:27 +0000
                  Gerrit-HasComments: No
                  Gerrit-Has-Labels: Yes
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  Ethan Lee (Gerrit)

                  unread,
                  Nov 3, 2025, 3:37:26 PM (3 days ago) Nov 3
                  to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                  Attention needed from Ethan Lee and Hongxiang Jiang

                  Ethan Lee uploaded new patchset

                  Ethan Lee uploaded patch set #15 to this change.
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ethan Lee
                  • Hongxiang Jiang
                  Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: newpatchset
                  Gerrit-Project: tools
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                  Gerrit-Change-Number: 709956
                  Gerrit-PatchSet: 15
                  Gerrit-Owner: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Attention: Ethan Lee <etha...@google.com>
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  Ethan Lee (Gerrit)

                  unread,
                  Nov 3, 2025, 3:37:30 PM (3 days ago) Nov 3
                  to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
                  Attention needed from Hongxiang Jiang

                  Ethan Lee voted

                  Auto-Submit+1
                  Commit-Queue+1
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Hongxiang Jiang
                  Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement is not satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: tools
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                  Gerrit-Change-Number: 709956
                  Gerrit-PatchSet: 15
                  Gerrit-Owner: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                  Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                  Gerrit-Comment-Date: Mon, 03 Nov 2025 20:37:26 +0000
                  Gerrit-HasComments: No
                  Gerrit-Has-Labels: Yes
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  Hongxiang Jiang (Gerrit)

                  unread,
                  Nov 3, 2025, 3:59:45 PM (3 days ago) Nov 3
                  to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
                  Attention needed from Ethan Lee

                  Hongxiang Jiang added 2 comments

                  File gopls/internal/server/code_lens.go
                  Line 61, Patchset 15 (Latest): var args map[string]interface{}
                  Hongxiang Jiang . unresolved

                  any

                  Line 62, Patchset 15 (Latest): if err := json.Unmarshal(lenses[i].Command.Arguments[0], &args); err == nil {
                  Hongxiang Jiang . unresolved

                  If there is a command does not have any arguments, this code will not append the source to it right?

                  This make me think is this the right way of injecting? Should we try to pre-pend a new argument in front?

                  The argument list is a slice, so we can say, the last one is preserved for internal use only. We can create a type say `type metadata struct { source string }`.

                  Then we can try to unmarshall the last argument as this type, if it fails, no op.

                  If it succeed, take the last one out.

                  WDYT.

                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Ethan Lee
                  Submit Requirements:
                    • requirement is not satisfiedCode-Review
                    • requirement is not satisfiedNo-Unresolved-Comments
                    • requirement is not satisfiedReview-Enforcement
                    • requirement is not satisfiedTryBots-Pass
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: comment
                    Gerrit-Project: tools
                    Gerrit-Branch: master
                    Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                    Gerrit-Change-Number: 709956
                    Gerrit-PatchSet: 15
                    Gerrit-Owner: Ethan Lee <etha...@google.com>
                    Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                    Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                    Gerrit-Attention: Ethan Lee <etha...@google.com>
                    Gerrit-Comment-Date: Mon, 03 Nov 2025 20:59:41 +0000
                    Gerrit-HasComments: Yes
                    Gerrit-Has-Labels: No
                    unsatisfied_requirement
                    open
                    diffy

                    Ethan Lee (Gerrit)

                    unread,
                    Nov 3, 2025, 4:26:07 PM (3 days ago) Nov 3
                    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                    Attention needed from Ethan Lee

                    Ethan Lee uploaded new patchset

                    Ethan Lee uploaded patch set #16 to this change.
                    Following approvals got outdated and were removed:
                    • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
                    Open in Gerrit

                    Related details

                    Attention is currently required from:
                    • Ethan Lee
                    Submit Requirements:
                    • requirement is not satisfiedCode-Review
                    • requirement is not satisfiedNo-Unresolved-Comments
                    • requirement is not satisfiedReview-Enforcement
                    • requirement is not satisfiedTryBots-Pass
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: newpatchset
                    Gerrit-Project: tools
                    Gerrit-Branch: master
                    Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                    Gerrit-Change-Number: 709956
                    Gerrit-PatchSet: 16
                    unsatisfied_requirement
                    open
                    diffy

                    Ethan Lee (Gerrit)

                    unread,
                    Nov 3, 2025, 4:27:02 PM (3 days ago) Nov 3
                    to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
                    Attention needed from Hongxiang Jiang

                    Ethan Lee voted and added 2 comments

                    Votes added by Ethan Lee

                    Auto-Submit+1

                    2 comments

                    File gopls/internal/server/code_lens.go
                    Line 61, Patchset 15: var args map[string]interface{}
                    Hongxiang Jiang . resolved

                    any

                    Ethan Lee

                    Done

                    Line 62, Patchset 15: if err := json.Unmarshal(lenses[i].Command.Arguments[0], &args); err == nil {
                    Hongxiang Jiang . resolved

                    If there is a command does not have any arguments, this code will not append the source to it right?

                    This make me think is this the right way of injecting? Should we try to pre-pend a new argument in front?

                    The argument list is a slice, so we can say, the last one is preserved for internal use only. We can create a type say `type metadata struct { source string }`.

                    Then we can try to unmarshall the last argument as this type, if it fails, no op.

                    If it succeed, take the last one out.

                    WDYT.

                    Ethan Lee

                    That's a good point. Yes, even if there are no arguments we can still append an extra argument for the source, which we will then use in executeCommand and finally remove from the argument slice.

                    Open in Gerrit

                    Related details

                    Attention is currently required from:
                    • Hongxiang Jiang
                    Submit Requirements:
                      • requirement is not satisfiedCode-Review
                      • requirement satisfiedNo-Unresolved-Comments
                      • requirement is not satisfiedReview-Enforcement
                      • requirement is not satisfiedTryBots-Pass
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: tools
                      Gerrit-Branch: master
                      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                      Gerrit-Change-Number: 709956
                      Gerrit-PatchSet: 15
                      Gerrit-Owner: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                      Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                      Gerrit-Comment-Date: Mon, 03 Nov 2025 21:26:58 +0000
                      unsatisfied_requirement
                      satisfied_requirement
                      open
                      diffy

                      Ethan Lee (Gerrit)

                      unread,
                      Nov 3, 2025, 4:27:46 PM (3 days ago) Nov 3
                      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                      Attention needed from Ethan Lee and Hongxiang Jiang

                      Ethan Lee uploaded new patchset

                      Ethan Lee uploaded patch set #17 to this change.
                      Open in Gerrit

                      Related details

                      Attention is currently required from:
                      • Ethan Lee
                      • Hongxiang Jiang
                      Submit Requirements:
                      • requirement is not satisfiedCode-Review
                      • requirement satisfiedNo-Unresolved-Comments
                      • requirement is not satisfiedReview-Enforcement
                      • requirement is not satisfiedTryBots-Pass
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: newpatchset
                      Gerrit-Project: tools
                      Gerrit-Branch: master
                      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                      Gerrit-Change-Number: 709956
                      Gerrit-PatchSet: 17
                      Gerrit-Owner: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                      Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                      Gerrit-Attention: Ethan Lee <etha...@google.com>
                      unsatisfied_requirement
                      satisfied_requirement
                      open
                      diffy

                      Ethan Lee (Gerrit)

                      unread,
                      Nov 3, 2025, 4:33:35 PM (3 days ago) Nov 3
                      to goph...@pubsubhelper.golang.org, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com
                      Attention needed from Hongxiang Jiang

                      Ethan Lee voted

                      Auto-Submit+1
                      Commit-Queue+1
                      Open in Gerrit

                      Related details

                      Attention is currently required from:
                      • Hongxiang Jiang
                      Submit Requirements:
                      • requirement is not satisfiedCode-Review
                      • requirement satisfiedNo-Unresolved-Comments
                      • requirement is not satisfiedReview-Enforcement
                      • requirement is not satisfiedTryBots-Pass
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: tools
                      Gerrit-Branch: master
                      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                      Gerrit-Change-Number: 709956
                      Gerrit-PatchSet: 18
                      Gerrit-Owner: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                      Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
                      Gerrit-Comment-Date: Mon, 03 Nov 2025 21:33:31 +0000
                      Gerrit-HasComments: No
                      Gerrit-Has-Labels: Yes
                      unsatisfied_requirement
                      satisfied_requirement
                      open
                      diffy

                      Hongxiang Jiang (Gerrit)

                      unread,
                      Nov 3, 2025, 5:05:23 PM (3 days ago) Nov 3
                      to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
                      Attention needed from Ethan Lee

                      Hongxiang Jiang voted Code-Review+2

                      Code-Review+2
                      Open in Gerrit

                      Related details

                      Attention is currently required from:
                      • Ethan Lee
                      Submit Requirements:
                      • requirement satisfiedCode-Review
                      • requirement satisfiedNo-Unresolved-Comments
                      • requirement satisfiedReview-Enforcement
                      • requirement satisfiedTryBots-Pass
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: tools
                      Gerrit-Branch: master
                      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                      Gerrit-Change-Number: 709956
                      Gerrit-PatchSet: 18
                      Gerrit-Owner: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                      Gerrit-Attention: Ethan Lee <etha...@google.com>
                      Gerrit-Comment-Date: Mon, 03 Nov 2025 22:05:19 +0000
                      Gerrit-HasComments: No
                      Gerrit-Has-Labels: Yes
                      satisfied_requirement
                      open
                      diffy

                      Gopher Robot (Gerrit)

                      unread,
                      Nov 3, 2025, 5:05:42 PM (3 days ago) Nov 3
                      to Ethan Lee, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Hongxiang Jiang, Go LUCI, golang-co...@googlegroups.com

                      Gopher Robot submitted the change

                      Change information

                      Commit message:
                      internal/server: add instrumentation to track gopls command usage

                      - Add source field to args in server/code_lens
                      - Interpet and log source field in executeComand
                      Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                      Auto-Submit: Ethan Lee <etha...@google.com>
                      Reviewed-by: Hongxiang Jiang <hxj...@golang.org>
                      Files:
                      • M gopls/internal/server/code_lens.go
                      • M gopls/internal/server/command.go
                      Change size: S
                      Delta: 2 files changed, 30 insertions(+), 0 deletions(-)
                      Branch: refs/heads/master
                      Submit Requirements:
                      • requirement satisfiedCode-Review: +2 by Hongxiang Jiang
                      • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
                      Open in Gerrit
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: merged
                      Gerrit-Project: tools
                      Gerrit-Branch: master
                      Gerrit-Change-Id: Ia5cbe8176f97c69c2ed0e0e72024c5c898846e37
                      Gerrit-Change-Number: 709956
                      Gerrit-PatchSet: 19
                      Gerrit-Owner: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
                      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
                      Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
                      open
                      diffy
                      satisfied_requirement
                      Reply all
                      Reply to author
                      Forward
                      0 new messages