util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 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 UpperFirst

func UpperFirst(s string) string

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

func WriteToFile

func WriteToFile(filename string, data []byte)

WriteToFile writes data into target file.

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