Documentation
¶
Overview ¶
Example (Install_golang_migrate) ¶
os.Setenv("GOBIN", "bin")
err := golang_migrate.Install()
if err != nil {
panic(err)
}
fmt.Print(shellExec("./bin/migrate -version"))
Output: 4.19.0
Example (Install_golangci_lint) ¶
os.Setenv("GOBIN", "bin")
err := golangci_lint.Install()
if err != nil {
panic(err)
}
fmt.Print(shellExec("./bin/golangci-lint version --short"))
Output: 2.5.0
Index ¶
- func CacheDir() string
- func StripFirstDir(dir string) error
- type DefaultTransport
- type ErrNoURLs
- type Event
- type Fetchup
- func (fu *Fetchup) Download(u string) error
- func (fu *Fetchup) FastestURL() (fastest string)
- func (fu *Fetchup) Fetch() error
- func (fu *Fetchup) Request(u string) (*Response, error)
- func (fu *Fetchup) UnTar(r io.Reader) error
- func (fu *Fetchup) UnZip(r io.Reader) error
- func (fu *Fetchup) WithContext(ctx context.Context) *Fetchup
- func (fu *Fetchup) WithLogger(logger Logger) *Fetchup
- func (fu *Fetchup) WithSaveTo(to string) *Fetchup
- type Log
- type Logger
- type Response
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StripFirstDir ¶
StripFirstDir removes the first dir but keep all its children.
Types ¶
type DefaultTransport ¶
type DefaultTransport struct {
UA string
}
DefaultTransport is the default http transport for fetchup, it auto handles the gzip and user-agent.
type Fetchup ¶
type Fetchup struct {
Ctx context.Context
// SaveTo is the path to save the file.
SaveTo string
// URLs is the list of candidates, the fastest one will be used to download the file.
URLs []string
Logger Logger
// SpeedPacketSize is the size of the packet used to calculate the download speed.
// The size should be much smaller than the whole file size to download.
SpeedPacketSize int
MinReportSpan time.Duration
HttpClient *http.Client
}
func (*Fetchup) FastestURL ¶
func (*Fetchup) WithContext ¶ added in v0.5.0
func (*Fetchup) WithLogger ¶ added in v0.5.0
func (*Fetchup) WithSaveTo ¶ added in v0.4.0
type Log ¶
type Log func(msg ...interface{})
Log type for Println
func MultiLogger ¶
MultiLogger is similar to https://golang.org/pkg/io/#MultiWriter
Click to show internal directories.
Click to hide internal directories.