aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/alingse
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/alingse
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/alingse')
-rw-r--r--vendor/github.com/alingse/asasalint/.gitignore18
-rw-r--r--vendor/github.com/alingse/asasalint/.goreleaser.yml72
-rw-r--r--vendor/github.com/alingse/asasalint/LICENSE21
-rw-r--r--vendor/github.com/alingse/asasalint/Makefile15
-rw-r--r--vendor/github.com/alingse/asasalint/README.md76
-rw-r--r--vendor/github.com/alingse/asasalint/asasalint.go166
6 files changed, 0 insertions, 368 deletions
diff --git a/vendor/github.com/alingse/asasalint/.gitignore b/vendor/github.com/alingse/asasalint/.gitignore
deleted file mode 100644
index d0fc531c8..000000000
--- a/vendor/github.com/alingse/asasalint/.gitignore
+++ /dev/null
@@ -1,18 +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
-
-# Dependency directories (remove the comment below to include it)
-# vendor/
-.vscode
-
-asasalint
diff --git a/vendor/github.com/alingse/asasalint/.goreleaser.yml b/vendor/github.com/alingse/asasalint/.goreleaser.yml
deleted file mode 100644
index e45d5860d..000000000
--- a/vendor/github.com/alingse/asasalint/.goreleaser.yml
+++ /dev/null
@@ -1,72 +0,0 @@
----
-project_name: asasalint
-
-release:
- github:
- owner: alingse
- name: asasalint
-
-builds:
- - binary: asasalint
- goos:
- - darwin
- - windows
- - linux
- - freebsd
- goarch:
- - amd64
- - arm64
- - arm
- - 386
- - ppc64le
- - s390x
- - mips64
- - mips64le
- - riscv64
- goarm:
- - 6
- - 7
- gomips:
- - hardfloat
- env:
- - CGO_ENABLED=0
- ignore:
- - goos: darwin
- goarch: 386
- - goos: freebsd
- goarch: arm64
- main: ./cmd/asasalint/
- flags:
- - -trimpath
- ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
-
-archives:
- - format: tar.gz
- wrap_in_directory: true
- format_overrides:
- - goos: windows
- format: zip
- name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
- files:
- - LICENSE
- - README.md
-
-snapshot:
- name_template: SNAPSHOT-{{ .Commit }}
-
-checksum:
- name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'
-
-changelog:
- sort: asc
- filters:
- exclude:
- - '(?i)^docs?:'
- - '(?i)^docs\([^:]+\):'
- - '(?i)^docs\[[^:]+\]:'
- - '^tests?:'
- - '(?i)^dev:'
- - '^build\(deps\): bump .* in /docs \(#\d+\)'
- - '^build\(deps\): bump .* in /\.github/peril \(#\d+\)'
- - Merge pull request
- - Merge branch
diff --git a/vendor/github.com/alingse/asasalint/LICENSE b/vendor/github.com/alingse/asasalint/LICENSE
deleted file mode 100644
index a7c39f2e3..000000000
--- a/vendor/github.com/alingse/asasalint/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022 alingse
-
-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/alingse/asasalint/Makefile b/vendor/github.com/alingse/asasalint/Makefile
deleted file mode 100644
index 12f8ba928..000000000
--- a/vendor/github.com/alingse/asasalint/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-.PHONY: clean check test build
-
-default: clean check test build
-
-clean:
- rm -rf dist/ cover.out
-
-test: clean
- go test -v -cover ./...
-
-check:
- golangci-lint run
-
-build:
- go build -ldflags "-s -w" -trimpath ./cmd/asasalint/
diff --git a/vendor/github.com/alingse/asasalint/README.md b/vendor/github.com/alingse/asasalint/README.md
deleted file mode 100644
index 3fa7e65b3..000000000
--- a/vendor/github.com/alingse/asasalint/README.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# asasalint
-Golang linter, lint that pass any slice as any in variadic function
-
-
-## Install
-
-```sh
-go install github.com/alingse/asasalint/cmd/asasalint@latest
-```
-
-## Usage
-
-```sh
-asasalint ./...
-```
-
-ignore some func that was by desgin
-
-```sh
-asasalint -e append,Append ./...
-```
-
-## Why
-
-two kind of unexpected usage, and `go build` success
-
-```Go
-package main
-
-import "fmt"
-
-func A(args ...any) int {
- return len(args)
-}
-
-func B(args ...any) int {
- return A(args)
-}
-
-func main() {
-
- // 1
- fmt.Println(B(1, 2, 3, 4))
-}
-```
-
-
-
-```Go
-package main
-
-import "fmt"
-
-func errMsg(msg string, args ...any) string {
- return fmt.Sprintf(msg, args...)
-}
-
-func Err(msg string, args ...any) string {
- return errMsg(msg, args)
-}
-
-func main() {
-
- // p1 [hello world] p2 %!s(MISSING)
- fmt.Println(Err("p1 %s p2 %s", "hello", "world"))
-}
-```
-
-
-
-## TODO
-
-1. add to golangci-lint
-2. given a SuggestEdition
-3. add `append` to default exclude ?
-4. ingore pattern `fn(a, b, []any{1,2,3})` , because `[]any{1,2,3}` is most likely by design
diff --git a/vendor/github.com/alingse/asasalint/asasalint.go b/vendor/github.com/alingse/asasalint/asasalint.go
deleted file mode 100644
index f34516a46..000000000
--- a/vendor/github.com/alingse/asasalint/asasalint.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package asasalint
-
-import (
- "bytes"
- "fmt"
- "go/ast"
- "go/printer"
- "go/token"
- "go/types"
- "log"
- "regexp"
- "strings"
-
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/inspect"
- "golang.org/x/tools/go/ast/inspector"
-)
-
-const BuiltinExclusions = `^(fmt|log|logger|t|)\.(Print|Fprint|Sprint|Fatal|Panic|Error|Warn|Warning|Info|Debug|Log)(|f|ln)$`
-
-type LinterSetting struct {
- Exclude []string
- NoBuiltinExclusions bool
- IgnoreTest bool
-}
-
-func NewAnalyzer(setting LinterSetting) (*analysis.Analyzer, error) {
- a, err := newAnalyzer(setting)
- if err != nil {
- return nil, err
- }
-
- return &analysis.Analyzer{
- Name: "asasalint",
- Doc: "check for pass []any as any in variadic func(...any)",
- Run: a.run,
- Requires: []*analysis.Analyzer{inspect.Analyzer},
- }, nil
-}
-
-type analyzer struct {
- excludes []*regexp.Regexp
- setting LinterSetting
-}
-
-func newAnalyzer(setting LinterSetting) (*analyzer, error) {
- a := &analyzer{
- setting: setting,
- }
-
- if !a.setting.NoBuiltinExclusions {
- a.excludes = append(a.excludes, regexp.MustCompile(BuiltinExclusions))
- }
-
- for _, exclude := range a.setting.Exclude {
- if exclude != "" {
- exp, err := regexp.Compile(exclude)
- if err != nil {
- return nil, err
- }
-
- a.excludes = append(a.excludes, exp)
- }
- }
-
- return a, nil
-}
-
-func (a *analyzer) run(pass *analysis.Pass) (interface{}, error) {
- inspectorInfo := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
- nodeFilter := []ast.Node{(*ast.CallExpr)(nil)}
-
- inspectorInfo.Preorder(nodeFilter, a.AsCheckVisitor(pass))
- return nil, nil
-}
-
-func (a *analyzer) AsCheckVisitor(pass *analysis.Pass) func(ast.Node) {
- return func(n ast.Node) {
- if a.setting.IgnoreTest {
- pos := pass.Fset.Position(n.Pos())
- if strings.HasSuffix(pos.Filename, "_test.go") {
- return
- }
- }
-
- caller, ok := n.(*ast.CallExpr)
- if !ok {
- return
- }
- if caller.Ellipsis != token.NoPos {
- return
- }
- if len(caller.Args) == 0 {
- return
- }
-
- fnName, err := getFuncName(pass.Fset, caller)
- if err != nil {
- log.Println(err)
- return
- }
-
- for _, exclude := range a.excludes {
- if exclude.MatchString(fnName) {
- return
- }
- }
-
- fnType := pass.TypesInfo.TypeOf(caller.Fun)
- if !isSliceAnyVariadicFuncType(fnType) {
- return
- }
-
- fnSign := fnType.(*types.Signature)
- if len(caller.Args) != fnSign.Params().Len() {
- return
- }
-
- lastArg := caller.Args[len(caller.Args)-1]
- argType := pass.TypesInfo.TypeOf(lastArg)
- if !isSliceAnyType(argType) {
- return
- }
- node := lastArg
-
- d := analysis.Diagnostic{
- Pos: node.Pos(),
- End: node.End(),
- Message: fmt.Sprintf("pass []any as any to func %s %s", fnName, fnType.String()),
- Category: "asasalint",
- }
- pass.Report(d)
- }
-}
-
-func getFuncName(fset *token.FileSet, caller *ast.CallExpr) (string, error) {
- buf := new(bytes.Buffer)
- if err := printer.Fprint(buf, fset, caller.Fun); err != nil {
- return "", fmt.Errorf("unable to print node at %s: %w", fset.Position(caller.Fun.Pos()), err)
- }
-
- return buf.String(), nil
-}
-
-func isSliceAnyVariadicFuncType(typ types.Type) (r bool) {
- fnSign, ok := typ.(*types.Signature)
- if !ok || !fnSign.Variadic() {
- return false
- }
-
- params := fnSign.Params()
- lastParam := params.At(params.Len() - 1)
- return isSliceAnyType(lastParam.Type())
-}
-
-func isSliceAnyType(typ types.Type) (r bool) {
- sliceType, ok := typ.(*types.Slice)
- if !ok {
- return
- }
- elemType, ok := sliceType.Elem().(*types.Interface)
- if !ok {
- return
- }
- return elemType.NumMethods() == 0
-}