1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-11-06 08:39:09 +02:00

Linter Cleanup (#276)

* linter cleanup

* fix default case
This commit is contained in:
3timeslazy
2019-03-29 17:48:51 +03:00
committed by Tim Voronov
parent 752ee02cd1
commit de703513e4
41 changed files with 408 additions and 147 deletions

View File

@@ -40,12 +40,16 @@ func (b *Browser) DebuggingPort() int {
func (b *Browser) Close() error {
var err error
if runtime.GOOS != "windows" {
if runtime.GOOS != goosWindows {
err = b.cmd.Process.Signal(os.Interrupt)
} else {
err = b.cmd.Process.Kill()
}
if err != nil {
return err
}
_, err = b.cmd.Process.Wait()
if err != nil {

View File

@@ -2,9 +2,10 @@ package browser
import (
"fmt"
"github.com/pkg/errors"
"sort"
"strings"
"github.com/pkg/errors"
)
type Flags map[string]interface{}
@@ -61,8 +62,6 @@ func (flags Flags) Has(arg string) bool {
}
func (flags Flags) List() []string {
var list []string
orderedFlags := make([]string, 0, 10)
for arg := range flags {
@@ -71,7 +70,9 @@ func (flags Flags) List() []string {
sort.Strings(orderedFlags)
for _, arg := range orderedFlags {
list := make([]string, len(orderedFlags))
for i, arg := range orderedFlags {
val, err := flags.Get(arg)
if err != nil {
@@ -87,7 +88,7 @@ func (flags Flags) List() []string {
arg = fmt.Sprintf("--%s", arg)
}
list = append(list, arg)
list[i] = arg
}
return list

View File

@@ -9,7 +9,7 @@ import (
func resolveExecutablePath() (path string) {
switch runtime.GOOS {
case "darwin":
case goosDarwin:
for _, c := range []string{
"/Applications/Google Chrome Canary.app",
"/Applications/Google Chrome.app",
@@ -22,7 +22,7 @@ func resolveExecutablePath() (path string) {
}
}
case "linux":
case goosLinux:
for _, c := range []string{
"headless_shell",
"chromium",
@@ -35,7 +35,7 @@ func resolveExecutablePath() (path string) {
}
}
case "windows":
case goosWindows:
}
return

View File

@@ -41,7 +41,7 @@ func Launch(setters ...Option) (*Browser, error) {
flags.SetN("mute-audio")
}
if runtime.GOOS == "windows" {
if runtime.GOOS == goosWindows {
flags.SetN("disable-gpu")
}

View File

@@ -18,6 +18,12 @@ type (
}
)
const (
goosWindows = "windows"
goosLinux = "linux"
goosDarwin = "darwin"
)
func WithoutDefaultArgs() Option {
return func(opts *Options) {
opts.ignoreDefaultArgs = true

View File

@@ -3,11 +3,12 @@ package cli
import (
"context"
"fmt"
"github.com/MontFerret/ferret/pkg/parser/fql"
"os"
"os/signal"
"strings"
"github.com/MontFerret/ferret/pkg/parser/fql"
"github.com/MontFerret/ferret/pkg/compiler"
"github.com/MontFerret/ferret/pkg/runtime"
"github.com/MontFerret/ferret/pkg/runtime/logging"
@@ -74,7 +75,7 @@ func Repl(version string, opts Options) {
line = strings.TrimSpace(line)
if len(line) == 0 {
if line == "" {
continue
}