Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address review feedback to eliminate race condition
  • Loading branch information
gmlewis committed Jul 21, 2021
commit 6867ee340521a06a8caa519d8907543fb579f0d4
3 changes: 2 additions & 1 deletion github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ type service struct {
func (c *Client) Client() *http.Client {
c.clientMu.Lock()
defer c.clientMu.Unlock()
return c.client
clientCopy := *c.client
return &clientCopy
}

// ListOptions specifies the optional parameters to various List methods that
Expand Down
4 changes: 2 additions & 2 deletions github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ func TestNewClient(t *testing.T) {
func TestClient(t *testing.T) {
c := NewClient(nil)
c2 := c.Client()
if c.client != c2 {
t.Error("Client returned different http.Client, but should be the same.")
if c.client == c2 {
t.Error("Client returned same http.Client, but should be different")
}
}

Expand Down