project

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupProjPath

func LookupProjPath(protoAbs string) (result string)

LookupProjPath get project path by proto absolute path assume that proto is in the project's api directory

Types

type ProjectInfo

type ProjectInfo struct {
	// AbsolutePath of the project
	AbsolutePath string
	// ImportPath of project
	ImportPath string
	// dir name of project
	Name string
	// parent dir of project, maybe empty
	Department string
	// grandma dir of project , maybe empty
	Typ            string
	HasInternalPkg bool
	// 从工作目录(working directory)到project目录的相对路径 比如a/b .. ../a
	// 作用是什么?
	// 假设目录结构是
	// -project
	//   - api/api.proto
	//   - internal/service
	// 我想在 internal/service下生成一个文件 service.go
	// work-dir 为 project/api
	// proto 生成命令为 protoc --xx_out=. api.proto
	// 那么在 protoc plugin 中的文件输出路径就得是 ../internal/service/ => {pathRefToProj}internal/service
	//
	PathRefToProj string
}

if proto file is inside a project (that has a /api directory) this present a project info 必须假设proto文件的路径就是相对work-dir的路径,否则无法找到proto文件以及对应的project

func NewProjInfo

func NewProjInfo(file string, modDirName string, modImportPath string) (projInfo *ProjectInfo, err error)

Jump to

Keyboard shortcuts

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