files

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSource

type FileSource interface {
	// Name returns a string describing the file source.
	Name() string

	// Match returns a slice of logical paths to spec files that should be
	// linted from the given resource set configuration.
	Match(*config.ResourceSet) ([]string, error)

	// Fetch retrieves the contents of the requested logical path as a local
	// file and returns the absolute path where it may be found. An empty
	// string, rather than an error, is returned if the file does not exist.
	Fetch(path string) (string, error)

	// Close releases any resources consumed in content retrieval. Any files
	// returned by Fetch will no longer be available after calling Close, and
	// any further calls to Fetch will error.
	Close() error
}

FileSource defines a source of spec files to lint. This abstraction allows linters to operate seamlessly over version control systems and local files.

type LocalFSSource

type LocalFSSource struct{}

LocalFSSource is a FileSource that resolves files from the local filesystem relative to the current working directory.

func (LocalFSSource) Close

func (LocalFSSource) Close() error

Close implements FileSource.

func (LocalFSSource) Fetch

func (LocalFSSource) Fetch(path string) (string, error)

Fetch implements FileSource.

func (LocalFSSource) Match

func (LocalFSSource) Match(rcConfig *config.ResourceSet) ([]string, error)

Match implements FileSource.

func (LocalFSSource) Name added in v1.3.0

func (LocalFSSource) Name() string

Name implements FileSource.

type NilSource

type NilSource struct{}

NilSource is a FileSource that does not have any files in it.

func (NilSource) Close

func (NilSource) Close() error

Close implements FileSource.

func (NilSource) Fetch

func (NilSource) Fetch(path string) (string, error)

Fetch implements FileSource.

func (NilSource) Match

func (NilSource) Match(*config.ResourceSet) ([]string, error)

Match implements FileSource.

func (NilSource) Name added in v1.3.0

func (NilSource) Name() string

Name implements FileSource.

Jump to

Keyboard shortcuts

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