Skip to content

Commit 17e2d70

Browse files
committed
gopls/internal/bug: remove unused Data parameter
Change-Id: Iedef0b5a20bda8c5e3c82a7b763fbb8e659f2967 Reviewed-on: https://go-review.googlesource.com/c/tools/+/488615 gopls-CI: kokoro <[email protected]> Run-TryBot: Alan Donovan <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent dd89a2e commit 17e2d70

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

gopls/internal/bug/bug.go

+5-10
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,30 @@ type Bug struct {
3636
File string // file containing the call to bug.Report
3737
Line int // line containing the call to bug.Report
3838
Description string // description of the bug
39-
Data Data // additional metadata
4039
Key string // key identifying the bug (file:line if available)
4140
Stack string // call stack
4241
}
4342

44-
// Data is additional metadata to record for a bug.
45-
type Data map[string]interface{}
46-
4743
// Reportf reports a formatted bug message.
4844
func Reportf(format string, args ...interface{}) {
49-
report(fmt.Sprintf(format, args...), nil)
45+
report(fmt.Sprintf(format, args...))
5046
}
5147

5248
// Errorf calls fmt.Errorf for the given arguments, and reports the resulting
5349
// error message as a bug.
5450
func Errorf(format string, args ...interface{}) error {
5551
err := fmt.Errorf(format, args...)
56-
report(err.Error(), nil)
52+
report(err.Error())
5753
return err
5854
}
5955

6056
// Report records a new bug encountered on the server.
6157
// It uses reflection to report the position of the immediate caller.
62-
func Report(description string, data Data) {
63-
report(description, data)
58+
func Report(description string) {
59+
report(description)
6460
}
6561

66-
func report(description string, data Data) {
62+
func report(description string) {
6763
_, file, line, ok := runtime.Caller(2) // all exported reporting functions call report directly
6864

6965
key := "<missing callsite>"
@@ -79,7 +75,6 @@ func report(description string, data Data) {
7975
File: file,
8076
Line: line,
8177
Description: description,
82-
Data: data,
8378
Key: key,
8479
Stack: string(debug.Stack()),
8580
}

gopls/internal/bug/bug_test.go

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ func resetForTesting() {
1717
func TestListBugs(t *testing.T) {
1818
defer resetForTesting()
1919

20-
Report("bad", nil)
20+
Report("bad")
2121

2222
wantBugs(t, "bad")
2323

2424
for i := 0; i < 3; i++ {
25-
Report(fmt.Sprintf("index:%d", i), nil)
25+
Report(fmt.Sprintf("index:%d", i))
2626
}
2727

2828
wantBugs(t, "bad", "index:0")
@@ -47,19 +47,16 @@ func wantBugs(t *testing.T, want ...string) {
4747
func TestBugNotification(t *testing.T) {
4848
defer resetForTesting()
4949

50-
Report("unseen", nil)
50+
Report("unseen")
5151

5252
notify1 := Notify()
5353
notify2 := Notify()
5454

55-
Report("seen", Data{"answer": 42})
55+
Report("seen")
5656

5757
for _, got := range []Bug{<-notify1, <-notify2} {
5858
if got, want := got.Description, "seen"; got != want {
5959
t.Errorf("Saw bug %q, want %q", got, want)
6060
}
61-
if got, want := got.Data["answer"], 42; got != want {
62-
t.Errorf(`bug.Data["answer"] = %v, want %v`, got, want)
63-
}
6461
}
6562
}

gopls/internal/lsp/debug/serve.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ func (i *Instance) Serve(ctx context.Context, addr string) (string, error) {
469469
http.Error(w, "OK", 200)
470470
})
471471
mux.HandleFunc("/_makeabug", func(w http.ResponseWriter, r *http.Request) {
472-
bug.Report("bug here", nil)
472+
bug.Report("bug here")
473473
http.Error(w, "made a bug", http.StatusOK)
474474
})
475475

gopls/internal/regtest/debug/debug_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestBugNotification(t *testing.T) {
2424
Settings{"showBugReports": true},
2525
).Run(t, "", func(t *testing.T, env *Env) {
2626
const desc = "got a bug"
27-
bug.Report(desc, nil)
27+
bug.Report(desc)
2828
env.Await(ShownMessage(desc))
2929
})
3030
}

0 commit comments

Comments
 (0)