modparser

package
v0.0.0-...-8f68b79 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 5 Imported by: 0

README

got/modparser - go.mod 文件解析

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func New

func New(modPath string) (*Parser, error)

New 实例化一个mod文件解析器

func (*Parser) GetGoVersion

func (p *Parser) GetGoVersion() string

GetGoVersion go版本

func (*Parser) GetModPath

func (p *Parser) GetModPath() string

GetModPath 包名

func (*Parser) GetRequireIndirectModList

func (p *Parser) GetRequireIndirectModList() []string

GetRequireIndirectModList 间接引入的包列表

func (*Parser) GetRequireModList

func (p *Parser) GetRequireModList() []string

GetRequireModList 直接引用的包列表

func (*Parser) JsonMarshal

func (p *Parser) JsonMarshal() ([]byte, error)

JsonMarshal adapts to json/encoding Marshal API

func (*Parser) JsonMarshalIndent

func (p *Parser) JsonMarshalIndent(prefix, indent string) ([]byte, error)

JsonMarshalIndent same as json.MarshalIndent. Prefix is not supported.

func (*Parser) JsonMarshalToString

func (p *Parser) JsonMarshalToString() (string, error)

JsonMarshalToString convenient method to write as string instead of []byte

func (*Parser) Parse

func (p *Parser) Parse() *modfile.File

Parse go.mod文件解析成结构话结果modfile

func (*Parser) YamlMarshal

func (p *Parser) YamlMarshal() ([]byte, error)

YamlMarshal 转换为YAML格式

Jump to

Keyboard shortcuts

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