aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/jirfag
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-11-11 11:41:38 +0100
committerTaras Madan <tarasmadan@google.com>2024-11-11 11:10:48 +0000
commit27e76fae2ee2d84dc7db63af1d9ed7358ba35b7a (patch)
treeed19c0e35e272b3c4cc5a2f2c595e035b2428337 /vendor/github.com/jirfag
parent621e84e063b0e15b23e17780338627c509e1b9e8 (diff)
vendor: update
Diffstat (limited to 'vendor/github.com/jirfag')
-rw-r--r--vendor/github.com/jirfag/go-printf-func-name/LICENSE21
-rw-r--r--vendor/github.com/jirfag/go-printf-func-name/pkg/analyzer/analyzer.go74
2 files changed, 0 insertions, 95 deletions
diff --git a/vendor/github.com/jirfag/go-printf-func-name/LICENSE b/vendor/github.com/jirfag/go-printf-func-name/LICENSE
deleted file mode 100644
index d06a809c2..000000000
--- a/vendor/github.com/jirfag/go-printf-func-name/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2020 Isaev Denis
-
-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/jirfag/go-printf-func-name/pkg/analyzer/analyzer.go b/vendor/github.com/jirfag/go-printf-func-name/pkg/analyzer/analyzer.go
deleted file mode 100644
index 7937dd433..000000000
--- a/vendor/github.com/jirfag/go-printf-func-name/pkg/analyzer/analyzer.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package analyzer
-
-import (
- "go/ast"
- "strings"
-
- "golang.org/x/tools/go/analysis/passes/inspect"
- "golang.org/x/tools/go/ast/inspector"
-
- "golang.org/x/tools/go/analysis"
-)
-
-var Analyzer = &analysis.Analyzer{
- Name: "goprintffuncname",
- Doc: "Checks that printf-like functions are named with `f` at the end.",
- Run: run,
- Requires: []*analysis.Analyzer{inspect.Analyzer},
-}
-
-func run(pass *analysis.Pass) (interface{}, error) {
- inspector := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
- nodeFilter := []ast.Node{
- (*ast.FuncDecl)(nil),
- }
-
- inspector.Preorder(nodeFilter, func(node ast.Node) {
- funcDecl := node.(*ast.FuncDecl)
-
- if res := funcDecl.Type.Results; res != nil && len(res.List) != 0 {
- return
- }
-
- params := funcDecl.Type.Params.List
- if len(params) < 2 { // [0] must be format (string), [1] must be args (...interface{})
- return
- }
-
- formatParamType, ok := params[len(params)-2].Type.(*ast.Ident)
- if !ok { // first param type isn't identificator so it can't be of type "string"
- return
- }
-
- if formatParamType.Name != "string" { // first param (format) type is not string
- return
- }
-
- if formatParamNames := params[len(params)-2].Names; len(formatParamNames) == 0 || formatParamNames[len(formatParamNames)-1].Name != "format" {
- return
- }
-
- argsParamType, ok := params[len(params)-1].Type.(*ast.Ellipsis)
- if !ok { // args are not ellipsis (...args)
- return
- }
-
- elementType, ok := argsParamType.Elt.(*ast.InterfaceType)
- if !ok { // args are not of interface type, but we need interface{}
- return
- }
-
- if elementType.Methods != nil && len(elementType.Methods.List) != 0 {
- return // has >= 1 method in interface, but we need an empty interface "interface{}"
- }
-
- if strings.HasSuffix(funcDecl.Name.Name, "f") {
- return
- }
-
- pass.Reportf(node.Pos(), "printf-like formatting function '%s' should be named '%sf'",
- funcDecl.Name.Name, funcDecl.Name.Name)
- })
-
- return nil, nil
-}