aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/ckaznocha
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/ckaznocha
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/ckaznocha')
-rw-r--r--vendor/github.com/ckaznocha/intrange/.gitignore191
-rw-r--r--vendor/github.com/ckaznocha/intrange/.golangci.yml99
-rw-r--r--vendor/github.com/ckaznocha/intrange/CONTRIBUTING.md25
-rw-r--r--vendor/github.com/ckaznocha/intrange/LICENSE21
-rw-r--r--vendor/github.com/ckaznocha/intrange/README.md90
-rw-r--r--vendor/github.com/ckaznocha/intrange/SECURITY.md5
-rw-r--r--vendor/github.com/ckaznocha/intrange/go.work6
-rw-r--r--vendor/github.com/ckaznocha/intrange/intrange.go499
8 files changed, 0 insertions, 936 deletions
diff --git a/vendor/github.com/ckaznocha/intrange/.gitignore b/vendor/github.com/ckaznocha/intrange/.gitignore
deleted file mode 100644
index cfcb676e1..000000000
--- a/vendor/github.com/ckaznocha/intrange/.gitignore
+++ /dev/null
@@ -1,191 +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
-
-go.work.sum
-
-.vscode/*
-!.vscode/settings.json
-!.vscode/tasks.json
-!.vscode/launch.json
-!.vscode/extensions.json
-!.vscode/*.code-snippets
-
-# Local History for Visual Studio Code
-.history/
-
-# Built Visual Studio Code Extensions
-*.vsix
-
-# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
-# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-
-# User-specific stuff
-.idea/**/workspace.xml
-.idea/**/tasks.xml
-.idea/**/usage.statistics.xml
-.idea/**/dictionaries
-.idea/**/shelf
-
-# AWS User-specific
-.idea/**/aws.xml
-
-# Generated files
-.idea/**/contentModel.xml
-
-# Sensitive or high-churn files
-.idea/**/dataSources/
-.idea/**/dataSources.ids
-.idea/**/dataSources.local.xml
-.idea/**/sqlDataSources.xml
-.idea/**/dynamic.xml
-.idea/**/uiDesigner.xml
-.idea/**/dbnavigator.xml
-
-# Gradle
-.idea/**/gradle.xml
-.idea/**/libraries
-
-# Gradle and Maven with auto-import
-# When using Gradle or Maven with auto-import, you should exclude module files,
-# since they will be recreated, and may cause churn. Uncomment if using
-# auto-import.
-# .idea/artifacts
-# .idea/compiler.xml
-# .idea/jarRepositories.xml
-# .idea/modules.xml
-# .idea/*.iml
-# .idea/modules
-# *.iml
-# *.ipr
-
-# CMake
-cmake-build-*/
-
-# Mongo Explorer plugin
-.idea/**/mongoSettings.xml
-
-# File-based project format
-*.iws
-
-# IntelliJ
-out/
-
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
-# JIRA plugin
-atlassian-ide-plugin.xml
-
-# Cursive Clojure plugin
-.idea/replstate.xml
-
-# SonarLint plugin
-.idea/sonarlint/
-
-# Crashlytics plugin (for Android Studio and IntelliJ)
-com_crashlytics_export_strings.xml
-crashlytics.properties
-crashlytics-build.properties
-fabric.properties
-
-# Editor-based Rest Client
-.idea/httpRequests
-
-# Android studio 3.1+ serialized cache file
-.idea/caches/build_file_checksums.ser
-
-# Swap
-[._]*.s[a-v][a-z]
-!*.svg # comment out if you don't need vector files
-[._]*.sw[a-p]
-[._]s[a-rt-v][a-z]
-[._]ss[a-gi-z]
-[._]sw[a-p]
-
-# Session
-Session.vim
-Sessionx.vim
-
-# Temporary
-.netrwhist
-*~
-# Auto-generated tag files
-tags
-# Persistent undo
-[._]*.un~
-
-# Windows thumbnail cache files
-Thumbs.db
-Thumbs.db:encryptable
-ehthumbs.db
-ehthumbs_vista.db
-
-# Dump file
-*.stackdump
-
-# Folder config file
-[Dd]esktop.ini
-
-# Recycle Bin used on file shares
-$RECYCLE.BIN/
-
-# Windows Installer files
-*.cab
-*.msi
-*.msix
-*.msm
-*.msp
-
-# Windows shortcuts
-*.lnk
-
-# General
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Icon must end with two \r
-Icon
-
-# Thumbnails
-._*
-
-# Files that might appear in the root of a volume
-.DocumentRevisions-V100
-.fseventsd
-.Spotlight-V100
-.TemporaryItems
-.Trashes
-.VolumeIcon.icns
-.com.apple.timemachine.donotpresent
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk
-
-*~
-
-# temporary files which can be created if a process still has a handle open of a deleted file
-.fuse_hidden*
-
-# KDE directory preferences
-.directory
-
-# Linux trash folder which might appear on any partition or disk
-.Trash-*
-
-# .nfs files are created when an open file is removed but is still being accessed
-.nfs*
diff --git a/vendor/github.com/ckaznocha/intrange/.golangci.yml b/vendor/github.com/ckaznocha/intrange/.golangci.yml
deleted file mode 100644
index 2ad830d1b..000000000
--- a/vendor/github.com/ckaznocha/intrange/.golangci.yml
+++ /dev/null
@@ -1,99 +0,0 @@
-linters-settings:
- gci:
- local-prefixes: github.com/ckaznocha/intrange
- gocritic:
- enabled-tags:
- - diagnostic
- - experimental
- - opinionated
- - performance
- - style
- goimports:
- local-prefixes: github.com/ckaznocha/intrange
- golint:
- min-confidence: 0
- govet:
- check-shadowing: true
- enable:
- - asmdecl
- - assign
- - atomic
- - atomicalign
- - bools
- - buildtag
- - cgocall
- - composite
- - copylock
- - deepequalerrors
- - errorsas
- - fieldalignment
- - findcall
- - framepointer
- - httpresponse
- - ifaceassert
- - loopclosure
- - lostcancel
- - nilfunc
- - nilness
- - printf
- - shadow
- - shift
- - sortslice
- - stdmethods
- - stringintconv
- - structtag
- - testinggoroutine
- - tests
- - unmarshal
- - unreachable
- - unsafeptr
- - unusedresult
- misspell:
- locale: US
-linters:
- disable-all: true
- enable:
- - asciicheck
- - dupl
- - errcheck
- - errorlint
- - exportloopref
- - gci
- - gochecknoinits
- - goconst
- - gocritic
- - godot
- - godox
- - goerr113
- - gofmt
- - gofumpt
- - goimports
- - gomnd
- - goprintffuncname
- - gosec
- - gosimple
- - govet
- - ineffassign
- - lll
- - misspell
- - nakedret
- - nestif
- - nilerr
- - nlreturn
- - noctx
- - nolintlint
- - prealloc
- - predeclared
- - revive
- - rowserrcheck
- - staticcheck
- - stylecheck
- - typecheck
- - unconvert
- - unused
- - wastedassign
- - whitespace
- - wsl
-run:
- skip-dirs:
- - testdata/
diff --git a/vendor/github.com/ckaznocha/intrange/CONTRIBUTING.md b/vendor/github.com/ckaznocha/intrange/CONTRIBUTING.md
deleted file mode 100644
index 541cf2c54..000000000
--- a/vendor/github.com/ckaznocha/intrange/CONTRIBUTING.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Contributing
-Enhancements or fixes are welcome
-
-## Issues
-Check if a ticket for your issue already exists in GitHub issues. If you don't
-find a ticket submit a new one.
-
-## Pull Requests
-1. Fork the repo
-1. Make your changes.
-1. Commit and push the to your fork.
- 1. Extra credit if you squash your commits first.
-1. Submit a pull request.
-
-### Style
-- Your code should pass golint.
-- Follow the existing conventions.
-
-### Tests
-- If you add any functionality be sure to also add a test for it.
-- All regressions need to pass before your pull can be accepted
-
-## License
-By contributing to intrange you agree that your contributions will be
-licensed under its MIT license.
diff --git a/vendor/github.com/ckaznocha/intrange/LICENSE b/vendor/github.com/ckaznocha/intrange/LICENSE
deleted file mode 100644
index b68bde54b..000000000
--- a/vendor/github.com/ckaznocha/intrange/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2024 Clifton Kaznocha
-
-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/ckaznocha/intrange/README.md b/vendor/github.com/ckaznocha/intrange/README.md
deleted file mode 100644
index 9cac46220..000000000
--- a/vendor/github.com/ckaznocha/intrange/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-# intrange
-
-[![Build Status](https://github.com/ckaznocha/intrange/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ckaznocha/intrange/actions/workflows/ci.yml)
-[![Release](http://img.shields.io/github/release/ckaznocha/intrange.svg)](https://github.com/ckaznocha/intrange/releases/latest)
-[![GoDoc](https://godoc.org/github.com/ckaznocha/intrange?status.svg)](https://godoc.org/github.com/ckaznocha/intrange)
-
-intrange is a program for checking for loops that could use the [Go 1.22](https://go.dev/ref/spec#Go_1.22) integer
-range feature.
-
-## Installation
-
-```bash
-go install github.com/ckaznocha/intrange/cmd/intrange@latest
-```
-
-## Usage
-
-```bash
-go vet -vettool=$(which intrange) ./...
-```
-
-## Examples
-
-### A loop that uses the value of the loop variable
-
-```go
-package main
-
-import "fmt"
-
-func main() {
- for i := 0; i < 10; i++ {
- fmt.Println(i)
- }
-}
-```
-
-Running `intrange` on the above code will produce the following output:
-
-```bash
-main.go:5:2: for loop can be changed to use an integer range (Go 1.22+)
-```
-
-The loop can be rewritten as:
-
-```go
-package main
-
-import "fmt"
-
-func main() {
- for i := range 10 {
- fmt.Println(i)
- }
-}
-```
-
-### A loop that does not use the value of the loop variable
-
-```go
-package main
-
-import "fmt"
-
-func main() {
- for i := 0; i < 10; i++ {
- fmt.Println("Hello again!")
- }
-}
-```
-
-Running `intrange` on the above code will produce the following output:
-
-```bash
-main.go:5:2: for loop can be changed to use an integer range (Go 1.22+)
-```
-
-The loop can be rewritten as:
-
-```go
-package main
-
-import "fmt"
-
-func main() {
- for range 10 {
- fmt.Println("Hello again!")
- }
-}
-```
diff --git a/vendor/github.com/ckaznocha/intrange/SECURITY.md b/vendor/github.com/ckaznocha/intrange/SECURITY.md
deleted file mode 100644
index e2c44c4e2..000000000
--- a/vendor/github.com/ckaznocha/intrange/SECURITY.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Security Policy
-
-## Reporting a Vulnerability
-
-Please open a [github issue](https://github.com/ckaznocha/intrange/issues)
diff --git a/vendor/github.com/ckaznocha/intrange/go.work b/vendor/github.com/ckaznocha/intrange/go.work
deleted file mode 100644
index 3814c99f9..000000000
--- a/vendor/github.com/ckaznocha/intrange/go.work
+++ /dev/null
@@ -1,6 +0,0 @@
-go 1.22
-
-use (
- .
- ./testdata
-)
diff --git a/vendor/github.com/ckaznocha/intrange/intrange.go b/vendor/github.com/ckaznocha/intrange/intrange.go
deleted file mode 100644
index 44a15091e..000000000
--- a/vendor/github.com/ckaznocha/intrange/intrange.go
+++ /dev/null
@@ -1,499 +0,0 @@
-package intrange
-
-import (
- "errors"
- "fmt"
- "go/ast"
- "go/token"
- "go/types"
- "strconv"
-
- "golang.org/x/tools/go/analysis"
- "golang.org/x/tools/go/analysis/passes/inspect"
- "golang.org/x/tools/go/ast/inspector"
-)
-
-var (
- Analyzer = &analysis.Analyzer{
- Name: "intrange",
- Doc: "intrange is a linter to find places where for loops could make use of an integer range.",
- Run: run,
- Requires: []*analysis.Analyzer{inspect.Analyzer},
- }
-
- errFailedAnalysis = errors.New("failed analysis")
-)
-
-const (
- msg = "for loop can be changed to use an integer range (Go 1.22+)"
- msgLenRange = "for loop can be changed to `%s := range %s`"
- msgLenRangeNoIdent = "for loop can be changed to `range %s`"
-)
-
-func run(pass *analysis.Pass) (any, error) {
- result, ok := pass.ResultOf[inspect.Analyzer]
- if !ok {
- return nil, fmt.Errorf(
- "%w: %s",
- errFailedAnalysis,
- inspect.Analyzer.Name,
- )
- }
-
- resultInspector, ok := result.(*inspector.Inspector)
- if !ok {
- return nil, fmt.Errorf(
- "%w: %s",
- errFailedAnalysis,
- inspect.Analyzer.Name,
- )
- }
-
- resultInspector.Preorder([]ast.Node{(*ast.ForStmt)(nil), (*ast.RangeStmt)(nil)}, check(pass))
-
- return nil, nil
-}
-
-func check(pass *analysis.Pass) func(node ast.Node) {
- return func(node ast.Node) {
- switch stmt := node.(type) {
- case *ast.ForStmt:
- checkForStmt(pass, stmt)
- case *ast.RangeStmt:
- checkRangeStmt(pass, stmt)
- default:
- return
- }
- }
-}
-
-func checkForStmt(pass *analysis.Pass, forStmt *ast.ForStmt) {
- // Existing checks for other patterns
- if forStmt.Init == nil || forStmt.Cond == nil || forStmt.Post == nil {
- return
- }
-
- // i := 0;;
- init, ok := forStmt.Init.(*ast.AssignStmt)
- if !ok {
- return
- }
-
- if len(init.Lhs) != 1 || len(init.Rhs) != 1 {
- return
- }
-
- initIdent, ok := init.Lhs[0].(*ast.Ident)
- if !ok {
- return
- }
-
- if !compareNumberLit(init.Rhs[0], 0) {
- return
- }
-
- cond, ok := forStmt.Cond.(*ast.BinaryExpr)
- if !ok {
- return
- }
-
- var nExpr ast.Expr
-
- switch cond.Op {
- case token.LSS: // ;i < n;
- if isBenchmark(cond.Y) {
- return
- }
-
- nExpr = findNExpr(cond.Y)
-
- x, ok := cond.X.(*ast.Ident)
- if !ok {
- return
- }
-
- if x.Name != initIdent.Name {
- return
- }
- case token.GTR: // ;n > i;
- if isBenchmark(cond.X) {
- return
- }
-
- nExpr = findNExpr(cond.X)
-
- y, ok := cond.Y.(*ast.Ident)
- if !ok {
- return
- }
-
- if y.Name != initIdent.Name {
- return
- }
- default:
- return
- }
-
- switch post := forStmt.Post.(type) {
- case *ast.IncDecStmt: // ;;i++
- if post.Tok != token.INC {
- return
- }
-
- ident, ok := post.X.(*ast.Ident)
- if !ok {
- return
- }
-
- if ident.Name != initIdent.Name {
- return
- }
- case *ast.AssignStmt:
- switch post.Tok {
- case token.ADD_ASSIGN: // ;;i += 1
- if len(post.Lhs) != 1 {
- return
- }
-
- ident, ok := post.Lhs[0].(*ast.Ident)
- if !ok {
- return
- }
-
- if ident.Name != initIdent.Name {
- return
- }
-
- if len(post.Rhs) != 1 {
- return
- }
-
- if !compareNumberLit(post.Rhs[0], 1) {
- return
- }
- case token.ASSIGN: // ;;i = i + 1 && ;;i = 1 + i
- if len(post.Lhs) != 1 || len(post.Rhs) != 1 {
- return
- }
-
- ident, ok := post.Lhs[0].(*ast.Ident)
- if !ok {
- return
- }
-
- if ident.Name != initIdent.Name {
- return
- }
-
- bin, ok := post.Rhs[0].(*ast.BinaryExpr)
- if !ok {
- return
- }
-
- if bin.Op != token.ADD {
- return
- }
-
- switch x := bin.X.(type) {
- case *ast.Ident: // ;;i = i + 1
- if x.Name != initIdent.Name {
- return
- }
-
- if !compareNumberLit(bin.Y, 1) {
- return
- }
- case *ast.BasicLit: // ;;i = 1 + i
- if !compareNumberLit(x, 1) {
- return
- }
-
- ident, ok := bin.Y.(*ast.Ident)
- if !ok {
- return
- }
-
- if ident.Name != initIdent.Name {
- return
- }
- default:
- return
- }
- default:
- return
- }
- default:
- return
- }
-
- bc := &bodyChecker{
- initIdent: initIdent,
- nExpr: nExpr,
- }
-
- ast.Inspect(forStmt.Body, bc.check)
-
- if bc.modified {
- return
- }
-
- pass.Report(analysis.Diagnostic{
- Pos: forStmt.Pos(),
- Message: msg,
- })
-}
-
-func checkRangeStmt(pass *analysis.Pass, rangeStmt *ast.RangeStmt) {
- if rangeStmt.Value != nil {
- return
- }
-
- startPos := rangeStmt.Range
- usesKey := rangeStmt.Key != nil
- identName := ""
-
- if usesKey {
- ident, ok := rangeStmt.Key.(*ast.Ident)
- if !ok {
- return
- }
-
- if ident.Name == "_" {
- usesKey = false
- }
-
- identName = ident.Name
- startPos = ident.Pos()
- }
-
- if rangeStmt.X == nil {
- return
- }
-
- x, ok := rangeStmt.X.(*ast.CallExpr)
- if !ok {
- return
- }
-
- fn, ok := x.Fun.(*ast.Ident)
- if !ok {
- return
- }
-
- if fn.Name != "len" || len(x.Args) != 1 {
- return
- }
-
- arg, ok := x.Args[0].(*ast.Ident)
- if !ok {
- return
- }
-
- // make sure arg is a slice or array
- obj := pass.TypesInfo.ObjectOf(arg)
- if obj == nil {
- return
- }
-
- switch obj.Type().Underlying().(type) {
- case *types.Slice, *types.Array:
- default:
- return
- }
-
- if usesKey {
- pass.Report(analysis.Diagnostic{
- Pos: startPos,
- End: x.End(),
- Message: fmt.Sprintf(msgLenRange, identName, arg.Name),
- SuggestedFixes: []analysis.SuggestedFix{
- {
- Message: fmt.Sprintf("Replace `len(%s)` with `%s`", arg.Name, arg.Name),
- TextEdits: []analysis.TextEdit{
- {
- Pos: x.Pos(),
- End: x.End(),
- NewText: []byte(arg.Name),
- },
- },
- },
- },
- })
-
- return
- }
-
- pass.Report(analysis.Diagnostic{
- Pos: startPos,
- End: x.End(),
- Message: fmt.Sprintf(msgLenRangeNoIdent, arg.Name),
- SuggestedFixes: []analysis.SuggestedFix{
- {
- Message: fmt.Sprintf("Replace `len(%s)` with `%s`", arg.Name, arg.Name),
- TextEdits: []analysis.TextEdit{
- {
- Pos: startPos,
- End: x.End(),
- NewText: []byte(fmt.Sprintf("range %s", arg.Name)),
- },
- },
- },
- },
- })
-}
-
-func findNExpr(expr ast.Expr) ast.Expr {
- switch e := expr.(type) {
- case *ast.CallExpr:
- if fun, ok := e.Fun.(*ast.Ident); ok && fun.Name == "len" && len(e.Args) == 1 {
- return findNExpr(e.Args[0])
- }
-
- return nil
- case *ast.BasicLit:
- return nil
- case *ast.Ident:
- return e
- case *ast.SelectorExpr:
- return e
- case *ast.IndexExpr:
- return e
- default:
- return nil
- }
-}
-
-func isBenchmark(expr ast.Expr) bool {
- selectorExpr, ok := expr.(*ast.SelectorExpr)
- if !ok {
- return false
- }
-
- if selectorExpr.Sel.Name != "N" {
- return false
- }
-
- ident, ok := selectorExpr.X.(*ast.Ident)
- if !ok {
- return false
- }
-
- if ident.Name == "b" {
- return true
- }
-
- return false
-}
-
-func identEqual(a, b ast.Expr) bool {
- if a == nil || b == nil {
- return false
- }
-
- switch aT := a.(type) {
- case *ast.Ident:
- identB, ok := b.(*ast.Ident)
- if !ok {
- return false
- }
-
- return aT.Name == identB.Name
- case *ast.SelectorExpr:
- selectorB, ok := b.(*ast.SelectorExpr)
- if !ok {
- return false
- }
-
- return identEqual(aT.Sel, selectorB.Sel) && identEqual(aT.X, selectorB.X)
- case *ast.IndexExpr:
- indexB, ok := b.(*ast.IndexExpr)
- if ok {
- return identEqual(aT.X, indexB.X) && identEqual(aT.Index, indexB.Index)
- }
-
- return identEqual(aT.X, b)
- case *ast.BasicLit:
- litB, ok := b.(*ast.BasicLit)
- if !ok {
- return false
- }
-
- return aT.Value == litB.Value
- default:
- return false
- }
-}
-
-type bodyChecker struct {
- initIdent *ast.Ident
- nExpr ast.Expr
- modified bool
-}
-
-func (b *bodyChecker) check(n ast.Node) bool {
- switch stmt := n.(type) {
- case *ast.AssignStmt:
- for _, lhs := range stmt.Lhs {
- if identEqual(lhs, b.initIdent) || identEqual(lhs, b.nExpr) {
- b.modified = true
-
- return false
- }
- }
- case *ast.IncDecStmt:
- if identEqual(stmt.X, b.initIdent) || identEqual(stmt.X, b.nExpr) {
- b.modified = true
-
- return false
- }
- }
-
- return true
-}
-
-func compareNumberLit(exp ast.Expr, val int) bool {
- switch lit := exp.(type) {
- case *ast.BasicLit:
- if lit.Kind != token.INT {
- return false
- }
-
- n := strconv.Itoa(val)
-
- switch lit.Value {
- case n, "0x" + n, "0X" + n:
- return true
- default:
- return false
- }
- case *ast.CallExpr:
- switch fun := lit.Fun.(type) {
- case *ast.Ident:
- switch fun.Name {
- case
- "int",
- "int8",
- "int16",
- "int32",
- "int64",
- "uint",
- "uint8",
- "uint16",
- "uint32",
- "uint64":
- default:
- return false
- }
- default:
- return false
- }
-
- if len(lit.Args) != 1 {
- return false
- }
-
- return compareNumberLit(lit.Args[0], val)
- default:
- return false
- }
-}