aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/maratori/testableexamples/pkg
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/maratori/testableexamples/pkg
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/maratori/testableexamples/pkg')
-rw-r--r--vendor/github.com/maratori/testableexamples/pkg/testableexamples/testableexamples.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/vendor/github.com/maratori/testableexamples/pkg/testableexamples/testableexamples.go b/vendor/github.com/maratori/testableexamples/pkg/testableexamples/testableexamples.go
deleted file mode 100644
index 26d22c703..000000000
--- a/vendor/github.com/maratori/testableexamples/pkg/testableexamples/testableexamples.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package testableexamples
-
-import (
- "go/ast"
- "go/doc"
- "strings"
-
- "golang.org/x/tools/go/analysis"
-)
-
-// NewAnalyzer returns Analyzer that checks if examples are testable.
-func NewAnalyzer() *analysis.Analyzer {
- return &analysis.Analyzer{
- Name: "testableexamples",
- Doc: "linter checks if examples are testable (have an expected output)",
- Run: func(pass *analysis.Pass) (interface{}, error) {
- testFiles := make([]*ast.File, 0, len(pass.Files))
- for _, file := range pass.Files {
- fileName := pass.Fset.File(file.Pos()).Name()
- if strings.HasSuffix(fileName, "_test.go") {
- testFiles = append(testFiles, file)
- }
- }
-
- for _, example := range doc.Examples(testFiles...) {
- if example.Output == "" && !example.EmptyOutput {
- pass.Reportf(example.Code.Pos(), "missing output for example, go test can't validate it")
- }
- }
-
- return nil, nil
- },
- }
-}