ctx

package
v1.1.5-0...-dfb45c8 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGoMod

func IsGoMod(workDir string) (bool, error)

IsGoMod is used to determine whether workDir is a go module project through command `go list -json -m`

Types

type Module

type Module struct {
	Path      string
	Main      bool
	Dir       string
	GoMod     string
	GoVersion string
}

type ProjectContext

type ProjectContext struct {
	WorkDir string
	// Name is the root name of the project
	// eg: go-zero、greet
	Name string
	// Path identifies which module a project belongs to, which is module value if it's a go mod project,
	// or else it is the root name of the project, eg: github.com/tal-tech/go-zero、greet
	Path string
	// Dir is the path of the project, eg: /Users/keson/goland/go/go-zero、/Users/keson/go/src/greet
	Dir string
}

func Prepare

func Prepare(workDir string) (*ProjectContext, error)

Prepare checks the project which module belongs to,and returns the path and module. workDir parameter is the directory of the source of generating code, where can be found the project path and the project module,

Jump to

Keyboard shortcuts

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