inputcheck

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inputcheck holds the format checks for values people type into forms: email addresses, host names, web addresses, folder paths and keys.

Each check returns "" when the value is fine (a blank value is fine too, so optional fields can use the same call) or a short, friendly sentence that can be shown to the person as it is. The same rules are written out in web/src/validate.ts so the page and the server agree.

The package depends on nothing else in the repo, so any package can use it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKey

func APIKey(v string) string

APIKey wants one unbroken string, the way keys and tokens are.

func AbsPath

func AbsPath(v, example string) string

AbsPath wants an absolute folder path: /..., D:\..., or \\server\share.

func Email

func Email(v string) string

Email checks one address.

func HTTPURL

func HTTPURL(v, example string, requireScheme bool) string

HTTPURL wants an http or https web address with a server name in it. With requireScheme false, an address typed without http:// is accepted, for the forms that add the scheme themselves.

func Host

func Host(v, example string) string

Host wants a bare host name or IP address: no scheme, path or port. example is shown in the message, for instance "news.example.com".

func LooksLikeHost

func LooksLikeHost(h string) bool

LooksLikeHost reports whether h is a host name, an IPv4 address or an IPv6 address, with no scheme, port or path (IPv6 without brackets).

func ValidEmail

func ValidEmail(email string) bool

ValidEmail is deliberately loose (one @, something on both sides, a dot in the domain, no spaces): it catches typos, not every RFC quirk.

Types

This section is empty.

Jump to

Keyboard shortcuts

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