tools fixed

This commit is contained in:
alessio 2017-04-24 02:07:37 +02:00
parent f980722912
commit 0c9d42e996
3 changed files with 9 additions and 10 deletions

View File

@ -44,8 +44,8 @@ func (h *Blueprint) Run() error {
tools.Vet = tool{
status: &h.Projects[k].Cmds.Vet,
cmd: "go",
options: []string{"test"},
name: "Go Test",
options: []string{"vet"},
name: "Go Vet",
}
}
h.Projects[k].tools = tools

View File

@ -4,7 +4,6 @@ import (
"bufio"
"bytes"
"fmt"
"github.com/tockins/realize/style"
"log"
"os"
"os/exec"
@ -12,6 +11,7 @@ import (
"strings"
"sync"
"time"
"github.com/tockins/realize/style"
)
// GoRun is an implementation of the bin execution

View File

@ -3,19 +3,19 @@ package watcher
import (
"errors"
"fmt"
"github.com/fsnotify/fsnotify"
"github.com/tockins/realize/style"
"log"
"math/big"
"os"
"os/signal"
"path/filepath"
"reflect"
"strconv"
"strings"
"sync"
"syscall"
"time"
"reflect"
"github.com/fsnotify/fsnotify"
"github.com/tockins/realize/style"
)
var msg string
@ -79,7 +79,7 @@ func (p *Project) watchByPolling() {
p.cmd("change")
p.tool(file, p.tools.Fmt)
p.tool(path, p.tools.Vet)
p.tool(file, p.tools.Vet)
p.tool(path, p.tools.Test)
p.tool(path, p.tools.Generate)
go p.routines(channel, &wr)
@ -285,9 +285,8 @@ func (p *Project) build() error {
func (p *Project) tool(path string, tool tool) error {
if tool.status != nil {
v := reflect.ValueOf(tool.status).Elem()
if v.Interface().(bool) && strings.HasSuffix(path, ".go") {
options := append(tool.options, path)
if stream, err := p.goTools(p.base, tool.cmd, options...); err != nil {
if v.Interface().(bool) && (strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "")) {
if stream, err := p.goTools(path, tool.cmd, tool.options...); err != nil {
msg = fmt.Sprintln(p.pname(p.Name, 2), ":", style.Red.Bold(tool.name), style.Red.Regular("there are some errors in"), ":", style.Magenta.Bold(path))
out = BufferOut{Time: time.Now(), Text: "there are some errors in", Path: path, Type: tool.name, Stream: stream}
p.print("error", out, msg, stream)