util

package
v0.0.0-...-41bfa65 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src, dest string) error

func EnsureDirectoryExists

func EnsureDirectoryExists(path string) error

func GenRandInt

func GenRandInt(min, max int) int

func InSlice

func InSlice(s string, ss []string) bool

func IsDirectoryExists

func IsDirectoryExists(path string) bool

func IsFileExists

func IsFileExists(path string) bool

func KeyFunc

func KeyFunc(key interface{}) (int64, int64, error)

func Move

func Move(src, dest string) error

func NewHttpClient

func NewHttpClient(timeout time.Duration, url string) *httpClient

func ReadFromFile

func ReadFromFile(fileName string) ([]byte, error)

func RemoveFile

func RemoveFile(filePath string)

func RunCmd

func RunCmd(exec exec.Interface, cmd []string) ([]byte, error)

func ToRegexp

func ToRegexp(pattern string) string

func TrimAndFilter

func TrimAndFilter(input []string) []string

func WriteIntoFile

func WriteIntoFile(content string, fileName string) error

Types

type Git

type Git struct {
	RepoDir string
	Branch  string
	Title   string
	// contains filtered or unexported fields
}

Git 封装 git 命令行,以避免依赖,golang 的 git 库需要按照 c 库

func NewGit

func NewGit(repoDir string, branch string, title string) *Git

func (*Git) Add

func (g *Git) Add() error

func (*Git) Checkout

func (g *Git) Checkout() error

func (*Git) Commit

func (g *Git) Commit() error

func (*Git) CurrentBranch

func (g *Git) CurrentBranch() (string, error)

func (*Git) LocalBranches

func (g *Git) LocalBranches() ([]string, error)

func (*Git) Push

func (g *Git) Push() error

type HttpInterface

type HttpInterface interface {
	Post(url string, val interface{}, data interface{}, header map[string]string) error
	Put(url string, val interface{}, data map[string]interface{}) error
	Get(url string, val interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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