aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/sivchari
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/sivchari
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/sivchari')
-rw-r--r--vendor/github.com/sivchari/containedctx/.golangci.yml38
-rw-r--r--vendor/github.com/sivchari/containedctx/LICENCE21
-rw-r--r--vendor/github.com/sivchari/containedctx/README.md64
-rw-r--r--vendor/github.com/sivchari/containedctx/containedctx.go45
-rw-r--r--vendor/github.com/sivchari/tenv/.gitignore17
-rw-r--r--vendor/github.com/sivchari/tenv/.golangci.yml38
-rw-r--r--vendor/github.com/sivchari/tenv/LICENSE21
-rw-r--r--vendor/github.com/sivchari/tenv/README.md107
-rw-r--r--vendor/github.com/sivchari/tenv/goreleaser.yaml26
-rw-r--r--vendor/github.com/sivchari/tenv/tenv.go223
-rw-r--r--vendor/github.com/sivchari/tenv/tenv.pngbin247119 -> 0 bytes
11 files changed, 0 insertions, 600 deletions
diff --git a/vendor/github.com/sivchari/containedctx/.golangci.yml b/vendor/github.com/sivchari/containedctx/.golangci.yml
deleted file mode 100644
index f687df836..000000000
--- a/vendor/github.com/sivchari/containedctx/.golangci.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-run:
- timeout: 5m
- skip-files: []
-
-linters-settings:
- govet:
- enable-all: true
- disable:
- - fieldalignment
- gocyclo:
- min-complexity: 12
- misspell:
- locale: US
- godox:
- keywords:
- - FIXME
- gofumpt:
- extra-rules: true
-
-linters:
- disable-all: true
- enable:
- - govet
- - revive
- - goimports
- - staticcheck
- - gosimple
- - unused
- - godox
- - gofumpt
- - misspell
- - gocyclo
-
-issues:
- exclude-use-default: true
- max-per-linter: 0
- max-same-issues: 0
- exclude: []
diff --git a/vendor/github.com/sivchari/containedctx/LICENCE b/vendor/github.com/sivchari/containedctx/LICENCE
deleted file mode 100644
index 5185ec09a..000000000
--- a/vendor/github.com/sivchari/containedctx/LICENCE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2021 sivchari
-
-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/sivchari/containedctx/README.md b/vendor/github.com/sivchari/containedctx/README.md
deleted file mode 100644
index 0c2dd208d..000000000
--- a/vendor/github.com/sivchari/containedctx/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# containedctx
-
-[![test_and_lint](https://github.com/sivchari/containedctx/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sivchari/containedctx/actions/workflows/ci.yml)
-
-containedctx is a linter that detects struct contained context.Context field.
-This is discouraged technique in favour of passing context as first argument of method or function.
-For rationale please read [Contexts and structs](https://go.dev/blog/context-and-structs) the Go blog post.
-
-## Instruction
-
-```sh
-go install github.com/sivchari/containedctx/cmd/containedctx
-```
-
-## Usage
-
-```go
-package main
-
-import "context"
-
-type ok struct {
- i int
- s string
-}
-
-type ng struct {
- ctx context.Context
-}
-
-type empty struct{}
-```
-
-```console
-go vet -vettool=(which containedctx) ./...
-
-# a
-./main.go:11:2: found a struct that contains a context.Context field
-```
-
-
-## CI
-
-### CircleCI
-
-```yaml
-- run:
- name: install containedctx
- command: go install github.com/sivchari/containedctx/cmd/containedctx
-
-- run:
- name: run containedctx
- command: go vet -vettool=`which containedctx` ./...
-```
-
-### GitHub Actions
-
-```yaml
-- name: install containedctx
- run: go install github.com/sivchari/containedctx/cmd/containedctx
-
-- name: run containedctx
- run: go vet -vettool=`which containedctx` ./...
-```
diff --git a/vendor/github.com/sivchari/containedctx/containedctx.go b/vendor/github.com/sivchari/containedctx/containedctx.go
deleted file mode 100644
index 0260d6a6e..000000000
--- a/vendor/github.com/sivchari/containedctx/containedctx.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package containedctx
-
-import (
- "go/ast"
-
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/inspect"
- "golang.org/x/tools/go/ast/inspector"
-)
-
-const doc = "containedctx is a linter that detects struct contained context.Context field"
-
-// Analyzer is the contanedctx analyzer
-var Analyzer = &analysis.Analyzer{
- Name: "containedctx",
- Doc: doc,
- Run: run,
- Requires: []*analysis.Analyzer{
- inspect.Analyzer,
- },
-}
-
-func run(pass *analysis.Pass) (interface{}, error) {
- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
-
- nodeFilter := []ast.Node{
- (*ast.StructType)(nil),
- }
-
- inspect.Preorder(nodeFilter, func(n ast.Node) {
- switch structTyp := n.(type) {
- case *ast.StructType:
- if structTyp.Fields.List == nil {
- return
- }
- for _, field := range structTyp.Fields.List {
- if pass.TypesInfo.TypeOf(field.Type).String() == "context.Context" {
- pass.Reportf(field.Pos(), "found a struct that contains a context.Context field")
- }
- }
- }
- })
-
- return nil, nil
-}
diff --git a/vendor/github.com/sivchari/tenv/.gitignore b/vendor/github.com/sivchari/tenv/.gitignore
deleted file mode 100644
index 83470100f..000000000
--- a/vendor/github.com/sivchari/tenv/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-# Binaries for programs and plugins
-*.exe
-*.exe~
-*.dll
-*.so
-*.dylib
-
-# Test binary, built with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
-.idea
-
-# Dependency directories (remove the comment below to include it)
-# vendor/
diff --git a/vendor/github.com/sivchari/tenv/.golangci.yml b/vendor/github.com/sivchari/tenv/.golangci.yml
deleted file mode 100644
index f687df836..000000000
--- a/vendor/github.com/sivchari/tenv/.golangci.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-run:
- timeout: 5m
- skip-files: []
-
-linters-settings:
- govet:
- enable-all: true
- disable:
- - fieldalignment
- gocyclo:
- min-complexity: 12
- misspell:
- locale: US
- godox:
- keywords:
- - FIXME
- gofumpt:
- extra-rules: true
-
-linters:
- disable-all: true
- enable:
- - govet
- - revive
- - goimports
- - staticcheck
- - gosimple
- - unused
- - godox
- - gofumpt
- - misspell
- - gocyclo
-
-issues:
- exclude-use-default: true
- max-per-linter: 0
- max-same-issues: 0
- exclude: []
diff --git a/vendor/github.com/sivchari/tenv/LICENSE b/vendor/github.com/sivchari/tenv/LICENSE
deleted file mode 100644
index 5185ec09a..000000000
--- a/vendor/github.com/sivchari/tenv/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2021 sivchari
-
-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/sivchari/tenv/README.md b/vendor/github.com/sivchari/tenv/README.md
deleted file mode 100644
index 56389e2dd..000000000
--- a/vendor/github.com/sivchari/tenv/README.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# tenv
-
-<img title="Gopher" alt="tenv Gopher" src="./tenv.png" width="400">
-
-
-[![test_and_lint](https://github.com/sivchari/tenv/actions/workflows/workflows.yml/badge.svg?branch=main)](https://github.com/sivchari/tenv/actions/workflows/workflows.yml)
-
-tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
-
-## Instruction
-
-```sh
-go install github.com/sivchari/tenv/cmd/tenv@latest
-```
-
-## Usage
-
-```go
-package main
-
-import (
- "fmt"
- "os"
- "testing"
-)
-
-func TestMain(t *testing.T) {
- fmt.Println(os.Getenv("GO"))
- os.Setenv("GO", "HACKING GOPHER")
-}
-
-func TestMain2(t *testing.T) {
- fmt.Println(os.Getenv("GO"))
-}
-
-func helper() {
- os.Setenv("GO", "HACKING GOPHER")
-}
-```
-
-```console
-go vet -vettool=$(which tenv) ./...
-
-# a
-./main_test.go:11:2: os.Setenv() can be replaced by `t.Setenv()` in TestMain
-```
-
-### option
-
-The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
-
-By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
-
-```go
-package main
-
-import (
- "fmt"
- "os"
- "testing"
-)
-
-func TestMain(t *testing.T) {
- fmt.Println(os.Getenv("GO"))
- os.Setenv("GO", "HACKING GOPHER")
-}
-
-func TestMain2(t *testing.T) {
- fmt.Println(os.Getenv("GO"))
-}
-
-func helper() {
- os.Setenv("GO", "HACKING GOPHER")
-}
-```
-
-```console
-go vet -vettool=$(which tenv) -tenv.all ./...
-
-# a
-./main_test.go:11:2: os.Setenv() can be replaced by `t.Setenv()` in TestMain
-./main_test.go:19:2: os.Setenv() can be replaced by `testing.Setenv()` in helper
-```
-
-## CI
-
-### CircleCI
-
-```yaml
-- run:
- name: install tenv
- command: go install github.com/sivchari/tenv@latest
-
-- run:
- name: run tenv
- command: go vet -vettool=`which tenv` ./...
-```
-
-### GitHub Actions
-
-```yaml
-- name: install tenv
- run: go install github.com/sivchari/tenv@latest
-
-- name: run tenv
- run: go vet -vettool=`which tenv` ./...
-```
diff --git a/vendor/github.com/sivchari/tenv/goreleaser.yaml b/vendor/github.com/sivchari/tenv/goreleaser.yaml
deleted file mode 100644
index 56db218d7..000000000
--- a/vendor/github.com/sivchari/tenv/goreleaser.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-project_name: tenv
-
-env:
- - GO111MODULE=on
-
-builds:
- - id: tenv
- main: ./cmd/tenv/main.go
- binary: tenv
- env:
- - CGO_ENABLED=0
- goos:
- - linux
- - darwin
- goarch:
- - amd64
- - arm64
-
-archives:
- - id: tenv
- builds:
- - tenv
- name_template: '{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
- format_overrides:
- - goos: windows
- format: zip
diff --git a/vendor/github.com/sivchari/tenv/tenv.go b/vendor/github.com/sivchari/tenv/tenv.go
deleted file mode 100644
index 657e60e4e..000000000
--- a/vendor/github.com/sivchari/tenv/tenv.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package tenv
-
-import (
- "go/ast"
- "go/token"
- "go/types"
- "strings"
-
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/inspect"
- "golang.org/x/tools/go/ast/inspector"
-)
-
-const doc = "tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17"
-
-// Analyzer is tenv analyzer
-var Analyzer = &analysis.Analyzer{
- Name: "tenv",
- Doc: doc,
- Run: run,
- Requires: []*analysis.Analyzer{
- inspect.Analyzer,
- },
-}
-
-var (
- A = "all"
- aflag bool
-)
-
-func init() {
- Analyzer.Flags.BoolVar(&aflag, A, false, "the all option will run against all method in test file")
-}
-
-func run(pass *analysis.Pass) (interface{}, error) {
- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
-
- nodeFilter := []ast.Node{
- (*ast.FuncDecl)(nil),
- (*ast.FuncLit)(nil),
- }
-
- inspect.Preorder(nodeFilter, func(n ast.Node) {
- switch n := n.(type) {
- case *ast.FuncDecl:
- checkFuncDecl(pass, n, pass.Fset.File(n.Pos()).Name())
- case *ast.FuncLit:
- checkFuncLit(pass, n, pass.Fset.File(n.Pos()).Name())
- }
- })
-
- return nil, nil
-}
-
-func checkFuncDecl(pass *analysis.Pass, f *ast.FuncDecl, fileName string) {
- argName, ok := targetRunner(pass, f.Type.Params.List, fileName)
- if !ok {
- return
- }
- checkStmts(pass, f.Body.List, f.Name.Name, argName)
-}
-
-func checkFuncLit(pass *analysis.Pass, f *ast.FuncLit, fileName string) {
- argName, ok := targetRunner(pass, f.Type.Params.List, fileName)
- if !ok {
- return
- }
- checkStmts(pass, f.Body.List, "anonymous function", argName)
-}
-
-func checkStmts(pass *analysis.Pass, stmts []ast.Stmt, funcName, argName string) {
- for _, stmt := range stmts {
- switch stmt := stmt.(type) {
- case *ast.ExprStmt:
- checkExprStmt(pass, stmt, funcName, argName)
- case *ast.IfStmt:
- checkIfStmt(pass, stmt, funcName, argName)
- case *ast.AssignStmt:
- checkAssignStmt(pass, stmt, funcName, argName)
- case *ast.ForStmt:
- checkForStmt(pass, stmt, funcName, argName)
- }
- }
-}
-
-func checkExprStmt(pass *analysis.Pass, stmt *ast.ExprStmt, funcName, argName string) {
- callExpr, ok := stmt.X.(*ast.CallExpr)
- if !ok {
- return
- }
- checkArgs(pass, callExpr.Args, funcName, argName)
- ident, ok := callExpr.Fun.(*ast.Ident)
- if ok {
- obj := pass.TypesInfo.ObjectOf(ident)
- checkObj(pass, obj, stmt.Pos(), funcName, argName)
- }
- fun, ok := callExpr.Fun.(*ast.SelectorExpr)
- if ok {
- obj := pass.TypesInfo.ObjectOf(fun.Sel)
- checkObj(pass, obj, stmt.Pos(), funcName, argName)
- }
-}
-
-func checkArgs(pass *analysis.Pass, args []ast.Expr, funcName, argName string) {
- for _, arg := range args {
- callExpr, ok := arg.(*ast.CallExpr)
- if !ok {
- continue
- }
- ident, ok := callExpr.Fun.(*ast.Ident)
- if ok {
- obj := pass.TypesInfo.ObjectOf(ident)
- checkObj(pass, obj, arg.Pos(), funcName, argName)
- }
- fun, ok := callExpr.Fun.(*ast.SelectorExpr)
- if ok {
- obj := pass.TypesInfo.ObjectOf(fun.Sel)
- checkObj(pass, obj, arg.Pos(), funcName, argName)
- }
- }
-}
-
-func checkIfStmt(pass *analysis.Pass, stmt *ast.IfStmt, funcName, argName string) {
- assignStmt, ok := stmt.Init.(*ast.AssignStmt)
- if !ok {
- return
- }
- rhs, ok := assignStmt.Rhs[0].(*ast.CallExpr)
- if !ok {
- return
- }
- ident, ok := rhs.Fun.(*ast.Ident)
- if ok {
- obj := pass.TypesInfo.ObjectOf(ident)
- checkObj(pass, obj, stmt.Pos(), funcName, argName)
- }
- fun, ok := rhs.Fun.(*ast.SelectorExpr)
- if ok {
- obj := pass.TypesInfo.ObjectOf(fun.Sel)
- checkObj(pass, obj, stmt.Pos(), funcName, argName)
- }
-}
-
-func checkAssignStmt(pass *analysis.Pass, stmt *ast.AssignStmt, funcName, argName string) {
- rhs, ok := stmt.Rhs[0].(*ast.CallExpr)
- if !ok {
- return
- }
- ident, ok := rhs.Fun.(*ast.Ident)
- if ok {
- obj := pass.TypesInfo.ObjectOf(ident)
- checkObj(pass, obj, stmt.Pos(), funcName, argName)
- }
- fun, ok := rhs.Fun.(*ast.SelectorExpr)
- if ok {
- obj := pass.TypesInfo.ObjectOf(fun.Sel)
- checkObj(pass, obj, stmt.Pos(), funcName, argName)
- }
-}
-
-func checkObj(pass *analysis.Pass, obj types.Object, pos token.Pos, funcName, argName string) {
- // For built-in objects, obj.Pkg() returns nil.
- var pkgPrefix string
- if pkg := obj.Pkg(); pkg != nil {
- pkgPrefix = pkg.Name() + "."
- }
-
- targetName := pkgPrefix + obj.Name()
- if targetName == "os.Setenv" {
- if argName == "" {
- argName = "testing"
- }
- pass.Reportf(pos, "os.Setenv() can be replaced by `%s.Setenv()` in %s", argName, funcName)
- }
-}
-
-func checkForStmt(pass *analysis.Pass, stmt *ast.ForStmt, funcName, argName string) {
- checkStmts(pass, stmt.Body.List, funcName, argName)
-}
-
-func targetRunner(pass *analysis.Pass, params []*ast.Field, fileName string) (string, bool) {
- for _, p := range params {
- switch typ := p.Type.(type) {
- case *ast.StarExpr:
- if checkStarExprTarget(pass, typ) {
- if len(p.Names) == 0 {
- return "", false
- }
- argName := p.Names[0].Name
- return argName, true
- }
- case *ast.SelectorExpr:
- if checkSelectorExprTarget(pass, typ) {
- if len(p.Names) == 0 {
- return "", false
- }
- argName := p.Names[0].Name
- return argName, true
- }
- }
- }
- if aflag && strings.HasSuffix(fileName, "_test.go") {
- return "", true
- }
- return "", false
-}
-
-func checkStarExprTarget(pass *analysis.Pass, typ *ast.StarExpr) bool {
- selector, ok := typ.X.(*ast.SelectorExpr)
- if !ok {
- return false
- }
- switch pass.TypesInfo.TypeOf(selector).String() {
- case "testing.T", "testing.B":
- return true
- default:
- return false
- }
-}
-
-func checkSelectorExprTarget(pass *analysis.Pass, typ *ast.SelectorExpr) bool {
- return pass.TypesInfo.TypeOf(typ).String() == "testing.TB"
-}
diff --git a/vendor/github.com/sivchari/tenv/tenv.png b/vendor/github.com/sivchari/tenv/tenv.png
deleted file mode 100644
index 96dc967e3..000000000
--- a/vendor/github.com/sivchari/tenv/tenv.png
+++ /dev/null
Binary files differ