File: define.go

package info (click to toggle)
golang-github-containers-common 0.50.1%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,440 kB
  • sloc: makefile: 118; sh: 46
file content (25 lines) | stat: -rw-r--r-- 813 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package types

import (
	"errors"
	"fmt"
	"regexp"
)

var (
	// ErrNoSuchNetwork indicates the requested network does not exist
	ErrNoSuchNetwork = errors.New("network not found")

	// ErrInvalidArg indicates that an invalid argument was passed
	ErrInvalidArg = errors.New("invalid argument")

	// ErrNetworkExists indicates that a network with the given name already
	// exists.
	ErrNetworkExists = errors.New("network already exists")

	// NameRegex is a regular expression to validate names.
	// This must NOT be changed.
	NameRegex = regexp.MustCompile("^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")
	// RegexError is thrown in presence of an invalid name.
	RegexError = fmt.Errorf("names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: %w", ErrInvalidArg) // nolint:revive // This lint is new and we do not want to break the API.
)