utils

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetImportPath

func GetImportPath(filePath string) string

GetImportPath calculates and returns the golang import path for given `filePath`. Note that it needs a `go.mod` in current working directory or parent directories to detect the path.

func GetModPath

func GetModPath() string

GetModPath retrieves and returns the file path of go.mod for current project.

func GoFmt

func GoFmt(path string)

GoFmt formats the source file and adds or removes import statements as necessary.

func GoModTidy

func GoModTidy(ctx context.Context, dirPath string) error

GoModTidy executes `go mod tidy` at specified directory `dirPath`.

func HTTPDownloadFileWithPercent

func HTTPDownloadFileWithPercent(url string, localSaveFilePath string) error

HTTPDownloadFileWithPercent downloads target url file to local path with percent process printing.

func IsFileDoNotEdit

func IsFileDoNotEdit(filePath string) bool

IsFileDoNotEdit checks and returns whether file contains `do not edit` key.

func ReplaceGeneratedContentGFV2

func ReplaceGeneratedContentGFV2(folderPath string) (err error)

ReplaceGeneratedContentGFV2 replaces generated go content from goframe v1 to v2.

Types

This section is empty.

Jump to

Keyboard shortcuts

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