mapper

package
v0.3.0-omnisci Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mapper contains a translator using a raw map[string]string

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finder

type Finder struct {
	Map map[string]string
}

Finder implements license.Finder and sets the license type based on the given mapping if the path exists in the map.

func (*Finder) License

func (f *Finder) License(ctx context.Context, m module.Module) (*license.License, error)

License implements license.Finder

type Translator

type Translator struct {
	// Map is the mapping of package names to translate. If the name is
	// exact then it will map exactly to the destination. If the name begins
	// and ends with `/` (forward slash) then it will be treated like a regular
	// expression. The destination can use \1, \2, ... to reference capture
	// groups.
	//
	// The translation will run until in a loop until no translation occurs
	// anymore or len(Map) translations occur, in which case it is an error.
	Map map[string]string
}

func (Translator) Translate

func (t Translator) Translate(ctx context.Context, m module.Module) (module.Module, bool)

Jump to

Keyboard shortcuts

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