util

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineOutputPath

func CombineOutputPath(outputPath, ns string) string

CombineOutputPath read the output and path variables and render them into the final path

func Exists

func Exists(path string) bool

Exists reports whether a file exists.

func FormatCode

func FormatCode(code []byte) ([]byte, error)

FormatCode formats go source codes.

func GetGOPATH

func GetGOPATH() string

GetGOPATH retrieves the GOPATH from environment variables or the `go env` command.

func JoinPath

func JoinPath(elem ...string) string

JoinPath joins dirs as golang import format, such as xx/xx/xx

func LowerFirst

func LowerFirst(s string) string

LowerFirst converts the first letter to upper case for the given string.

func NotPtr

func NotPtr(s string) string

NotPtr converts an pointer type into non-pointer type.

func ReplaceString

func ReplaceString(s, old, new string, n int) string

ReplaceString be used in string substitution.

func RunGitCommand

func RunGitCommand(gitLink string) (string, string, error)

func SearchGoMod

func SearchGoMod(cwd string) (moduleName, path string, found bool)

SearchGoMod searches go.mod from the given directory (which must be an absolute path) to the root directory. When the go.mod is found, its module name and path will be returned.

func SnakeString

func SnakeString(s string) string

SnakeString converts the string 's' to a snake string

func UpperFirst

func UpperFirst(s string) string

UpperFirst converts the first letter to upper case for the given string.

Types

type StringSlice

type StringSlice []string

StringSlice implements the flag.Value interface on string slices to allow a flag to be set multiple times.

func (*StringSlice) Set

func (ss *StringSlice) Set(value string) error

Set implements the flag.Value interface.

func (*StringSlice) String

func (ss *StringSlice) String() string

Jump to

Keyboard shortcuts

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