tools fixed
This commit is contained in:
parent
f980722912
commit
0c9d42e996
|
@ -44,8 +44,8 @@ func (h *Blueprint) Run() error {
|
||||||
tools.Vet = tool{
|
tools.Vet = tool{
|
||||||
status: &h.Projects[k].Cmds.Vet,
|
status: &h.Projects[k].Cmds.Vet,
|
||||||
cmd: "go",
|
cmd: "go",
|
||||||
options: []string{"test"},
|
options: []string{"vet"},
|
||||||
name: "Go Test",
|
name: "Go Vet",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.Projects[k].tools = tools
|
h.Projects[k].tools = tools
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/tockins/realize/style"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -12,6 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
"github.com/tockins/realize/style"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GoRun is an implementation of the bin execution
|
// GoRun is an implementation of the bin execution
|
||||||
|
|
|
@ -3,19 +3,19 @@ package watcher
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fsnotify/fsnotify"
|
|
||||||
"github.com/tockins/realize/style"
|
|
||||||
"log"
|
"log"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
"reflect"
|
||||||
|
"github.com/fsnotify/fsnotify"
|
||||||
|
"github.com/tockins/realize/style"
|
||||||
)
|
)
|
||||||
|
|
||||||
var msg string
|
var msg string
|
||||||
|
@ -79,7 +79,7 @@ func (p *Project) watchByPolling() {
|
||||||
|
|
||||||
p.cmd("change")
|
p.cmd("change")
|
||||||
p.tool(file, p.tools.Fmt)
|
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.Test)
|
||||||
p.tool(path, p.tools.Generate)
|
p.tool(path, p.tools.Generate)
|
||||||
go p.routines(channel, &wr)
|
go p.routines(channel, &wr)
|
||||||
|
@ -285,9 +285,8 @@ func (p *Project) build() error {
|
||||||
func (p *Project) tool(path string, tool tool) error {
|
func (p *Project) tool(path string, tool tool) error {
|
||||||
if tool.status != nil {
|
if tool.status != nil {
|
||||||
v := reflect.ValueOf(tool.status).Elem()
|
v := reflect.ValueOf(tool.status).Elem()
|
||||||
if v.Interface().(bool) && strings.HasSuffix(path, ".go") {
|
if v.Interface().(bool) && (strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "")) {
|
||||||
options := append(tool.options, path)
|
if stream, err := p.goTools(path, tool.cmd, tool.options...); err != nil {
|
||||||
if stream, err := p.goTools(p.base, tool.cmd, 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))
|
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}
|
out = BufferOut{Time: time.Now(), Text: "there are some errors in", Path: path, Type: tool.name, Stream: stream}
|
||||||
p.print("error", out, msg, stream)
|
p.print("error", out, msg, stream)
|
||||||
|
|
Loading…
Reference in New Issue