Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package gopls for openSUSE:Factory checked 
in at 2024-09-06 17:18:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/gopls (Old)
 and      /work/SRC/openSUSE:Factory/.gopls.new.10096 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gopls"

Fri Sep  6 17:18:36 2024 rev:15 rq:1199067 version:0.16.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/gopls/gopls.changes      2024-07-03 
20:30:42.237951566 +0200
+++ /work/SRC/openSUSE:Factory/.gopls.new.10096/gopls.changes   2024-09-06 
17:18:59.781016594 +0200
@@ -1,0 +2,11 @@
+Thu Sep 05 17:31:58 UTC 2024 - Jeff Kowalczyk <[email protected]>
+
+- Update to version 0.16.2:
+  * gopls: update go.mod for v0.16.2-pre.2
+  * gopls: update x/telemetry dependency
+  * gopls: increment the telemetryprompt acceptance counter for each session
+  * gopls: add x/tools replace directive
+  * gopls: update go.mod for v0.16.2-pre.1
+  * gopls: update x/telemetry dependency
+
+-------------------------------------------------------------------

Old:
----
  gopls-0.16.1.tar.gz

New:
----
  gopls-0.16.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ gopls.spec ++++++
--- /var/tmp/diff_new_pack.Ny9xkS/_old  2024-09-06 17:19:01.017067951 +0200
+++ /var/tmp/diff_new_pack.Ny9xkS/_new  2024-09-06 17:19:01.017067951 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           gopls
-Version:        0.16.1
+Version:        0.16.2
 Release:        0
 Summary:        Go LSP protocol language server
 License:        Apache-2.0 AND MIT AND BSD-3-Clause

++++++ _service ++++++
--- /var/tmp/diff_new_pack.Ny9xkS/_old  2024-09-06 17:19:01.049069281 +0200
+++ /var/tmp/diff_new_pack.Ny9xkS/_new  2024-09-06 17:19:01.053069447 +0200
@@ -4,7 +4,7 @@
     <param name="scm">git</param>
     <param name="include">gopls</param>
     <param name="include">LICENSE</param>
-    <param name="revision">gopls/v0.16.1</param>
+    <param name="revision">gopls/v0.16.2</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">gopls/v(.*)</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.Ny9xkS/_old  2024-09-06 17:19:01.069070112 +0200
+++ /var/tmp/diff_new_pack.Ny9xkS/_new  2024-09-06 17:19:01.073070279 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param name="url">https://github.com/golang/tools.git</param>
-              <param 
name="changesrevision">0cc407e63f5fdd71499c32afa4c54382c5b48d71</param></service></servicedata>
+              <param 
name="changesrevision">017e1b8d601912bd35c6e90d4c5321d0888c942c</param></service></servicedata>
 (No newline at EOF)
 

++++++ gopls-0.16.1.tar.gz -> gopls-0.16.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gopls-0.16.1/gopls/go.mod 
new/gopls-0.16.2/gopls/go.mod
--- old/gopls-0.16.1/gopls/go.mod       2024-07-01 17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/go.mod       2024-08-29 21:24:41.000000000 +0200
@@ -5,11 +5,11 @@
 require (
        github.com/google/go-cmp v0.6.0
        github.com/jba/templatecheck v0.7.0
-       golang.org/x/mod v0.18.0
-       golang.org/x/sync v0.7.0
-       golang.org/x/telemetry v0.0.0-20240607193123-221703e18637
+       golang.org/x/mod v0.20.0
+       golang.org/x/sync v0.8.0
+       golang.org/x/telemetry v0.0.0-20240829154258-f29ab539cc98
        golang.org/x/text v0.16.0
-       golang.org/x/tools v0.22.1-0.20240628205440-9c895dd76b34
+       golang.org/x/tools v0.22.1-0.20240829175637-39126e24d653
        golang.org/x/vuln v1.0.4
        gopkg.in/yaml.v3 v3.0.1
        honnef.co/go/tools v0.4.7
@@ -21,7 +21,7 @@
        github.com/BurntSushi/toml v1.2.1 // indirect
        github.com/google/safehtml v0.1.0 // indirect
        golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338 // 
indirect
-       golang.org/x/sys v0.21.0 // indirect
+       golang.org/x/sys v0.23.0 // indirect
        gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
 
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gopls-0.16.1/gopls/go.sum 
new/gopls-0.16.2/gopls/go.sum
--- old/gopls-0.16.1/gopls/go.sum       2024-07-01 17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/go.sum       2024-08-29 21:24:41.000000000 +0200
@@ -12,20 +12,20 @@
 github.com/rogpeppe/go-internal v1.12.0 
h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
 golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338 
h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
 golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338/go.mod 
h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
-golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
-golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
-golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
-golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
-golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/telemetry v0.0.0-20240607193123-221703e18637 
h1:3Wt8mZlbFwG8llny+t18kh7AXxyWePFycXMuVdHxnyM=
-golang.org/x/telemetry v0.0.0-20240607193123-221703e18637/go.mod 
h1:n38mvGdgc4dA684EC4NwQwoPKSw4jyKw8/DgZHDA1Dk=
+golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
+golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
+golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/telemetry v0.0.0-20240829154258-f29ab539cc98 
h1:Wm3cG5X6sZ0RSVRc/H1/sciC4AT6HAKgLCSH2lbpR/c=
+golang.org/x/telemetry v0.0.0-20240829154258-f29ab539cc98/go.mod 
h1:m7R/r+o5h7UvF2JD9n2iLSGY4v8v+zNSyTJ6xynLrqs=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
 golang.org/x/text v0.16.0/go.mod 
h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod 
h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.22.1-0.20240628205440-9c895dd76b34 
h1:Kd+Z5Pm6uwYx3T2KEkeHMHUMZxDPb/q6b1m+zEcy62c=
-golang.org/x/tools v0.22.1-0.20240628205440-9c895dd76b34/go.mod 
h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
+golang.org/x/tools v0.22.1-0.20240829175637-39126e24d653 
h1:6bJEg2w2kUHWlfdJaESYsmNfI1LKAZQi6zCa7LUn7eI=
+golang.org/x/tools v0.22.1-0.20240829175637-39126e24d653/go.mod 
h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
 golang.org/x/vuln v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=
 golang.org/x/vuln v1.0.4/go.mod h1:NbJdUQhX8jY++FtuhrXs2Eyx0yePo9pF7nPlIjo9aaQ=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod 
h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/gopls-0.16.1/gopls/internal/server/prompt.go 
new/gopls-0.16.2/gopls/internal/server/prompt.go
--- old/gopls-0.16.1/gopls/internal/server/prompt.go    2024-07-01 
17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/internal/server/prompt.go    2024-08-29 
21:24:41.000000000 +0200
@@ -92,15 +92,6 @@
                defer work.End(ctx, "Done.")
        }
 
-       if !enabled { // check this after the work progress message for testing.
-               return // prompt is disabled
-       }
-
-       if s.telemetryMode() == "on" || s.telemetryMode() == "off" {
-               // Telemetry is already on or explicitly off -- nothing to ask 
about.
-               return
-       }
-
        errorf := func(format string, args ...any) {
                err := fmt.Errorf(format, args...)
                event.Error(ctx, "telemetry prompt failed", err)
@@ -113,12 +104,14 @@
                return
        }
 
+       // Read the current prompt file.
+
        var (
                promptDir  = filepath.Join(configDir, "prompt")    // prompt 
configuration directory
                promptFile = filepath.Join(promptDir, "telemetry") // telemetry 
prompt file
        )
 
-       // prompt states, to be written to the prompt file
+       // prompt states, stored in the prompt file
        const (
                pYes     = "yes"     // user said yes
                pNo      = "no"      // user said no
@@ -139,10 +132,8 @@
        )
        if content, err := os.ReadFile(promptFile); err == nil {
                if _, err := fmt.Sscanf(string(content), "%s %d", &state, 
&attempts); err == nil && validStates[state] {
-                       if state == pYes || state == pNo {
-                               // Prompt has been answered. Nothing to do.
-                               return
-                       }
+                       // successfully parsed!
+                       //  ~ v0.16: must have only two fields, state and 
attempts.
                } else {
                        state, attempts = "", 0
                        errorf("malformed prompt result %q", string(content))
@@ -150,12 +141,55 @@
        } else if !os.IsNotExist(err) {
                errorf("reading prompt file: %v", err)
                // Something went wrong. Since we don't know how many times 
we've asked the
-               // prompt, err on the side of not spamming.
+               // prompt, err on the side of not asking.
+               //
+               // But record this in telemetry, in case some users enable 
telemetry by
+               // other means.
+               counter.New("gopls/telemetryprompt/corrupted").Inc()
                return
        }
 
-       if attempts >= 5 {
-               // We've tried asking enough; give up.
+       counter.New(fmt.Sprintf("gopls/telemetryprompt/attempts:%d", 
attempts)).Inc()
+
+       // Check terminal conditions.
+
+       if state == pYes {
+               // Prompt has been accepted.
+               //
+               // We record this counter for every gopls session, rather than 
when the
+               // prompt actually accepted below, because if we only recorded 
it in the
+               // counter file at the time telemetry is enabled, we'd never 
upload it,
+               // because we exclude any counter files that overlap with a 
time period
+               // that has telemetry uploading is disabled.
+               counter.New("gopls/telemetryprompt/accepted").Inc()
+               return
+       }
+       if state == pNo {
+               // Prompt has been declined. In most cases, this means we'll 
never see the
+               // counter below, but it's possible that the user may enable 
telemetry by
+               // other means later on. If we see a significant number of 
users that have
+               // accepted telemetry but declined the prompt, it may be an 
indication that
+               // the prompt is not working well.
+               counter.New("gopls/telemetryprompt/declined").Inc()
+               return
+       }
+       if attempts >= 5 { // pPending or pFailed
+               // We've tried asking enough; give up. Record that the prompt 
expired, in
+               // case the user decides to enable telemetry by other means 
later on.
+               // (see also the pNo case).
+               counter.New("gopls/telemetryprompt/expired").Inc()
+               return
+       }
+
+       // We only check enabled after (1) the work progress is started, and 
(2) the
+       // prompt file has been read. (1) is for testing purposes, and (2) is 
so that
+       // we record the "gopls/telemetryprompt/accepted" counter for every 
session.
+       if !enabled {
+               return // prompt is disabled
+       }
+
+       if s.telemetryMode() == "on" || s.telemetryMode() == "off" {
+               // Telemetry is already on or explicitly off -- nothing to ask 
about.
                return
        }
        if attempts == 0 {
@@ -237,7 +271,6 @@
                        result = pYes
                        if err := s.setTelemetryMode("on"); err == nil {
                                message(protocol.Info, 
telemetryOnMessage(s.Options().LinkifyShowMessage))
-                               
counter.New("gopls/telemetryprompt/accepted").Inc()
                        } else {
                                errorf("enabling telemetry failed: %v", err)
                                msg := fmt.Sprintf("Failed to enable Go 
telemetry: %v\nTo enable telemetry manually, please run `go run 
golang.org/x/telemetry/cmd/gotelemetry@latest on`", err)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/gopls-0.16.1/gopls/internal/test/integration/fake/editor.go 
new/gopls-0.16.2/gopls/internal/test/integration/fake/editor.go
--- old/gopls-0.16.1/gopls/internal/test/integration/fake/editor.go     
2024-07-01 17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/internal/test/integration/fake/editor.go     
2024-08-29 21:24:41.000000000 +0200
@@ -200,7 +200,8 @@
        return nil
 }
 
-// Close issues the shutdown and exit sequence an editor should.
+// Close disconnects the LSP client session.
+// TODO(rfindley): rename to 'Disconnect'.
 func (e *Editor) Close(ctx context.Context) error {
        if err := e.Shutdown(ctx); err != nil {
                return err
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/gopls-0.16.1/gopls/internal/test/integration/fake/workdir.go 
new/gopls-0.16.2/gopls/internal/test/integration/fake/workdir.go
--- old/gopls-0.16.1/gopls/internal/test/integration/fake/workdir.go    
2024-07-01 17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/internal/test/integration/fake/workdir.go    
2024-08-29 21:24:41.000000000 +0200
@@ -19,6 +19,7 @@
        "time"
 
        "golang.org/x/tools/gopls/internal/protocol"
+       "golang.org/x/tools/gopls/internal/util/slices"
        "golang.org/x/tools/internal/robustio"
 )
 
@@ -333,8 +334,7 @@
                return nil
        }
        w.watcherMu.Lock()
-       watchers := make([]func(context.Context, []protocol.FileEvent), 
len(w.watchers))
-       copy(watchers, w.watchers)
+       watchers := slices.Clone(w.watchers)
        w.watcherMu.Unlock()
        for _, w := range watchers {
                w(ctx, evts)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/gopls-0.16.1/gopls/internal/test/integration/misc/prompt_test.go 
new/gopls-0.16.2/gopls/internal/test/integration/misc/prompt_test.go
--- old/gopls-0.16.1/gopls/internal/test/integration/misc/prompt_test.go        
2024-07-01 17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/internal/test/integration/misc/prompt_test.go        
2024-08-29 21:24:41.000000000 +0200
@@ -11,6 +11,7 @@
        "regexp"
        "testing"
 
+       "github.com/google/go-cmp/cmp"
        "golang.org/x/telemetry/counter"
        "golang.org/x/telemetry/counter/countertest"
        "golang.org/x/tools/gopls/internal/protocol"
@@ -87,32 +88,63 @@
 }
 `
 
-       acceptanceCounterName := "gopls/telemetryprompt/accepted"
-       acceptanceCounter := counter.New(acceptanceCounterName)
-       // We must increment the acceptance counter in order for the initial 
read
-       // below to succeed.
+       var (
+               acceptanceCounter = "gopls/telemetryprompt/accepted"
+               declinedCounter   = "gopls/telemetryprompt/declined"
+               attempt1Counter   = "gopls/telemetryprompt/attempts:1"
+               allCounters       = []string{acceptanceCounter, 
declinedCounter, attempt1Counter}
+       )
+
+       // We must increment counters in order for the initial reads below to
+       // succeed.
        //
        // TODO(rfindley): ReadCounter should simply return 0 for uninitialized
        // counters.
-       acceptanceCounter.Inc()
+       for _, name := range allCounters {
+               counter.New(name).Inc()
+       }
+
+       readCounts := func(t *testing.T) map[string]uint64 {
+               t.Helper()
+               counts := make(map[string]uint64)
+               for _, name := range allCounters {
+                       count, err := countertest.ReadCounter(counter.New(name))
+                       if err != nil {
+                               t.Fatalf("ReadCounter(%q) failed: %v", name, 
err)
+                       }
+                       counts[name] = count
+               }
+               return counts
+       }
 
        tests := []struct {
-               name     string // subtest name
-               response string // response to choose for the telemetry dialog
-               wantMode string // resulting telemetry mode
-               wantMsg  string // substring contained in the follow-up popup 
(if empty, no popup is expected)
-               wantInc  uint64 // expected 'prompt accepted' counter increment
+               name       string // subtest name
+               response   string // response to choose for the telemetry dialog
+               wantMode   string // resulting telemetry mode
+               wantMsg    string // substring contained in the follow-up popup 
(if empty, no popup is expected)
+               wantInc    uint64 // expected 'prompt accepted' counter 
increment
+               wantCounts map[string]uint64
        }{
-               {"yes", server.TelemetryYes, "on", "uploading is now enabled", 
1},
-               {"no", server.TelemetryNo, "", "", 0},
-               {"empty", "", "", "", 0},
+               {"yes", server.TelemetryYes, "on", "uploading is now enabled", 
1, map[string]uint64{
+                       acceptanceCounter: 1,
+                       declinedCounter:   0,
+                       attempt1Counter:   1,
+               }},
+               {"no", server.TelemetryNo, "", "", 0, map[string]uint64{
+                       acceptanceCounter: 0,
+                       declinedCounter:   1,
+                       attempt1Counter:   1,
+               }},
+               {"empty", "", "", "", 0, map[string]uint64{
+                       acceptanceCounter: 0,
+                       declinedCounter:   0,
+                       attempt1Counter:   1,
+               }},
        }
+
        for _, test := range tests {
                t.Run(test.name, func(t *testing.T) {
-                       initialCount, err := 
countertest.ReadCounter(acceptanceCounter)
-                       if err != nil {
-                               t.Fatalf("ReadCounter(%q) failed: %v", 
acceptanceCounterName, err)
-                       }
+                       initialCounts := readCounts(t)
                        modeFile := filepath.Join(t.TempDir(), "mode")
                        msgRE := regexp.MustCompile(".*Would you like to enable 
Go telemetry?")
                        respond := func(m *protocol.ShowMessageRequestParams) 
(*protocol.MessageActionItem, error) {
@@ -156,12 +188,22 @@
                                if gotMode != test.wantMode {
                                        t.Errorf("after prompt, mode=%s, want 
%s", gotMode, test.wantMode)
                                }
-                               finalCount, err := 
countertest.ReadCounter(acceptanceCounter)
-                               if err != nil {
-                                       t.Fatalf("ReadCounter(%q) failed: %v", 
acceptanceCounterName, err)
+
+                               // We increment the acceptance counter when 
checking the prompt file
+                               // before prompting, so start a second, 
transient gopls session and
+                               // verify that the acceptance counter is 
incremented.
+                               env2 := ConnectGoplsEnv(t, env.Ctx, 
env.Sandbox, env.Editor.Config(), env.Server)
+                               
env2.Await(CompletedWork(server.TelemetryPromptWorkTitle, 1, true))
+                               if err := env2.Editor.Close(env2.Ctx); err != 
nil {
+                                       t.Errorf("closing second editor: %v", 
err)
+                               }
+
+                               gotCounts := readCounts(t)
+                               for k := range gotCounts {
+                                       gotCounts[k] -= initialCounts[k]
                                }
-                               if gotInc := finalCount - initialCount; gotInc 
!= test.wantInc {
-                                       t.Errorf("%q mismatch: got %d, want 
%d", acceptanceCounterName, gotInc, test.wantInc)
+                               if diff := cmp.Diff(test.wantCounts, 
gotCounts); diff != "" {
+                                       t.Errorf("counter mismatch (-want 
+got):\n%s", diff)
                                }
                        })
                })
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/gopls-0.16.1/gopls/internal/test/integration/misc/shared_test.go 
new/gopls-0.16.2/gopls/internal/test/integration/misc/shared_test.go
--- old/gopls-0.16.1/gopls/internal/test/integration/misc/shared_test.go        
2024-07-01 17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/internal/test/integration/misc/shared_test.go        
2024-08-29 21:24:41.000000000 +0200
@@ -8,7 +8,6 @@
        "testing"
 
        . "golang.org/x/tools/gopls/internal/test/integration"
-       "golang.org/x/tools/gopls/internal/test/integration/fake"
 )
 
 // Smoke test that simultaneous editing sessions in the same workspace works.
@@ -32,19 +31,7 @@
        ).Run(t, sharedProgram, func(t *testing.T, env1 *Env) {
                // Create a second test session connected to the same workspace 
and server
                // as the first.
-               awaiter := NewAwaiter(env1.Sandbox.Workdir)
-               editor, err := fake.NewEditor(env1.Sandbox, 
env1.Editor.Config()).Connect(env1.Ctx, env1.Server, awaiter.Hooks())
-               if err != nil {
-                       t.Fatal(err)
-               }
-               env2 := &Env{
-                       T:       t,
-                       Ctx:     env1.Ctx,
-                       Sandbox: env1.Sandbox,
-                       Server:  env1.Server,
-                       Editor:  editor,
-                       Awaiter: awaiter,
-               }
+               env2 := ConnectGoplsEnv(t, env1.Ctx, env1.Sandbox, 
env1.Editor.Config(), env1.Server)
                env2.Await(InitialWorkspaceLoad)
                // In editor #1, break fmt.Println as before.
                env1.OpenFile("main.go")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/gopls-0.16.1/gopls/internal/test/integration/runner.go 
new/gopls-0.16.2/gopls/internal/test/integration/runner.go
--- old/gopls-0.16.1/gopls/internal/test/integration/runner.go  2024-07-01 
17:21:22.000000000 +0200
+++ new/gopls-0.16.2/gopls/internal/test/integration/runner.go  2024-08-29 
21:24:41.000000000 +0200
@@ -215,19 +215,7 @@
                        framer = ls.framer(jsonrpc2.NewRawStream)
                        ts := servertest.NewPipeServer(ss, framer)
 
-                       awaiter := NewAwaiter(sandbox.Workdir)
-                       editor, err := fake.NewEditor(sandbox, 
config.editor).Connect(ctx, ts, awaiter.Hooks())
-                       if err != nil {
-                               t.Fatal(err)
-                       }
-                       env := &Env{
-                               T:       t,
-                               Ctx:     ctx,
-                               Sandbox: sandbox,
-                               Editor:  editor,
-                               Server:  ts,
-                               Awaiter: awaiter,
-                       }
+                       env := ConnectGoplsEnv(t, ctx, sandbox, config.editor, 
ts)
                        defer func() {
                                if t.Failed() && r.PrintGoroutinesOnFailure {
                                        
pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
@@ -242,7 +230,7 @@
                                // the editor: in general we want to clean up 
before proceeding to the
                                // next test, and if there is a deadlock 
preventing closing it will
                                // eventually be handled by the `go test` 
timeout.
-                               if err := editor.Close(xcontext.Detach(ctx)); 
err != nil {
+                               if err := 
env.Editor.Close(xcontext.Detach(ctx)); err != nil {
                                        t.Errorf("closing editor: %v", err)
                                }
                        }()
@@ -253,6 +241,28 @@
        }
 }
 
+// ConnectGoplsEnv creates a new Gopls environment for the given sandbox,
+// editor config, and server connector.
+//
+// TODO(rfindley): significantly refactor the way testing environments are
+// constructed.
+func ConnectGoplsEnv(t testing.TB, ctx context.Context, sandbox *fake.Sandbox, 
config fake.EditorConfig, connector servertest.Connector) *Env {
+       awaiter := NewAwaiter(sandbox.Workdir)
+       editor, err := fake.NewEditor(sandbox, config).Connect(ctx, connector, 
awaiter.Hooks())
+       if err != nil {
+               t.Fatal(err)
+       }
+       env := &Env{
+               T:       t,
+               Ctx:     ctx,
+               Sandbox: sandbox,
+               Server:  connector,
+               Editor:  editor,
+               Awaiter: awaiter,
+       }
+       return env
+}
+
 // longBuilders maps builders that are skipped when -short is set to a
 // (possibly empty) justification.
 var longBuilders = map[string]string{

++++++ vendor.tar.gz ++++++
++++ 1740 lines of diff (skipped)

Reply via email to