GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Why Go
  • Case Studies
  • Use Cases
  • Security
  • Learn
  • Effective Go
  • Go User Manual
  • Standard library
  • Release Notes
  • API
  • Packages
  • Recorded Talks
  • Meetups
  • Conferences

This view

  • Original page
  • New address

GeezerVison is showing pkg.go.dev — common package - knative.dev/func/cmd/common - Go Packages

Details

  • checked Valid go.mod file

    The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.

  • checked Redistributable license

    Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.

  • checked Tagged version

    Modules with tagged versions give importers more predictable builds.

  • unchecked Stable version

    When a project reaches major version v1 it is considered stable.

  • Learn more about best practices

Repository

github.com/knative/func

Links

  • Open Source Insights Logo Open Source Insights

Documentation ¶

Index ¶

  • Variables
  • func NewGitCliWrapper() *gitCliWrapper
  • type CurrentBranchFunc
  • type FunctionLoader
  • type FunctionLoaderSaver
  • type FunctionSaver
  • type MockLoaderSaver
    • func NewMockLoaderSaver() *MockLoaderSaver
    • func (m MockLoaderSaver) Load(path string) (fn.Function, error)
    • func (m MockLoaderSaver) Save(f fn.Function) error
  • type WorkDirFunc

Constants ¶

This section is empty.

Variables ¶

View Source
var CurrentBranchStub = func(output string, err error) CurrentBranchFunc {
	return func(_ string) (string, error) {
		if err != nil {
			return "", err
		}

		return output, nil
	}
}

CurrentBranchStub creates a stub CurrentBranchFunc that returns the provided output or error.

View Source
var WorkDirStub = func(dir string, err error) WorkDirFunc {
	return func() (string, error) { return dir, err }
}

WorkDirStub creates a stub WorkDirFunc that returns the provided directory or error.

Functions ¶

func NewGitCliWrapper ¶

func NewGitCliWrapper() *gitCliWrapper

NewGitCliWrapper creates a new git CLI wrapper using FUNC_GIT env var or "git" as default.

Types ¶

type CurrentBranchFunc ¶

type CurrentBranchFunc func(path string) (string, error)

CurrentBranchFunc is a function type that retrieves the current git branch for a given path.

var DefaultCurrentBranch CurrentBranchFunc = NewGitCliWrapper().CurrentBranch

DefaultCurrentBranch is the default implementation for getting the current git branch.

type FunctionLoader ¶

type FunctionLoader interface {
	Load(path string) (fn.Function, error)
}

FunctionLoader loads a function from a filesystem path.

type FunctionLoaderSaver ¶

type FunctionLoaderSaver interface {
	FunctionLoader
	FunctionSaver
}

FunctionLoaderSaver combines loading and saving capabilities for functions.

var DefaultLoaderSaver FunctionLoaderSaver = standardLoaderSaver{}

DefaultLoaderSaver implements FunctionLoaderSaver composite interface

type FunctionSaver ¶

type FunctionSaver interface {
	Save(f fn.Function) error
}

FunctionSaver persists a function to storage.

type MockLoaderSaver ¶

type MockLoaderSaver struct {
	LoadFn func(path string) (fn.Function, error)
	SaveFn func(f fn.Function) error
}

MockLoaderSaver provides configurable function loading and saving for testing purposes.

func NewMockLoaderSaver ¶

func NewMockLoaderSaver() *MockLoaderSaver

NewMockLoaderSaver creates a MockLoaderSaver with default no-op implementations.

func (MockLoaderSaver) Load ¶

func (m MockLoaderSaver) Load(path string) (fn.Function, error)

Load invokes the configured LoadFn to load a function from the given path.

func (MockLoaderSaver) Save ¶

func (m MockLoaderSaver) Save(f fn.Function) error

Save invokes the configured SaveFn to persist the given function.

type WorkDirFunc ¶

type WorkDirFunc func() (string, error)

WorkDirFunc is a function type that retrieves the current working directory.

var DefaultWorkDir WorkDirFunc = os.Getwd

DefaultWorkDir is the default implementation for getting the current working directory.

Source Files ¶

View all Source files
  • common.go
Click to show internal directories.
Click to hide internal directories.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.