workcmd

Imports

Imports #

"cmd/go/internal/base"
"cmd/go/internal/gover"
"cmd/go/internal/modload"
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"golang.org/x/mod/module"
"golang.org/x/mod/modfile"
"context"
"path/filepath"
"cmd/go/internal/base"
"cmd/go/internal/fsys"
"cmd/go/internal/gover"
"cmd/go/internal/modload"
"golang.org/x/mod/modfile"
"cmd/go/internal/base"
"cmd/go/internal/gover"
"cmd/go/internal/imports"
"cmd/go/internal/modload"
"cmd/go/internal/toolchain"
"context"
"golang.org/x/mod/module"
"context"
"fmt"
"io/fs"
"os"
"path/filepath"
"cmd/go/internal/base"
"cmd/go/internal/fsys"
"cmd/go/internal/gover"
"cmd/go/internal/modload"
"cmd/go/internal/str"
"cmd/go/internal/toolchain"
"golang.org/x/mod/modfile"
"cmd/go/internal/base"
"cmd/go/internal/cfg"
"cmd/go/internal/modcmd"
"cmd/go/internal/modload"
"context"
"cmd/go/internal/base"

Constants & Variables

CmdWork var #

var CmdWork = *ast.UnaryExpr

cmdEdit var #

var cmdEdit = *ast.UnaryExpr

cmdInit var #

var cmdInit = *ast.UnaryExpr

cmdSync var #

var cmdSync = *ast.UnaryExpr

cmdUse var #

var cmdUse = *ast.UnaryExpr

cmdVendor var #

var cmdVendor = *ast.UnaryExpr

editFmt var #

var editFmt = *ast.CallExpr

editGo var #

var editGo = *ast.CallExpr

editJSON var #

var editJSON = *ast.CallExpr

editPrint var #

var editPrint = *ast.CallExpr

editToolchain var #

var editToolchain = *ast.CallExpr

useR var #

var useR = *ast.CallExpr

vendorE var #

var vendorE bool

vendorO var #

var vendorO string

workedits var #

var workedits []func(file *modfile.WorkFile)

Type Aliases

flagFunc type #

type flagFunc func(string)

Structs

replaceJSON struct #

type replaceJSON struct {
Old module.Version
New module.Version
}

useJSON struct #

type useJSON struct {
DiskPath string
ModPath string `json:",omitempty"`
}

workfileJSON struct #

workfileJSON is the -json output data structure.

type workfileJSON struct {
Go string `json:",omitempty"`
Use []useJSON
Replace []replaceJSON
}

Functions

Set method #

func (f flagFunc) Set(s string) error

String method #

func (f flagFunc) String() string

allowedVersionArg function #

allowedVersionArg returns whether a token may be used as a version in go.mod. We don't call modfile.CheckPathVersion, because that insists on versions being in semver form, but here we want to allow versions like "master" or "1234abcdef", which the go command will resolve the next time it runs (or during -fix). Even so, we need to make sure the version is a valid token.

func allowedVersionArg(arg string) bool

editPrintJSON function #

editPrintJSON prints the -json output.

func editPrintJSON(workFile *modfile.WorkFile)

flagEditworkDropGodebug function #

flagEditworkDropGodebug implements the -dropgodebug flag.

func flagEditworkDropGodebug(arg string)

flagEditworkDropReplace function #

flagEditworkDropReplace implements the -dropreplace flag.

func flagEditworkDropReplace(arg string)

flagEditworkDropUse function #

flagEditworkDropUse implements the -dropuse flag.

func flagEditworkDropUse(arg string)

flagEditworkGodebug function #

flagEditworkGodebug implements the -godebug flag.

func flagEditworkGodebug(arg string)

flagEditworkReplace function #

flagEditworkReplace implements the -replace flag.

func flagEditworkReplace(arg string)

flagEditworkUse function #

flagEditworkUse implements the -use flag.

func flagEditworkUse(arg string)

init function #

func init()

init function #

func init()

init function #

func init()

init function #

func init()

init function #

func init()

parsePathVersionOptional function #

parsePathVersionOptional parses path[@version], using adj to describe any errors.

func parsePathVersionOptional(adj string, arg string, allowDirPath bool) (path string, version string, err error)

pathRel function #

pathRel returns the absolute and canonical forms of dir for use in a go.work file located in directory workDir. If dir is relative, it is interpreted relative to base.Cwd() and its canonical form is relative to workDir if possible. If dir is absolute or cannot be made relative to workDir, its canonical form is absolute. Canonical absolute paths are clean. Canonical relative paths are clean and slash-separated.

func pathRel(workDir string, dir string) (abs string, canonical string)

runEditwork function #

func runEditwork(ctx context.Context, cmd *base.Command, args []string)

runInit function #

func runInit(ctx context.Context, cmd *base.Command, args []string)

runSync function #

func runSync(ctx context.Context, cmd *base.Command, args []string)

runUse function #

func runUse(ctx context.Context, cmd *base.Command, args []string)

runVendor function #

func runVendor(ctx context.Context, cmd *base.Command, args []string)

workUse function #

func workUse(ctx context.Context, gowork string, wf *modfile.WorkFile, args []string)

Generated with Arrow