server

package
v0.0.0-...-e8e64b1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Overview

Package server implements the Go documentation server.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlocked    = errors.New("blocked import path")
	ErrMismatch   = errors.New("import paths don't match")
	ErrNoPackages = errors.New("no packages found")
	ErrFetching   = errors.New("fetch in progress")

	ErrInvalidPlatform = errors.New("invalid platform")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	PackagePrefix  string
	Fallback       string
	ShareDir       string
	BrandName      string
	AdminName      string
	AdminEmail     string
	WebsiteIssues  string
	BindHTTP       string
	GoModCache     string
	UserAgent      string
	Platform       string
	RequestTimeout time.Duration
	MaxAge         time.Duration
	AssetsFS       fs.FS
	TemplatesFS    fs.FS
	Index          string
}

Server configuration.

type LoadMode

type LoadMode int

A LoadMode configures the amount of detail returned when loading a package.

const (
	NeedDocumentation LoadMode = 1 << iota
	NeedSubPackages
	NeedImports
	NeedProject
)

type Package

type Package struct {
	internal.Package
	doc.Documentation
	Project     *meta.Project
	Platform    string
	Dir         string
	Imported    []internal.Package
	SubPackages []internal.Package
	Message     string
	// contains filtered or unexported fields
}

Package contains package information and documentation for use in templates.

func (*Package) AllExamples

func (pkg *Package) AllExamples() []*texample

func (*Package) Breadcrumbs

func (pkg *Package) Breadcrumbs(templateName string) htemp.HTML

func (*Package) Cgo

func (pkg *Package) Cgo() bool

func (*Package) IsCommand

func (pkg *Package) IsCommand() bool

func (*Package) ObjExamples

func (pkg *Package) ObjExamples(obj interface{}) []*texample

func (*Package) PackageExamples

func (pkg *Package) PackageExamples() []*texample

func (*Package) PageName

func (pkg *Package) PageName() string

func (*Package) PlatformParam

func (pkg *Package) PlatformParam() string
func (pkg *Package) SourceLink(pos doc.Pos, text string, textOnlyOK bool) htemp.HTML

func (*Package) VersionParam

func (pkg *Package) VersionParam() string

func (*Package) View

func (pkg *Package) View(view string) string

type Server

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

The Go documentation server.

func New

func New(cfg *Config) (*Server, error)

New returns a new server with the given configuration.

func (*Server) HTTPHandler

func (s *Server) HTTPHandler() (http.Handler, error)

type TemplateMap

type TemplateMap map[string]interface {
	Execute(io.Writer, interface{}) error
}

func (TemplateMap) Execute

func (m TemplateMap) Execute(w io.Writer, name string, data interface{}) error

func (TemplateMap) ExecuteHTML

func (m TemplateMap) ExecuteHTML(resp http.ResponseWriter, name string, status int, data interface{}) error

func (TemplateMap) ExecuteHTTP

func (m TemplateMap) ExecuteHTTP(resp http.ResponseWriter, name string, status int, data interface{}) error

func (TemplateMap) ParseHTML

func (m TemplateMap) ParseHTML(name string, funcs htemp.FuncMap, fs fs.FS, files ...string) error

Jump to

Keyboard shortcuts

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