Documentation ¶
Overview ¶
Package deptfile provides the structure of deptfile and functions to control it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FileName = "gotool.mod" FileSumName = "gotool.sum" )
Functions ¶
Types ¶
type File ¶
type File struct { Require []*Require // contains filtered or unexported fields }
File represents the root struct of deptfile.
type Tool ¶
Tool represents a tool that is belongs to a module. In deptfile representation, a module is represents as a Require. Path is the absolute tool path from the module root. If Path is empty, it means the package of the tool is in the module root. Name is the tool name. If Name is empty, it means Name is the same as filepath.Base(Path).
type Workspace ¶
type Workspace struct { // SourcePath is the root path for finding go.mod and go.sum. // If SourcePath is empty, SourcePath is the Git project root. SourcePath string // DoNotCopy doesn't copy gotool.mod and gotool.sum to the workspace. DoNotCopy bool // DoNotUpdate doesn't update gotool.mod and gotool.sum. // It is used for commands which doesn't need to update gotool.mod such like 'dept build'. DoNotUpdate bool }
Workspace is an implementation for Workspacer. The environment is created in a temp dir.
type Workspacer ¶
type Workspacer interface { // Do copies gotool.mod and gotool.sum to the workspace. // If gotool.mod is not found, Do returns ErrNotFound. Do(f func(projectDir string, gomod *File) error) error }
Workspacer provides an environment to edit go.mod and go.sum.
type WorkspacerMock ¶
type WorkspacerMock struct { // DoFunc mocks the Do method. DoFunc func(f func(projectDir string, gomod *File) error) error // contains filtered or unexported fields }
WorkspacerMock is a mock implementation of Workspacer.
func TestSomethingThatUsesWorkspacer(t *testing.T) { // make and configure a mocked Workspacer mockedWorkspacer := &WorkspacerMock{ DoFunc: func(f func(projectDir string, gomod *File) error) error { panic("mock out the Do method") }, } // use mockedWorkspacer in code that requires Workspacer // and then make assertions. }
Click to show internal directories.
Click to hide internal directories.