aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/sonatard
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-01-22 16:07:17 +0100
committerTaras Madan <tarasmadan@google.com>2025-01-23 10:42:36 +0000
commit7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch)
treee6fec4fd12ff807a16d847923f501075bf71d16c /vendor/github.com/sonatard
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/sonatard')
-rw-r--r--vendor/github.com/sonatard/noctx/.gitignore2
-rw-r--r--vendor/github.com/sonatard/noctx/.golangci.yml38
-rw-r--r--vendor/github.com/sonatard/noctx/.goreleaser.yml37
-rw-r--r--vendor/github.com/sonatard/noctx/LICENSE21
-rw-r--r--vendor/github.com/sonatard/noctx/Makefile18
-rw-r--r--vendor/github.com/sonatard/noctx/README.md177
-rw-r--r--vendor/github.com/sonatard/noctx/ngfunc/main.go62
-rw-r--r--vendor/github.com/sonatard/noctx/ngfunc/report.go29
-rw-r--r--vendor/github.com/sonatard/noctx/ngfunc/types.go65
-rw-r--r--vendor/github.com/sonatard/noctx/noctx.go36
-rw-r--r--vendor/github.com/sonatard/noctx/reqwithoutctx/main.go14
-rw-r--r--vendor/github.com/sonatard/noctx/reqwithoutctx/report.go26
-rw-r--r--vendor/github.com/sonatard/noctx/reqwithoutctx/ssa.go184
13 files changed, 0 insertions, 709 deletions
diff --git a/vendor/github.com/sonatard/noctx/.gitignore b/vendor/github.com/sonatard/noctx/.gitignore
deleted file mode 100644
index 8dfb40ff1..000000000
--- a/vendor/github.com/sonatard/noctx/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-coverage.out
-/noctx
diff --git a/vendor/github.com/sonatard/noctx/.golangci.yml b/vendor/github.com/sonatard/noctx/.golangci.yml
deleted file mode 100644
index 726cb7c89..000000000
--- a/vendor/github.com/sonatard/noctx/.golangci.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-linters:
- enable-all: true
- disable:
- - execinquery # deprecated
- - exportloopref # deprecated
- - gomnd # deprecated
- - gochecknoglobals
- - exhaustruct
- - mnd
- - gocognit
- - nestif
- - nilnil
- - paralleltest
- - varnamelen
-
-linters-settings:
- govet:
- enable-all: true
- perfsprint:
- err-error: true
- errorf: true
- sprintf1: true
- strconcat: false
- depguard:
- rules:
- main:
- deny:
- - pkg: "github.com/instana/testify"
- desc: not allowed
- - pkg: "github.com/pkg/errors"
- desc: Should be replaced by standard lib errors package
-
-output:
- show-stats: true
- sort-results: true
- sort-order:
- - linter
- - file
diff --git a/vendor/github.com/sonatard/noctx/.goreleaser.yml b/vendor/github.com/sonatard/noctx/.goreleaser.yml
deleted file mode 100644
index 9000b50a1..000000000
--- a/vendor/github.com/sonatard/noctx/.goreleaser.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-version: 2
-project_name: noctx
-
-builds:
- - binary: noctx
-
- main: ./cmd/noctx/main.go
- env:
- - CGO_ENABLED=0
- flags:
- - -trimpath
- goos:
- - windows
- - darwin
- - linux
- goarch:
- - amd64
- - 386
- - arm
- - arm64
- goarm:
- - 7
- - 6
- - 5
- ignore:
- - goos: darwin
- goarch: 386
-
-archives:
- - id: noctx
- name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
- format: tar.gz
- format_overrides:
- - goos: windows
- format: zip
- files:
- - LICENSE
diff --git a/vendor/github.com/sonatard/noctx/LICENSE b/vendor/github.com/sonatard/noctx/LICENSE
deleted file mode 100644
index a00d5727f..000000000
--- a/vendor/github.com/sonatard/noctx/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2020 sonatard
-
-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/sonatard/noctx/Makefile b/vendor/github.com/sonatard/noctx/Makefile
deleted file mode 100644
index 585a9d7e2..000000000
--- a/vendor/github.com/sonatard/noctx/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-.PHONY: all imports test lint build
-
-all: imports test lint build
-
-imports:
- goimports -w ./
-
-test:
- go test -race ./...
-
-test_coverage:
- go test -race -coverprofile=coverage.out -covermode=atomic ./...
-
-lint:
- golangci-lint run ./...
-
-build:
- go build -ldflags "-s -w" -trimpath ./cmd/noctx/
diff --git a/vendor/github.com/sonatard/noctx/README.md b/vendor/github.com/sonatard/noctx/README.md
deleted file mode 100644
index 00d0024c5..000000000
--- a/vendor/github.com/sonatard/noctx/README.md
+++ /dev/null
@@ -1,177 +0,0 @@
-# noctx
-
-![](https://github.com/sonatard/noctx/workflows/CI/badge.svg)
-
-`noctx` finds sending http request without context.Context.
-
-You should use `noctx` if sending http request in your library.
-Passing `context.Context` enables library user to cancel http request, getting trace information and so on.
-
-## Usage
-
-
-### noctx with go vet
-
-go vet is a Go standard tool for analyzing source code.
-
-1. Install noctx.
-```sh
-$ go install github.com/sonatard/noctx/cmd/noctx@latest
-```
-
-2. noctx execute
-```sh
-$ go vet -vettool=`which noctx` main.go
-./main.go:6:11: net/http.Get must not be called
-```
-
-### noctx with golangci-lint
-
-golangci-lint is a fast Go linters runner.
-
-1. Install golangci-lint.
-[golangci-lint - Install](https://golangci-lint.run/usage/install/)
-
-2. Setup .golangci.yml
-```yaml:
-# Add noctx to enable linters.
-linters:
- enable:
- - noctx
-
-# Or enable-all is true.
-linters:
- enable-all: true
- disable:
- - xxx # Add unused linter to disable linters.
-```
-
-3. noctx execute
-```sh
-# Use .golangci.yml
-$ golangci-lint run
-
-# Only noctx execute
-golangci-lint run --enable-only noctx
-```
-
-## Detection rules
-
-- Executing following functions
- - `net/http.Get`
- - `net/http.Head`
- - `net/http.Post`
- - `net/http.PostForm`
- - `(*net/http.Client).Get`
- - `(*net/http.Client).Head`
- - `(*net/http.Client).Post`
- - `(*net/http.Client).PostForm`
-- `http.Request` returned by `http.NewRequest` function and passes it to other function.
-
-## How to fix
-
-- Send http request using `(*http.Client).Do(*http.Request)` method.
-- In Go 1.13 and later, use `http.NewRequestWithContext` function instead of using `http.NewRequest` function.
-- In Go 1.12 and earlier, call `(http.Request).WithContext(ctx)` after `http.NewRequest`.
-
-`(http.Request).WithContext(ctx)` has a disadvantage of performance because it returns a copy of `http.Request`. Use `http.NewRequestWithContext` function if you only support Go1.13 or later.
-
-
-If your library already provides functions that don't accept context, you define a new function that accepts context and make the existing function a wrapper for a new function.
-
-
-```go
-// Before fix code
-// Sending an HTTP request but not accepting context
-func Send(body io.Reader) error {
- req,err := http.NewRequest(http.MethodPost, "http://example.com", body)
- if err != nil {
- return err
- }
- _, err = http.DefaultClient.Do(req)
- if err != nil{
- return err
- }
-
- return nil
-}
-```
-
-```go
-// After fix code
-func Send(body io.Reader) error {
- // Pass context.Background() to SendWithContext
- return SendWithContext(context.Background(), body)
-}
-
-// Sending an HTTP request and accepting context
-func SendWithContext(ctx context.Context, body io.Reader) error {
- // Change NewRequest to NewRequestWithContext and pass context it
- req, err := http.NewRequestWithContext(ctx, http.MethodPost, "http://example.com", body)
- if err != nil {
- return err
- }
- _, err = http.DefaultClient.Do(req)
- if err != nil {
- return err
- }
-
- return nil
-}
-```
-
-## Detection sample
-
-```go
-package main
-
-import (
- "context"
- "net/http"
-)
-
-func main() {
- const url = "http://example.com"
- http.Get(url) // want `net/http\.Get must not be called`
- http.Head(url) // want `net/http\.Head must not be called`
- http.Post(url, "", nil) // want `net/http\.Post must not be called`
- http.PostForm(url, nil) // want `net/http\.PostForm must not be called`
-
- cli := &http.Client{}
- cli.Get(url) // want `\(\*net/http\.Client\)\.Get must not be called`
- cli.Head(url) // want `\(\*net/http\.Client\)\.Head must not be called`
- cli.Post(url, "", nil) // want `\(\*net/http\.Client\)\.Post must not be called`
- cli.PostForm(url, nil) // want `\(\*net/http\.Client\)\.PostForm must not be called`
-
- req, _ := http.NewRequest(http.MethodPost, url, nil) // want `should rewrite http.NewRequestWithContext or add \(\*Request\).WithContext`
- cli.Do(req)
-
- ctx := context.Background()
- req2, _ := http.NewRequestWithContext(ctx, http.MethodPost, url, nil) // OK
- cli.Do(req2)
-
- req3, _ := http.NewRequest(http.MethodPost, url, nil) // OK
- req3 = req3.WithContext(ctx)
- cli.Do(req3)
-
- f2 := func(req *http.Request, ctx context.Context) *http.Request {
- return req
- }
- req4, _ := http.NewRequest(http.MethodPost, url, nil) // want `should rewrite http.NewRequestWithContext or add \(\*Request\).WithContext`
- req4 = f2(req4, ctx)
- cli.Do(req4)
-
- req5, _ := func() (*http.Request, error) {
- return http.NewRequest(http.MethodPost, url, nil) // want `should rewrite http.NewRequestWithContext or add \(\*Request\).WithContext`
- }()
- cli.Do(req5)
-
-}
-```
-
-## Reference
-
-- [net/http - NewRequest](https://golang.org/pkg/net/http/#NewRequest)
-- [net/http - NewRequestWithContext](https://golang.org/pkg/net/http/#NewRequestWithContext)
-- [net/http - Request.WithContext](https://golang.org/pkg/net/http/#Request.WithContext)
-
diff --git a/vendor/github.com/sonatard/noctx/ngfunc/main.go b/vendor/github.com/sonatard/noctx/ngfunc/main.go
deleted file mode 100644
index 8d8d97d93..000000000
--- a/vendor/github.com/sonatard/noctx/ngfunc/main.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package ngfunc
-
-import (
- "fmt"
- "go/types"
-
- "github.com/gostaticanalysis/analysisutil"
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/buildssa"
-)
-
-func Run(pass *analysis.Pass) (interface{}, error) {
- ngFuncNames := []string{
- "net/http.Get",
- "net/http.Head",
- "net/http.Post",
- "net/http.PostForm",
- "(*net/http.Client).Get",
- "(*net/http.Client).Head",
- "(*net/http.Client).Post",
- "(*net/http.Client).PostForm",
- }
-
- ngFuncs := typeFuncs(pass, ngFuncNames)
- if len(ngFuncs) == 0 {
- return nil, nil
- }
-
- reportFuncs := ngCalledFuncs(pass, ngFuncs)
- report(pass, reportFuncs)
-
- return nil, nil
-}
-
-func ngCalledFuncs(pass *analysis.Pass, ngFuncs []*types.Func) []*Report {
- var reports []*Report
-
- ssa, ok := pass.ResultOf[buildssa.Analyzer].(*buildssa.SSA)
- if !ok {
- panic(fmt.Sprintf("%T is not *buildssa.SSA", pass.ResultOf[buildssa.Analyzer]))
- }
-
- for _, sf := range ssa.SrcFuncs {
- for _, b := range sf.Blocks {
- for _, instr := range b.Instrs {
- for _, ngFunc := range ngFuncs {
- if analysisutil.Called(instr, nil, ngFunc) {
- ngCalledFunc := &Report{
- Instruction: instr,
- function: ngFunc,
- }
- reports = append(reports, ngCalledFunc)
-
- break
- }
- }
- }
- }
- }
-
- return reports
-}
diff --git a/vendor/github.com/sonatard/noctx/ngfunc/report.go b/vendor/github.com/sonatard/noctx/ngfunc/report.go
deleted file mode 100644
index 735aa1cf9..000000000
--- a/vendor/github.com/sonatard/noctx/ngfunc/report.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package ngfunc
-
-import (
- "fmt"
- "go/token"
- "go/types"
-
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/ssa"
-)
-
-type Report struct {
- Instruction ssa.Instruction
- function *types.Func
-}
-
-func (n *Report) Pos() token.Pos {
- return n.Instruction.Pos()
-}
-
-func (n *Report) Message() string {
- return fmt.Sprintf("%s must not be called", n.function.FullName())
-}
-
-func report(pass *analysis.Pass, reports []*Report) {
- for _, report := range reports {
- pass.Reportf(report.Pos(), "%s", report.Message())
- }
-}
diff --git a/vendor/github.com/sonatard/noctx/ngfunc/types.go b/vendor/github.com/sonatard/noctx/ngfunc/types.go
deleted file mode 100644
index 8f81c6aa2..000000000
--- a/vendor/github.com/sonatard/noctx/ngfunc/types.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package ngfunc
-
-import (
- "errors"
- "go/types"
- "strings"
-
- "github.com/gostaticanalysis/analysisutil"
- "golang.org/x/tools/go/analysis"
-)
-
-var errNotFound = errors.New("function not found")
-
-func typeFuncs(pass *analysis.Pass, funcs []string) []*types.Func {
- fs := make([]*types.Func, 0, len(funcs))
-
- for _, fn := range funcs {
- f, err := typeFunc(pass, fn)
- if err != nil {
- continue
- }
-
- fs = append(fs, f)
- }
-
- return fs
-}
-
-func typeFunc(pass *analysis.Pass, funcName string) (*types.Func, error) {
- ss := strings.Split(strings.TrimSpace(funcName), ".")
-
- switch len(ss) {
- case 2:
- // package function: pkgname.Func
- f, ok := analysisutil.ObjectOf(pass, ss[0], ss[1]).(*types.Func)
- if !ok || f == nil {
- return nil, errNotFound
- }
-
- return f, nil
- case 3:
- // method: (*pkgname.Type).Method
- pkgname := strings.TrimLeft(ss[0], "(")
- typename := strings.TrimRight(ss[1], ")")
-
- if pkgname != "" && pkgname[0] == '*' {
- pkgname = pkgname[1:]
- typename = "*" + typename
- }
-
- typ := analysisutil.TypeOf(pass, pkgname, typename)
- if typ == nil {
- return nil, errNotFound
- }
-
- m := analysisutil.MethodOf(typ, ss[2])
- if m == nil {
- return nil, errNotFound
- }
-
- return m, nil
- }
-
- return nil, errNotFound
-}
diff --git a/vendor/github.com/sonatard/noctx/noctx.go b/vendor/github.com/sonatard/noctx/noctx.go
deleted file mode 100644
index fbffb66e7..000000000
--- a/vendor/github.com/sonatard/noctx/noctx.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package noctx
-
-import (
- "fmt"
-
- "github.com/sonatard/noctx/ngfunc"
- "github.com/sonatard/noctx/reqwithoutctx"
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/buildssa"
-)
-
-var Analyzer = &analysis.Analyzer{
- Name: "noctx",
- Doc: Doc,
- Run: run,
- RunDespiteErrors: false,
- Requires: []*analysis.Analyzer{
- buildssa.Analyzer,
- },
- ResultType: nil,
- FactTypes: nil,
-}
-
-const Doc = "noctx finds sending http request without context.Context"
-
-func run(pass *analysis.Pass) (interface{}, error) {
- if _, err := ngfunc.Run(pass); err != nil {
- return nil, fmt.Errorf("run: %w", err)
- }
-
- if _, err := reqwithoutctx.Run(pass); err != nil {
- return nil, fmt.Errorf("run: %w", err)
- }
-
- return nil, nil
-}
diff --git a/vendor/github.com/sonatard/noctx/reqwithoutctx/main.go b/vendor/github.com/sonatard/noctx/reqwithoutctx/main.go
deleted file mode 100644
index b09e1de1b..000000000
--- a/vendor/github.com/sonatard/noctx/reqwithoutctx/main.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package reqwithoutctx
-
-import (
- "golang.org/x/tools/go/analysis"
-)
-
-func Run(pass *analysis.Pass) (interface{}, error) {
- analyzer := NewAnalyzer(pass)
- reports := analyzer.Exec()
-
- report(pass, reports)
-
- return nil, nil
-}
diff --git a/vendor/github.com/sonatard/noctx/reqwithoutctx/report.go b/vendor/github.com/sonatard/noctx/reqwithoutctx/report.go
deleted file mode 100644
index 3bf2ea01f..000000000
--- a/vendor/github.com/sonatard/noctx/reqwithoutctx/report.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package reqwithoutctx
-
-import (
- "go/token"
-
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/ssa"
-)
-
-type Report struct {
- Instruction ssa.Instruction
-}
-
-func (n *Report) Pos() token.Pos {
- return n.Instruction.Pos()
-}
-
-func (n *Report) Message() string {
- return "should rewrite http.NewRequestWithContext or add (*Request).WithContext"
-}
-
-func report(pass *analysis.Pass, reports []*Report) {
- for _, report := range reports {
- pass.Reportf(report.Pos(), "%s", report.Message())
- }
-}
diff --git a/vendor/github.com/sonatard/noctx/reqwithoutctx/ssa.go b/vendor/github.com/sonatard/noctx/reqwithoutctx/ssa.go
deleted file mode 100644
index 62707c6b5..000000000
--- a/vendor/github.com/sonatard/noctx/reqwithoutctx/ssa.go
+++ /dev/null
@@ -1,184 +0,0 @@
-package reqwithoutctx
-
-import (
- "fmt"
- "go/types"
-
- "github.com/gostaticanalysis/analysisutil"
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/buildssa"
- "golang.org/x/tools/go/ssa"
-)
-
-//nolint:govet
-type Analyzer struct {
- Funcs []*ssa.Function
- newRequestType types.Type
- requestType types.Type
-}
-
-func NewAnalyzer(pass *analysis.Pass) *Analyzer {
- newRequestType := analysisutil.TypeOf(pass, "net/http", "NewRequest")
- requestType := analysisutil.TypeOf(pass, "net/http", "*Request")
-
- ssa, ok := pass.ResultOf[buildssa.Analyzer].(*buildssa.SSA)
- if !ok {
- panic(fmt.Sprintf("%T is not *buildssa.SSA", pass.ResultOf[buildssa.Analyzer]))
- }
-
- return &Analyzer{
- Funcs: ssa.SrcFuncs,
- newRequestType: newRequestType,
- requestType: requestType,
- }
-}
-
-func (a *Analyzer) Exec() []*Report {
- if a.newRequestType == nil || a.requestType == nil {
- return []*Report{}
- }
-
- usedReqs := a.usedReqs()
- newReqs := a.requestsByNewRequest()
-
- return a.report(usedReqs, newReqs)
-}
-
-func (a *Analyzer) report(usedReqs map[string]*ssa.Extract, newReqs map[*ssa.Call]*ssa.Extract) []*Report {
- var reports []*Report
-
- for _, fReq := range usedReqs {
- for newRequest, req := range newReqs {
- if fReq == req {
- reports = append(reports, &Report{Instruction: newRequest})
- }
- }
- }
-
- return reports
-}
-
-func (a *Analyzer) usedReqs() map[string]*ssa.Extract {
- reqExts := make(map[string]*ssa.Extract)
-
- for _, f := range a.Funcs {
- for _, b := range f.Blocks {
- for _, instr := range b.Instrs {
- switch i := instr.(type) {
- case *ssa.Call:
- exts := a.usedReqByCall(i)
- for _, ext := range exts {
- key := i.String() + ext.String()
- reqExts[key] = ext
- }
- case *ssa.UnOp:
- ext := a.usedReqByUnOp(i)
- if ext != nil {
- key := i.String() + ext.String()
- reqExts[key] = ext
- }
- case *ssa.Return:
- exts := a.usedReqByReturn(i)
- for _, ext := range exts {
- key := i.String() + ext.String()
- reqExts[key] = ext
- }
- }
- }
- }
- }
-
- return reqExts
-}
-
-func (a *Analyzer) usedReqByCall(call *ssa.Call) []*ssa.Extract {
- args := call.Common().Args
- exts := make([]*ssa.Extract, 0, len(args))
-
- // skip net/http.Request method call
- if recv := call.Common().Signature().Recv(); recv != nil && types.Identical(recv.Type(), a.requestType) {
- return exts
- }
-
- if len(args) == 0 {
- return exts
- }
-
- for _, arg := range args {
- ext, ok := arg.(*ssa.Extract)
- if !ok {
- continue
- }
-
- if !types.Identical(ext.Type(), a.requestType) {
- continue
- }
-
- exts = append(exts, ext)
- }
-
- return exts
-}
-
-func (a *Analyzer) usedReqByUnOp(op *ssa.UnOp) *ssa.Extract {
- if ext, ok := op.X.(*ssa.Extract); ok && types.Identical(ext.Type(), a.requestType) {
- return ext
- }
-
- return nil
-}
-
-func (a *Analyzer) usedReqByReturn(ret *ssa.Return) []*ssa.Extract {
- rets := ret.Results
- exts := make([]*ssa.Extract, 0, len(rets))
-
- for _, ret := range rets {
- ext, ok := ret.(*ssa.Extract)
- if !ok {
- continue
- }
-
- if types.Identical(ext.Type(), a.requestType) {
- exts = append(exts, ext)
- }
- }
-
- return exts
-}
-
-func (a *Analyzer) requestsByNewRequest() map[*ssa.Call]*ssa.Extract {
- reqs := make(map[*ssa.Call]*ssa.Extract)
-
- for _, f := range a.Funcs {
- for _, b := range f.Blocks {
- for _, instr := range b.Instrs {
- ext, ok := instr.(*ssa.Extract)
- if !ok {
- continue
- }
-
- if !types.Identical(ext.Type(), a.requestType) {
- continue
- }
-
- operands := ext.Operands([]*ssa.Value{})
- if len(operands) != 1 {
- continue
- }
-
- operand := *operands[0]
-
- f, ok := operand.(*ssa.Call)
- if !ok {
- continue
- }
-
- if types.Identical(f.Call.Value.Type(), a.newRequestType) {
- reqs[f] = ext
- }
- }
- }
- }
-
- return reqs
-}