codelinks

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedRemoteRepository = errors.New("create logging CodeLinker: Unsupported remote repository, must be github (or github enterprise)") //nolint:lll
)

Functions

func GithubLink(module string, file string, ref string, line int) string

GithubLink creates a link to a github site

NOTE: github.com is NOT hard coded as ghe instances are not hosted on github.com, yet this code works just fine

Types

type CodeLinker

type CodeLinker interface {
	// Link produces a source code link from source file and line number
	Link(file string, line int) string
}

CodeLinker defines objects that can produce source code links from file and line number

func GetCodeLinker

func GetCodeLinker() (CodeLinker, error)

GetCodeLinker gets the application's code linker

Return value depends on the build constants. See project documentation for more info. Defaults use local links

Errors returned here are not serious, and loggers will work without a linker, but it is recommended you at least log the error

type LocalLinker

type LocalLinker struct{}

LocalLinker produces links to the local file system

The local file system is actually the file system at build time, so is only useful in development where build and run occur on the same machine

func (l LocalLinker) Link(file string, line int) string

Link produces a source code link to the local file system

Jump to

Keyboard shortcuts

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