autodiscovery package

import "code.pfad.fr/vanitydoc/autodiscovery"

package autodiscovery is an implementation of the VCS Autodiscovery RFC.

Index

type Forge

Forge indicates the URLs pattern available in the software forge (with {ref}, {path} and {line} as placeholders).

func (Forge) DirURL

func (Forge) FileURL

func (Forge) LineURL

func (Forge) RawFileURL

type VCS

VCS represents the Version Control System being used.

func Forgejo

Forgejo generates VCS for forgejo/gitea. For instance "https://codeberg.org/pfad.fr/vanitydoc" and defaultBranch "main".

func Github

Github generates VCS for github. For instance "https://github.com/fluhus/godoc-tricks" and defaultBranch "main".

func Infer

Infer tries to infer the VCS from the clone url (not reliable, use at you own risks!)

func New

New creates a VCS of the given type (forgejo, gitsrht, hgsrht, github).

func SourceHutGit

SourceHutGit generates VCS for git.sr.ht. For instance "https://git.sr.ht/~username/repo" and defaultBranch "main".

func SourceHutHg

SourceHutHg generates VCS for hg.sr.ht. For instance "https://hg.sr.ht/~username/repo" and defaultBranch "tip".

func (VCS) GoImport

GoImport writes the go-import meta tag.

func (VCS) GoSource

GoSource writes the go-source meta tag. Its format officially does not contain the version however its seem to be used by pkgsite as {commit}.

func (VCS) MetaTags

MetaTags writes the VCS Autodiscovery RFC meta tags (which are not empty).

Source Files

autodiscovery.go