Standard Library

GoToken

Go stdlib package — go/token. Auto-indexed from CDN. Method-level security roles have not been annotated; rule writers should inspect the source before use.

Other Methods

.File.AddLine()Neutral
#
Signature
File.AddLine(offset int)

AddLine adds the line offset for a new line.

.File.AddLineColumnInfo()Neutral
#
Signature
File.AddLineColumnInfo(offset int, filename string, line int, column int)

AddLineColumnInfo adds alternative file, line, and column number

.File.AddLineInfo()Neutral
#
Signature
File.AddLineInfo(offset int, filename string, line int)

AddLineInfo is like AddLineColumnInfo with a column = 1 argument.

.File.Base()Neutral
#
Signature
File.Base() int

Base returns the base offset of file f as registered with AddFile.

.File.Line()Neutral
#
Signature
File.Line(p Pos) int

Line returns the line number for the given file position p;

.File.LineCount()Neutral
#
Signature
File.LineCount() int

LineCount returns the number of lines in file f.

.File.LineStart()Neutral
#
Signature
File.LineStart(line int) Pos

LineStart returns the Pos value of the start of the specified line.

.File.Lines()Neutral
#
Signature
File.Lines() []int

Lines returns the effective line offset table of the form described by SetLines.

.File.MergeLine()Neutral
#
Signature
File.MergeLine(line int)

MergeLine merges a line with the following line. It is akin to replacing

.File.Name()Neutral
#
Signature
File.Name() string

Name returns the file name of file f as registered with AddFile.

Fully-Qualified Names

FQNField
go/tokenfqns[0]

Wrong FQN → 0 findings. Verify with: change fqns to garbage → must produce 0 results.

Import

go.mod
// standard library — no go.mod entry required
rule.py
from codepathfinder.go_rule import ...  # go/token