lint
This commit is contained in:
parent
db722a9e98
commit
cb817b10c5
4
cmd.go
4
cmd.go
|
@ -18,7 +18,7 @@ type tool struct {
|
||||||
options []string
|
options []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cmds
|
// Cmds list of go commands
|
||||||
type Cmds struct {
|
type Cmds struct {
|
||||||
Vet Cmd `yaml:"vet,omitempty" json:"vet,omitempty"`
|
Vet Cmd `yaml:"vet,omitempty" json:"vet,omitempty"`
|
||||||
Fmt Cmd `yaml:"fmt,omitempty" json:"fmt,omitempty"`
|
Fmt Cmd `yaml:"fmt,omitempty" json:"fmt,omitempty"`
|
||||||
|
@ -29,7 +29,7 @@ type Cmds struct {
|
||||||
Run bool `yaml:"run,omitempty" json:"run,omitempty"`
|
Run bool `yaml:"run,omitempty" json:"run,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cmd
|
// Cmd single command fields and options
|
||||||
type Cmd struct {
|
type Cmd struct {
|
||||||
Status bool `yaml:"status,omitempty" json:"status,omitempty"`
|
Status bool `yaml:"status,omitempty" json:"status,omitempty"`
|
||||||
Method string `yaml:"method,omitempty" json:"method,omitempty"`
|
Method string `yaml:"method,omitempty" json:"method,omitempty"`
|
||||||
|
|
|
@ -54,7 +54,7 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewPollingWatcher returns a poll-based file watcher
|
// PollingWatcher returns a poll-based file watcher
|
||||||
func PollingWatcher(interval time.Duration) FileWatcher {
|
func PollingWatcher(interval time.Duration) FileWatcher {
|
||||||
if interval == 0 {
|
if interval == 0 {
|
||||||
interval = 100 * time.Millisecond
|
interval = 100 * time.Millisecond
|
||||||
|
@ -66,7 +66,7 @@ func PollingWatcher(interval time.Duration) FileWatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// New tries to use an fs-event watcher, and falls back to the poller if there is an error
|
// Watcher tries to use an fs-event watcher, and falls back to the poller if there is an error
|
||||||
func Watcher(force bool, interval time.Duration) (FileWatcher, error) {
|
func Watcher(force bool, interval time.Duration) (FileWatcher, error) {
|
||||||
if !force {
|
if !force {
|
||||||
if w, err := EventWatcher(); err == nil {
|
if w, err := EventWatcher(); err == nil {
|
||||||
|
@ -76,7 +76,7 @@ func Watcher(force bool, interval time.Duration) (FileWatcher, error) {
|
||||||
return PollingWatcher(interval), nil
|
return PollingWatcher(interval), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEventWatcher returns an fs-event based file watcher
|
// EventWatcher returns an fs-event based file watcher
|
||||||
func EventWatcher() (FileWatcher, error) {
|
func EventWatcher() (FileWatcher, error) {
|
||||||
w, err := fsnotify.NewWatcher()
|
w, err := fsnotify.NewWatcher()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -76,10 +76,7 @@ func main() {
|
||||||
if err := r.Server.start(p); err != nil {
|
if err := r.Server.start(p); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := r.run(p); err != nil {
|
return r.run(p)
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
},
|
},
|
||||||
Before: before,
|
Before: before,
|
||||||
},
|
},
|
||||||
|
|
|
@ -90,10 +90,7 @@ func (s *Settings) flimit() error {
|
||||||
rLimit.Max = uint64(s.FileLimit)
|
rLimit.Max = uint64(s.FileLimit)
|
||||||
rLimit.Cur = uint64(s.FileLimit)
|
rLimit.Cur = uint64(s.FileLimit)
|
||||||
|
|
||||||
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
|
return syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete realize folder
|
// Delete realize folder
|
||||||
|
|
Loading…
Reference in New Issue