diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-01-22 16:07:17 +0100 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-01-23 10:42:36 +0000 |
| commit | 7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch) | |
| tree | e6fec4fd12ff807a16d847923f501075bf71d16c /vendor/github.com/raeperd/recvcheck/README.md | |
| parent | 475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff) | |
vendor: delete
Diffstat (limited to 'vendor/github.com/raeperd/recvcheck/README.md')
| -rw-r--r-- | vendor/github.com/raeperd/recvcheck/README.md | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/vendor/github.com/raeperd/recvcheck/README.md b/vendor/github.com/raeperd/recvcheck/README.md deleted file mode 100644 index db84fe38e..000000000 --- a/vendor/github.com/raeperd/recvcheck/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# recvcheck -[](https://github.com/raeperd/recvcheck/actions/workflows/build.yaml) [](https://goreportcard.com/report/github.com/raeperd/recvcheck) [](https://codecov.io/gh/raeperd/recvcheck) -Golang linter for check receiver type in method - -## Motivtation -From [Go Wiki: Go Code Review Comments - The Go Programming Language](https://go.dev/wiki/CodeReviewComments#receiver-type) -> Don’t mix receiver types. Choose either pointers or struct types for all available method - -Following code from [Dave Chenney](https://dave.cheney.net/2015/11/18/wednesday-pop-quiz-spot-the-race) causes data race. Could you find it? -This linter does it for you. - -```go -package main - -import ( - "fmt" - "time" -) - -type RPC struct { - result int - done chan struct{} -} - -func (rpc *RPC) compute() { - time.Sleep(time.Second) // strenuous computation intensifies - rpc.result = 42 - close(rpc.done) -} - -func (RPC) version() int { - return 1 // never going to need to change this -} - -func main() { - rpc := &RPC{done: make(chan struct{})} - - go rpc.compute() // kick off computation in the background - version := rpc.version() // grab some other information while we're waiting - <-rpc.done // wait for computation to finish - result := rpc.result - - fmt.Printf("RPC computation complete, result: %d, version: %d\n", result, version) -} -``` - -## References -- [Is there a way to detect following data race code using golangci-lint or other linter?? · golangci/golangci-lint · Discussion #5006](https://github.com/golangci/golangci-lint/discussions/5006) - - [Wednesday pop quiz: spot the race | Dave Cheney](https://dave.cheney.net/2015/11/18/wednesday-pop-quiz-spot-the-race) - - - |
