lint
This commit is contained in:
parent
19139c287b
commit
3f131e3817
@ -2,8 +2,8 @@ package realize
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/build"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"go/build"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
@ -14,17 +14,25 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// RPrefix tool name
|
||||
RPrefix = "realize"
|
||||
// RVersion current version
|
||||
RVersion = "2.0"
|
||||
// RExt file extension
|
||||
RExt = ".yaml"
|
||||
// RFile config file name
|
||||
RFile = RPrefix + RExt
|
||||
// RDir config dir
|
||||
RDir = "." + RPrefix
|
||||
//RExtWin windows extension
|
||||
RExtWin = ".exe"
|
||||
)
|
||||
|
||||
type (
|
||||
// LogWriter used for all log
|
||||
LogWriter struct{}
|
||||
|
||||
// Realize main struct
|
||||
Realize struct {
|
||||
Settings Settings `yaml:"settings" json:"settings"`
|
||||
Server Server `yaml:"server" json:"server"`
|
||||
@ -38,6 +46,7 @@ type (
|
||||
Reload Func `yaml:"-"`
|
||||
}
|
||||
|
||||
// Context is used as argument for func
|
||||
Context struct {
|
||||
Path string
|
||||
Project *Project
|
||||
@ -46,6 +55,7 @@ type (
|
||||
Event fsnotify.Event
|
||||
}
|
||||
|
||||
// Func is used instead realize func
|
||||
Func func(Context)
|
||||
)
|
||||
|
||||
@ -67,7 +77,7 @@ func (r *Realize) Stop() {
|
||||
close(r.exit)
|
||||
}
|
||||
|
||||
// Run realize workflow
|
||||
// Start realize workflow
|
||||
func (r *Realize) Start() {
|
||||
r.exit = make(chan os.Signal, 2)
|
||||
signal.Notify(r.exit, os.Interrupt, syscall.SIGTERM)
|
||||
|
@ -66,7 +66,7 @@ func PollingWatcher(interval time.Duration) FileWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
// NewWatcher tries to use an fs-event watcher, and falls back to the poller if there is an error
|
||||
// NewFileWatcher tries to use an fs-event watcher, and falls back to the poller if there is an error
|
||||
func NewFileWatcher(force bool, interval time.Duration) (FileWatcher, error) {
|
||||
if !force {
|
||||
if w, err := EventWatcher(); err == nil {
|
||||
|
@ -127,7 +127,7 @@ func (p *Project) Before(){
|
||||
p.stamp("log", out, msg, "")
|
||||
}
|
||||
|
||||
// Error occurred
|
||||
// Err occurred
|
||||
func (p *Project) Err(err error) {
|
||||
if p.parent.Err != nil {
|
||||
p.parent.Err(Context{Project: p})
|
||||
|
@ -1,12 +1,12 @@
|
||||
package realize
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"log"
|
||||
"bytes"
|
||||
"strings"
|
||||
"os"
|
||||
"errors"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestProject_After(t *testing.T) {
|
||||
|
@ -5,11 +5,17 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
//Output writer
|
||||
Output = color.Output
|
||||
// Red color
|
||||
Red = colorBase(color.FgHiRed)
|
||||
// Blue color
|
||||
Blue = colorBase(color.FgHiBlue)
|
||||
// Green color
|
||||
Green = colorBase(color.FgHiGreen)
|
||||
// Yellow color
|
||||
Yellow = colorBase(color.FgHiYellow)
|
||||
// Magenta color
|
||||
Magenta = colorBase(color.FgHiMagenta)
|
||||
)
|
||||
|
||||
|
@ -2,11 +2,11 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"github.com/tockins/realize/realize"
|
||||
"log"
|
||||
"strings"
|
||||
"testing"
|
||||
"errors"
|
||||
)
|
||||
|
||||
var mockResponse interface{}
|
||||
|
Loading…
Reference in New Issue
Block a user