server

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpdateTip_Nothing = iota
	UpdateTip_ToUpdate
	UpdateTip_Updating
	UpdateTip_Updated
)
View Source
const (
	ResTypeNone           pageResType = ""
	ResTypeAPI            pageResType = "api"
	ResTypeModule         pageResType = "mod"
	ResTypePackage        pageResType = "pkg"
	ResTypeDependency     pageResType = "dep"
	ResTypeImplementation pageResType = "imp"
	ResTypeSource         pageResType = "src"
	ResTypeReference      pageResType = "use"
	ResTypeCSS            pageResType = "css"
	ResTypeJS             pageResType = "jvs"
	ResTypeSVG            pageResType = "svg"
	ResTypePNG            pageResType = "png"
)
View Source
const (
	DotMStyle_Unexported = -1
	DotMStyle_NotShow    = 0
	DotMStyle_Exported   = 1
)
View Source
const (
	Phase_Unprepared = iota
	Phase_Analyzed
)
View Source
const DurationToUpdate = time.Hour * 24 * 64
View Source
const Size = 1024 * 1024

Variables

View Source
var (
	BoldTagStart = []byte("<b>")
	BoldTagEnd   = []byte("</b>")
)
View Source
var (
	StarSlash = []byte("*/")
)
View Source
var UpdateTip2DivID = []string{
	UpdateTip_Nothing:  "",
	UpdateTip_ToUpdate: "to-update",
	UpdateTip_Updating: "updating",
	UpdateTip_Updated:  "updated",
}

Functions

func BuildLineOffsets

func BuildLineOffsets(content []byte, onlyStatLineCount bool) (int, []int)

func DotDotSlashes

func DotDotSlashes(count int) string

func FindPackageCommonPrefixPaths

func FindPackageCommonPrefixPaths(pa, pb string) string

func Gen

func Gen(intent, outputDir, lang string, args []string, options DocsGenerationOptions, goldVersion string, printUsage func(io.Writer), viewDocsCommand func(string) string)

func GenDocs

func GenDocs(outputDir string, args []string, lang string, options DocsGenerationOptions, goldVersion string, printUsage func(io.Writer), viewDocsCommand func(string) string)

nouses, plainsrc, silent, moregc bool

func GenTestData

func GenTestData(outputDir string, args []string, silent bool, goldVersion string, printUsage func(io.Writer))

func ImprovePackagesForListing

func ImprovePackagesForListing(pkgs []*PackageForListing)

func NewHtmlPage

func NewHtmlPage(goldVersion, title string, theme Theme, translation Translation, currentPageInfo pagePathInfo) *htmlPage

func PreviousVersion added in v0.0.5

func PreviousVersion(version string) string

Return "" for invalid. Assume the digits of major/minor/patch are all from 0 to 9.

func RelativePath

func RelativePath(a, b string) string

func Run

func Run(recommendedPort, lang string, args []string, silentMode bool, goldVersion string, printUsage func(io.Writer), roughBuildTime func() time.Time)

func WriteHtmlEscapedBytes

func WriteHtmlEscapedBytes(w io.Writer, data []byte)

Please make sure w.Write never makes errors.

Types

type ChanCommOprator

type ChanCommOprator struct {
	// contains filtered or unexported fields
}

func (*ChanCommOprator) End

func (ccp *ChanCommOprator) End() token.Pos

func (*ChanCommOprator) Pos

func (ccp *ChanCommOprator) Pos() token.Pos

type Content added in v0.1.1

type Content [][]byte // all []byte with capacity Size

func (Content) DataLength added in v0.1.1

func (c Content) DataLength() int

type ContentPool added in v0.1.1

type ContentPool struct {
	// contains filtered or unexported fields
}

type DocsGenerationOptions added in v0.1.1

type DocsGenerationOptions struct {
	NoIdentifierUsesPages bool
	PlainSourceCodePages  bool
	SilentMode            bool
	IncreaseGCFrequency   bool
	EmphasizeWdPkgs       bool
}

type ExportedType

type ExportedType struct {
	TypeName *code.TypeName
	Fields   []*code.Selector
	Methods  []*code.Selector
	//ImplementedBys []*code.TypeInfo
	//Implements     []code.Implementation
	ImplementedBys []TypeForListing
	Implements     []TypeForListing

	// All are in the current package.
	// (Nearby packages should also be checked? Module scope is better!)
	//Values []code.ValueResource
	Values []ValueForListing

	// Including functions/methods, and variables.
	// At present, only the values in the current package will be collected.
	// (Nearby packages should also be checked.)
	//
	// For non-interface types, all functions are declared in the current package.
	// For interface types (except error), may include functions in outside packages.
	// ToDo: collect outside ones at analyzing phase, or at page generation phase.
	//       Only the packages imported this package need to be checked.
	//       Packages importing the packages containing any alias of this type
	//       also need to be checked. (Also any types depending on this type?)
	//AsInputsOf  []code.ValueResource
	//AsOutputsOf []code.ValueResource
	AsInputsOf  []ValueForListing
	AsOutputsOf []ValueForListing

	Popularity int
}

type FieldForListing

type FieldForListing struct {
	*code.Selector
	Middles []*code.Field
	// contains filtered or unexported fields
}

type FileInfo

type FileInfo struct {
	Filename     string
	MainPosition *token.Position // for main packages only
	HasDocs      bool
}

type KeywordToken

type KeywordToken struct {
	// contains filtered or unexported fields
}

see https://groups.google.com/forum/#!topic/golang-tools/PaJBT2WjEPQ

func (*KeywordToken) End

func (kw *KeywordToken) End() token.Pos

func (*KeywordToken) Pos

func (kw *KeywordToken) Pos() token.Pos

type LoadingLogMessage

type LoadingLogMessage struct {
	ID      int
	Message string
}

type MethodImplementationResult added in v0.0.8

type MethodImplementationResult struct {
	TypeName    *code.TypeName
	Package     *code.Package
	IsInterface bool

	Methods []MethodImplementations

	NonImplementingMethodCount int32
}

type MethodImplementations added in v0.0.8

type MethodImplementations struct {
	Method          *code.Selector
	Implementations []MethodInfo
}

type MethodInfo added in v0.0.8

type MethodInfo struct {
	Method    *code.Selector
	Receiver  *TypeForListing
	Explicit  bool // whether or not the method is explicit
	Interface bool // whether or not the Owner is an interface type
}

type ObjectReferences added in v0.1.0

type ObjectReferences struct {
	Pkg          *code.Package
	CommonPath   string // relative to the current package
	InCurrentPkg bool
	Identifiers  []code.Identifier
}

type Overview

type Overview struct {
	Packages []*PackageForListing

	code.Stats
}

type PackageDependencyInfo

type PackageDependencyInfo struct {
	Name       string
	ImportPath string
	Index      int

	Imports     []*PackageForListing
	ImportedBys []*PackageForListing
}

type PackageDetails

type PackageDetails struct {
	Package *code.Package

	IsStandard     bool
	Index          int
	Name           string
	ImportPath     string
	Files          []FileInfo
	ValueResources []code.ValueResource
	//ExportedTypeNames []*code.TypeName
	//UnexportedTypeNames []*code.TypeName
	ExportedTypeNames []*ExportedType // also including unexported ones when "show=all" query parameter is set.

	HasHiddenTypeNames bool

	NumDeps     uint32
	NumDepedBys uint32
}

type PackageForListing

type PackageForListing struct {
	Package *code.Package

	Index     int
	Mod       *code.Module
	Name      string
	Path      string // blank for not analyzed yet
	Prefix    string // the part shared with the last one in list
	Remaining string // the part different from the last one in list

	DepLevel       int32
	NumImportedBys int32

	InWorkingDirectory bool
}

type ReferencesResult added in v0.1.0

type ReferencesResult struct {
	Package    *code.Package
	Identifier string
	Resource   code.Resource
	Selector   *code.Selector // non-nil for fields and methods
	References []*ObjectReferences
	UsesCount  int
}

type SourceFileAnalyzeResult

type SourceFileAnalyzeResult struct {
	PkgPath       string
	BareFilename  string
	OriginalPath  string
	GeneratedPath string
	Lines         []string
	NumRatios     int32
	DocStartLine  int
	DocEndLine    int
}

type TestData_Package

type TestData_Package struct {
	Types      map[string]TestData_Type
	VarNames   []string
	ConstNames []string
	FuncNames  []string
}

type TestData_Type

type TestData_Type struct {
	FieldNames         []string
	MethodNames        []string
	ImplementedByCount int
	ImplementCount     int
	ValueCount         int
	AsInputCount       int
	AsOutputCount      int
}

type Theme

type Theme interface {
	Name() string
	CSS() string
}

type Translation

type Translation interface {
	Name() string
	LangTag() string

	// common
	Text_Space() string
	Text_Comma() string
	Text_Colon(tailSpace bool) string
	Text_Period(paragraphEnd bool) string
	Text_EnclosedInOarentheses(text string) string
	Text_PreferredFontList() string
	Text_BlankList() string

	// server
	Text_Server_Started() string

	// analyzing
	Text_Analyzing() string
	Text_AnalyzingRefresh(currentPageURL string) string // also used in other pages
	Text_Analyzing_Start() string
	Text_Analyzing_Done(d time.Duration, memoryUse string) string

	Text_Analyzing_PreparationDone(d time.Duration) string // ToDo: merge these into one?
	Text_Analyzing_NFilesParsed(numFiles int, d time.Duration) string
	Text_Analyzing_ParsePackagesDone(numFiles int, d time.Duration) string
	Text_Analyzing_CollectPackages(numPkgs int, d time.Duration) string
	Text_Analyzing_SortPackagesByDependencies(d time.Duration) string
	Text_Analyzing_CollectDeclarations(d time.Duration) string
	Text_Analyzing_CollectRuntimeFunctionPositions(d time.Duration) string
	Text_Analyzing_FindTypeSources(d time.Duration) string
	Text_Analyzing_CollectSelectors(d time.Duration) string
	Text_Analyzing_FindImplementations(d time.Duration) string
	Text_Analyzing_RegisterInterfaceMethodsForTypes(d time.Duration) string
	Text_Analyzing_MakeStatistics(d time.Duration) string
	Text_Analyzing_CollectSourceFiles(d time.Duration) string
	Text_Analyzing_CollectObjectReferences(d time.Duration) string
	Text_Analyzing_CacheSourceFiles(d time.Duration) string

	// overview page
	Text_Overview() string
	Text_PackageList() string
	Text_StatisticsWithMoreLink(detailedStatsLink string) string
	Text_SimpleStats(stats *code.Stats) string
	Text_Modules() string                                    // to use
	Text_BelongingModule() string                            // to use
	Text_RequireStat(numRequires, numRequiredBys int) string // to use
	Text_UpdateTip(tipName string) string                    // tip names: "ToUpdate", "Updating", "Updated"

	Text_SortBy() string                // also used in other pages
	Text_Filter() string                // also used in other pages
	Text_SortByItem(by string) string   // also used in other pages
	Text_FilterItem(fltr string) string // also used in other pages

	// package details page
	Text_Package(pkgPath string) string
	Text_BelongingPackage() string // also used in source code page
	Text_PackageDocsLinksOnOtherWebsites(pkgPath string, isStdPkg bool) string
	Text_ImportPath() string
	Text_ImportStat(numImports, numImportedBys int, depPageURL string) string
	Text_InvolvedFiles(num int) string
	Text_ExportedValues(num int) string
	Text_ExportedTypeNames(num int) string
	Text_AllPackageLevelTypeNames(num int) string
	Text_TypeNameListShowOption(exportedsOnly bool) string

	Text_Fields(num int, exportedsOnly bool) string // ToDo: merge these into one?
	Text_Methods(num int, exportedsOnly bool) string
	Text_ImplementedBy(num int) string
	Text_Implements(num int) string
	Text_AsOutputsOf(num int) string
	Text_AsInputsOf(num int) string
	Text_AsTypesOf(num int) string
	Text_References(num int) string

	// package dependencies page
	Text_DependencyRelations(pkgPath string) string // also used in package details page with a blank argument.
	Text_Imports() string
	Text_ImportedBy() string

	// method implementation page
	Text_MethodImplementations() string
	Text_NumMethodsImplementingNothing(count int) string

	// object references(uses) page
	Text_ReferenceList() string
	Text_ObjectKind(kind string) string
	Text_ObjectUses(num int) string // also used in other pages

	// source code page
	Text_SourceCode(pkgPath, bareFilename string) string
	Text_SourceFilePath() string
	Text_GeneratedFrom() string

	// statistics
	Text_Statistics() string
	Text_ChartTitle(chartName string) string
	Text_StatisticsTitle(titleName string) string
	Text_PackageStatistics(values map[string]interface{}) string
	Text_TypeStatistics(values map[string]interface{}) string
	Text_ValueStatistics(values map[string]interface{}) string
	Text_Othertatistics(values map[string]interface{}) string

	// Footer
	Text_GeneratedPageFooter(goldVersion, qrCodeLink, goOS, goArch string) string
}

type TypeForListing

type TypeForListing struct {
	*code.TypeName
	IsPointer    bool
	InCurrentPkg bool
	CommonPath   string // relative to the current package
}

type ValueForListing

type ValueForListing struct {
	code.ValueResource
	InCurrentPkg bool
	CommonPath   string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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