From 7b4377ad9d8a7205416df8d6217ef2b010f89481 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 22 Jan 2025 16:07:17 +0100 Subject: vendor: delete --- vendor/github.com/raeperd/recvcheck/.gitignore | 2 - vendor/github.com/raeperd/recvcheck/LICENSE | 21 -------- vendor/github.com/raeperd/recvcheck/Makefile | 14 ----- vendor/github.com/raeperd/recvcheck/README.md | 52 ------------------- vendor/github.com/raeperd/recvcheck/analyzer.go | 69 ------------------------- 5 files changed, 158 deletions(-) delete mode 100644 vendor/github.com/raeperd/recvcheck/.gitignore delete mode 100644 vendor/github.com/raeperd/recvcheck/LICENSE delete mode 100644 vendor/github.com/raeperd/recvcheck/Makefile delete mode 100644 vendor/github.com/raeperd/recvcheck/README.md delete mode 100644 vendor/github.com/raeperd/recvcheck/analyzer.go (limited to 'vendor/github.com/raeperd') diff --git a/vendor/github.com/raeperd/recvcheck/.gitignore b/vendor/github.com/raeperd/recvcheck/.gitignore deleted file mode 100644 index 035dc07e3..000000000 --- a/vendor/github.com/raeperd/recvcheck/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -coverage.txt -cmd/recvcheck/recvcheck diff --git a/vendor/github.com/raeperd/recvcheck/LICENSE b/vendor/github.com/raeperd/recvcheck/LICENSE deleted file mode 100644 index a46db59be..000000000 --- a/vendor/github.com/raeperd/recvcheck/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 raeperd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/raeperd/recvcheck/Makefile b/vendor/github.com/raeperd/recvcheck/Makefile deleted file mode 100644 index 45ca47d9b..000000000 --- a/vendor/github.com/raeperd/recvcheck/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -all: build test lint - -download: - go mod download - -build: download - go build -C cmd/recvcheck - -test: - go test -race -coverprofile=coverage.txt . - -lint: - golangci-lint run - 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 -[![.github/workflows/build.yaml](https://github.com/raeperd/recvcheck/actions/workflows/build.yaml/badge.svg)](https://github.com/raeperd/recvcheck/actions/workflows/build.yaml) [![Go Report Card](https://goreportcard.com/badge/github.com/raeperd/recvcheck)](https://goreportcard.com/report/github.com/raeperd/recvcheck) [![codecov](https://codecov.io/gh/raeperd/recvcheck/graph/badge.svg?token=fPYgEHlq1e)](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) - - - diff --git a/vendor/github.com/raeperd/recvcheck/analyzer.go b/vendor/github.com/raeperd/recvcheck/analyzer.go deleted file mode 100644 index e80dfc577..000000000 --- a/vendor/github.com/raeperd/recvcheck/analyzer.go +++ /dev/null @@ -1,69 +0,0 @@ -package recvcheck - -import ( - "go/ast" - - "golang.org/x/tools/go/analysis" - "golang.org/x/tools/go/analysis/passes/inspect" - "golang.org/x/tools/go/ast/inspector" -) - -var Analyzer = &analysis.Analyzer{ - Name: "recvcheck", - Doc: "checks for receiver type consistency", - Run: run, - Requires: []*analysis.Analyzer{inspect.Analyzer}, -} - -func run(pass *analysis.Pass) (any, error) { - inspector := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector) - - structs := map[string]*structType{} - inspector.Preorder([]ast.Node{(*ast.FuncDecl)(nil)}, func(n ast.Node) { - funcDecl, ok := n.(*ast.FuncDecl) - if !ok || funcDecl.Recv == nil || len(funcDecl.Recv.List) != 1 { - return - } - - var recv *ast.Ident - var isStar bool - switch recvType := funcDecl.Recv.List[0].Type.(type) { - case *ast.StarExpr: - isStar = true - if recv, ok = recvType.X.(*ast.Ident); !ok { - return - } - case *ast.Ident: - recv = recvType - default: - return - } - - var st *structType - st, ok = structs[recv.Name] - if !ok { - structs[recv.Name] = &structType{recv: recv.Name} - st = structs[recv.Name] - } - - if isStar { - st.numStarMethod++ - } else { - st.numTypeMethod++ - } - }) - - for _, st := range structs { - if st.numStarMethod > 0 && st.numTypeMethod > 0 { - pass.Reportf(pass.Pkg.Scope().Lookup(st.recv).Pos(), "the methods of %q use pointer receiver and non-pointer receiver.", st.recv) - } - } - - return nil, nil -} - -type structType struct { - recv string - numStarMethod int - numTypeMethod int -} -- cgit mrf-deployment