udevgo

package
v0.0.0-...-76c535a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GoVersion      string
	GoVersionShort string
	GoPaths        []string

	Has_godoc        bool
	Has_gofmt        bool
	Has_goimports    bool
	Has_goreturns    bool
	Has_guru         bool
	Has_gorename     bool
	Has_godef        bool
	Has_gogetdoc     bool
	Has_gocode       bool
	Has_structlayout bool
	Has_godocdown    bool

	Has_golint      bool
	Has_checkvar    bool
	Has_checkalign  bool
	Has_checkstruct bool
	Has_errcheck    bool
	Has_ineffassign bool
	Has_interfacer  bool
	Has_unparam     bool
	Has_unindent    bool
	Has_unconvert   bool
	Has_maligned    bool
	Has_goconst     bool
	Has_gosimple    bool
	Has_unused      bool
	Has_staticcheck bool
	Has_deadcode    bool
)
View Source
var (
	PkgsByDir map[string]*Pkg
	PkgsByImP map[string]*Pkg
	PkgsErrs  []*Pkg

	ShortenImpPaths *strings.Replacer
)
View Source
var (
	GuruScopes        string
	GuruScopeExclPkgs = map[string]bool{}
)
View Source
var (
	GolintIgnoreSubstrings = []string{
		" should have comment ",

		"ALL_CAPS",
		"underscore",
		"CamelCase",
		"it will be inferred from the right-hand side",
		"should be of the form \"",
	}
)

Functions

func AllGoPaths

func AllGoPaths() []string

Returns all paths listed in the `GOPATH` environment variable, for users who don't care about calling HasGoDevEnv.

func DirPathToImportPath

func DirPathToImportPath(dirpath string) string

func GopathSrc

func GopathSrc(subDirNames ...string) (gps string)

Returns the `path/filepath.Join`-ed full directory path for a specified `$GOPATH/src` sub-directory. Example: `util.GopathSrc("tools", "importers", "sql")` yields `c:\gd\src\tools\importers\sql` if `$GOPATH` is `c:\gd`.

func GopathSrcGithub

func GopathSrcGithub(gitHubName string, subDirNames ...string) string

Returns the `path/filepath.Join`-ed full directory path for a specified `$GOPATH/src/github.com` sub-directory. Example: `util.GopathSrcGithub("go-util", "num")` yields `c:\gd\src\github.com\go-util\num` if `$GOPATH` is `c:\gd`.

func Gorename

func Gorename(cmdname string, filepath string, offset int, newname string, eol string) (fileedits udev.SrcMsgs, err error)

func GuruMinimalScopeFor

func GuruMinimalScopeFor(goFilePath string) (pkgScope string, shouldRefresh bool)

func HasGoDevEnv

func HasGoDevEnv() bool

func LintCheck

func LintCheck(cmdname string, pkgimppath string) (msgs udev.SrcMsgs)

func LintErrcheck

func LintErrcheck(pkgimppath string) (msgs udev.SrcMsgs)

func LintGoConst

func LintGoConst(dirpath string) (msgs udev.SrcMsgs)

func LintGoSimple

func LintGoSimple(pkgimppath string) (msgs udev.SrcMsgs)

func LintGoVet

func LintGoVet(pkgimppath string) udev.SrcMsgs

func LintGolint

func LintGolint(pkgimppathordirpath string) (msgs udev.SrcMsgs)

func LintHonnef

func LintHonnef(cmdname string, pkgimppath string) (msgs udev.SrcMsgs)

func LintIneffAssign

func LintIneffAssign(dirrelpath string) (msgs udev.SrcMsgs)

func LintMvDan

func LintMvDan(cmdname string, pkgimppath string) udev.SrcMsgs

func LintViaPkgImpPath

func LintViaPkgImpPath(cmdname string, pkgimppath string, inclstderr bool) (msgs udev.SrcMsgs)

func PkgImpPathsToNamesInLn

func PkgImpPathsToNamesInLn(ln string, curPkgDir string) string

func PkgsByName

func PkgsByName(name string) (pkgImpPaths []string)

func QueryCallees_Guru

func QueryCallees_Guru(fullsrcfilepath string, srcin string, bytepos1 string, bytepos2 string, altScopes string) (gc *gurujson.Callees, err error)

func QueryCallers_Guru

func QueryCallers_Guru(fullsrcfilepath string, srcin string, bytepos1 string, bytepos2 string, altScopes string) (gr []gurujson.Caller, err error)

func QueryCallstack_Guru

func QueryCallstack_Guru(fullsrcfilepath string, srcin string, bytepos1 string, bytepos2 string, altScopes string) (gcs *gurujson.CallStack, err error)

func QueryCmplSugg_Gocode

func QueryCmplSugg_Gocode(fullsrcfilepath string, srcin string, pos string) (cmpls []map[string]string, err error)

func QueryDefDecl_GoDef

func QueryDefDecl_GoDef(fullsrcfilepath string, srcin string, bytepos string) (defdecl string)

func QueryDefLoc_Godef

func QueryDefLoc_Godef(fullsrcfilepath string, srcin string, bytepos string) *udev.SrcMsg

func QueryDefLoc_Gogetdoc

func QueryDefLoc_Gogetdoc(fullsrcfilepath string, srcin string, bytepos string) *udev.SrcMsg

func QueryDef_Guru

func QueryDef_Guru(fullsrcfilepath string, srcin string, bytepos string) *gurujson.Definition

func QueryFreevars_Guru

func QueryFreevars_Guru(fullsrcfilepath string, srcin string, bytepos1 string, bytepos2 string) (gfvs []*gurujson.FreeVar, err error)

func QueryImpl_Guru

func QueryImpl_Guru(fullsrcfilepath string, srcin string, bytepos string) *gurujson.Implements

func QueryPeers_Guru

func QueryPeers_Guru(fullsrcfilepath string, srcin string, bytepos1 string, bytepos2 string, altScopes string) (gp *gurujson.Peers, err error)

func QueryPointsto_Guru

func QueryPointsto_Guru(fullsrcfilepath string, srcin string, bytepos1 string, bytepos2 string, altScopes string) (gr []gurujson.PointsTo, err error)

func QueryRefs_Guru

func QueryRefs_Guru(fullsrcfilepath string, srcin string, bytepos string) (refs []gurujson.Ref)

func QueryWhat_Guru

func QueryWhat_Guru(fullsrcfilepath string, srcin string, bytepos string) (*gurujson.What, error)

func QueryWhicherrs_Guru

func QueryWhicherrs_Guru(fullsrcfilepath string, srcin string, bytepos1 string, bytepos2 string, altScopes string) (gwe *gurujson.WhichErrs, err error)

func RefreshPkgs

func RefreshPkgs() error

Types

type Gogetdoc

type Gogetdoc struct {
	Name   string `json:"name,omitempty"`
	ImpP   string `json:"import,omitempty"`
	Decl   string `json:"decl,omitempty"`
	Doc    string `json:"doc,omitempty"`
	DocUrl string `json:",omitempty"`
	Pos    string `json:"pos,omitempty"`
	Pkg    string `json:"pkg,omitempty"`
	// ImpS   string `json:",omitempty"`
	ImpN string `json:",omitempty"`
	Type string `json:",omitempty"`

	Err     string `json:",omitempty"`
	ErrMsgs string `json:",omitempty"`
}

func Query_Gogetdoc

func Query_Gogetdoc(fullsrcfilepath string, srcin string, bytepos string, onlyDocAndDecl bool, docFromPlainToMarkdown bool) *Gogetdoc

type Guru

type Guru struct {
	gurujson.Describe

	IsLessThan func(*gurujson.DescribeMember, *gurujson.DescribeMember) bool `json:"-"`
}

func QueryDesc_Guru

func QueryDesc_Guru(fullsrcfilepath string, srcin string, bytepos string) (*Guru, error)

func (*Guru) Len

func (me *Guru) Len() int

func (*Guru) Less

func (me *Guru) Less(i int, j int) bool

func (*Guru) Matches

func (me *Guru) Matches(pM *gurujson.DescribeMember, lowerCaseQuery string) bool

func (*Guru) Swap

func (me *Guru) Swap(i int, j int)

type PackageError

type PackageError struct {
	ImportStack []string // shortest path from package named on command line to this one
	Pos         string   // position of error (if present, file:line:col)
	Err         string   // the error itself
}

copied over from `go list` src because that cmd outputs this stuff but one cannot import it from anywhere

type Pkg

type Pkg struct {
	ApproxLoC int // 0 unless/until calling CountLoC()
	build.Package
	Errs udev.SrcMsgs

	Deps        []string        `json:",omitempty"` // all (recursively) imported dependencies
	Target      string          `json:",omitempty"` // install path
	Shlib       string          `json:",omitempty"` // the shared library that contains this package (only set when -linkshared)
	StaleReason string          `json:",omitempty"` // why is Stale true?
	Stale       bool            `json:",omitempty"` // would 'go install' do anything for this package?
	Standard    bool            `json:",omitempty"` // is this package part of the standard Go library?
	Incomplete  bool            `json:",omitempty"` // was there an error loading this package or dependencies?
	Error       *PackageError   `json:",omitempty"` // error loading this package (not dependencies)
	DepsErrors  []*PackageError `json:",omitempty"` // errors loading dependencies
	// contains filtered or unexported fields
}

func PkgsForFiles

func PkgsForFiles(filePaths ...string) (pkgs []*Pkg, shouldRefresh bool)

func (*Pkg) CountLoC

func (me *Pkg) CountLoC()

func (*Pkg) Dependants

func (me *Pkg) Dependants() []string

func (*Pkg) GoFilePaths

func (me *Pkg) GoFilePaths(inclTests bool) []string

func (*Pkg) Importers

func (me *Pkg) Importers() []string

func (*Pkg) IsSortedPriorTo

func (me *Pkg) IsSortedPriorTo(pkg interface{}) bool

func (*Pkg) IsSortedPriorToByDeps

func (me *Pkg) IsSortedPriorToByDeps(cmp *Pkg) bool

func (*Pkg) String

func (me *Pkg) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL