aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gostaticanalysis/comment
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/gostaticanalysis/comment
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/gostaticanalysis/comment')
-rw-r--r--vendor/github.com/gostaticanalysis/comment/LICENSE21
-rw-r--r--vendor/github.com/gostaticanalysis/comment/README.md10
-rw-r--r--vendor/github.com/gostaticanalysis/comment/comment.go152
-rw-r--r--vendor/github.com/gostaticanalysis/comment/passes/commentmap/commentmap.go21
4 files changed, 0 insertions, 204 deletions
diff --git a/vendor/github.com/gostaticanalysis/comment/LICENSE b/vendor/github.com/gostaticanalysis/comment/LICENSE
deleted file mode 100644
index 4f7eeff5b..000000000
--- a/vendor/github.com/gostaticanalysis/comment/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2018 Takuya Ueda
-
-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/gostaticanalysis/comment/README.md b/vendor/github.com/gostaticanalysis/comment/README.md
deleted file mode 100644
index 533555313..000000000
--- a/vendor/github.com/gostaticanalysis/comment/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# gostaticanalysis/comment
-
-[![godoc.org][godoc-badge]][godoc]
-
-`comment` provides utilities for [ast.CommentMap](https://golang.org/pkg/go/ast/#CommentMap).
-
-<!-- links -->
-[godoc]: https://godoc.org/github.com/gostaticanalysis/comment
-[godoc-badge]: https://img.shields.io/badge/godoc-reference-4F73B3.svg?style=flat-square&label=%20godoc.org
-
diff --git a/vendor/github.com/gostaticanalysis/comment/comment.go b/vendor/github.com/gostaticanalysis/comment/comment.go
deleted file mode 100644
index 79cb09382..000000000
--- a/vendor/github.com/gostaticanalysis/comment/comment.go
+++ /dev/null
@@ -1,152 +0,0 @@
-package comment
-
-import (
- "go/ast"
- "go/token"
- "strings"
-)
-
-// Maps is slice of ast.CommentMap.
-type Maps []ast.CommentMap
-
-// New creates new a CommentMap slice from specified files.
-func New(fset *token.FileSet, files []*ast.File) Maps {
- maps := make(Maps, len(files))
- for i := range files {
- maps[i] = ast.NewCommentMap(fset, files[i], files[i].Comments)
- }
- return maps
-}
-
-// Comments returns correspond a CommentGroup slice to specified AST node.
-func (maps Maps) Comments(n ast.Node) []*ast.CommentGroup {
- for i := range maps {
- if maps[i][n] != nil {
- return maps[i][n]
- }
- }
- return nil
-}
-
-// CommentsByPos returns correspond a CommentGroup slice to specified pos.
-func (maps Maps) CommentsByPos(pos token.Pos) []*ast.CommentGroup {
- for i := range maps {
- for n, cgs := range maps[i] {
- if n.Pos() == pos {
- return cgs
- }
- }
- }
- return nil
-}
-
-// Annotated checks either specified AST node is annotated or not.
-func (maps Maps) Annotated(n ast.Node, annotation string) bool {
- for _, cg := range maps.Comments(n) {
- if strings.HasPrefix(strings.TrimSpace(cg.Text()), annotation) {
- return true
- }
- }
- return false
-}
-
-// Ignore checks either specified AST node is ignored by the check.
-// It follows staticcheck style as the below.
-// //lint:ignore Check1[,Check2,...,CheckN] reason
-func (maps Maps) Ignore(n ast.Node, check string) bool {
- for _, cg := range maps.Comments(n) {
- if hasIgnoreCheck(cg, check) {
- return true
- }
- }
- return false
-}
-
-// IgnorePos checks either specified postion of AST node is ignored by the check.
-// It follows staticcheck style as the below.
-// //lint:ignore Check1[,Check2,...,CheckN] reason
-func (maps Maps) IgnorePos(pos token.Pos, check string) bool {
- for _, cg := range maps.CommentsByPos(pos) {
- if hasIgnoreCheck(cg, check) {
- return true
- }
- }
- return false
-}
-
-// Deprecated: This function does not work with multiple files.
-// CommentsByPosLine can be used instead of CommentsByLine.
-//
-// CommentsByLine returns correspond a CommentGroup slice to specified line.
-func (maps Maps) CommentsByLine(fset *token.FileSet, line int) []*ast.CommentGroup {
- for i := range maps {
- for n, cgs := range maps[i] {
- l := fset.File(n.Pos()).Line(n.Pos())
- if l == line {
- return cgs
- }
- }
- }
- return nil
-}
-
-// CommentsByPosLine returns correspond a CommentGroup slice to specified line.
-func (maps Maps) CommentsByPosLine(fset *token.FileSet, pos token.Pos) []*ast.CommentGroup {
- f1 := fset.File(pos)
- for i := range maps {
- for n, cgs := range maps[i] {
- f2 := fset.File(n.Pos())
- if f1 != f2 {
- // different file
- continue
- }
-
- if f1.Line(pos) == f2.Line(n.Pos()) {
- return cgs
- }
- }
- }
- return nil
-}
-
-// IgnoreLine checks either specified lineof AST node is ignored by the check.
-// It follows staticcheck style as the below.
-// //lint:ignore Check1[,Check2,...,CheckN] reason
-func (maps Maps) IgnoreLine(fset *token.FileSet, line int, check string) bool {
- for _, cg := range maps.CommentsByLine(fset, line) {
- if hasIgnoreCheck(cg, check) {
- return true
- }
- }
- return false
-}
-
-// hasIgnoreCheck returns true if the provided CommentGroup starts with a comment
-// of the form "//lint:ignore Check1[,Check2,...,CheckN] reason" and one of the
-// checks matches the provided check.
-//
-// The *ast.CommentGroup is checked directly rather than using "cg.Text()" because,
-// starting in Go 1.15, the "cg.Text()" call no longer returns directive-style
-// comments (see https://github.com/golang/go/issues/37974).
-func hasIgnoreCheck(cg *ast.CommentGroup, check string) bool {
- for _, list := range cg.List {
- if !strings.HasPrefix(list.Text, "//") {
- continue
- }
-
- s := strings.TrimSpace(list.Text[2:]) // list.Text[2:]: trim "//"
- txt := strings.Split(s, " ")
- if len(txt) < 3 || txt[0] != "lint:ignore" {
- continue
- }
-
- checks := strings.Split(txt[1], ",") // txt[1]: trim "lint:ignore"
- for i := range checks {
- if check == checks[i] {
- return true
- }
- }
- }
-
- return false
-}
diff --git a/vendor/github.com/gostaticanalysis/comment/passes/commentmap/commentmap.go b/vendor/github.com/gostaticanalysis/comment/passes/commentmap/commentmap.go
deleted file mode 100644
index 1b60a160c..000000000
--- a/vendor/github.com/gostaticanalysis/comment/passes/commentmap/commentmap.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package commentmap
-
-import (
- "reflect"
-
- "golang.org/x/tools/go/analysis"
-
- "github.com/gostaticanalysis/comment"
-)
-
-var Analyzer = &analysis.Analyzer{
- Name: "commentmap",
- Doc: "create comment map",
- Run: run,
- RunDespiteErrors: true,
- ResultType: reflect.TypeOf(comment.Maps{}),
-}
-
-func run(pass *analysis.Pass) (interface{}, error) {
- return comment.New(pass.Fset, pass.Files), nil
-}