diff --git a/Makefile b/Makefile index a04274d..64570ab 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ .DEFAULT_GOAL := help +SOURCES := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print) + .PHONY: setup setup: ## Setup for required tools. go get -u golang.org/x/lint/golint @@ -9,8 +11,8 @@ setup: ## Setup for required tools. dep ensure .PHONY: fmt -fmt: ## Formatting source codes. - @goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*") +fmt: $(SOURCES) ## Formatting source codes. + @goimports -w $^ .PHONY: lint lint: ## Run golint and go vet. diff --git a/_example/exec-command/main.go b/_example/exec-command/main.go index 963b81d..838f756 100644 --- a/_example/exec-command/main.go +++ b/_example/exec-command/main.go @@ -4,7 +4,7 @@ import ( "os" "os/exec" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" ) func executor(t string) { diff --git a/_example/http-prompt/main.go b/_example/http-prompt/main.go index 75d4377..7c16e2d 100644 --- a/_example/http-prompt/main.go +++ b/_example/http-prompt/main.go @@ -10,7 +10,7 @@ import ( "path" "strings" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" ) type RequestContext struct { diff --git a/_example/live-prefix/main.go b/_example/live-prefix/main.go index ed46295..9c7ced7 100644 --- a/_example/live-prefix/main.go +++ b/_example/live-prefix/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" ) var LivePrefixState struct { diff --git a/_example/simple-echo/cjk-cyrillic/main.go b/_example/simple-echo/cjk-cyrillic/main.go index f734e98..3e9e53a 100644 --- a/_example/simple-echo/cjk-cyrillic/main.go +++ b/_example/simple-echo/cjk-cyrillic/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" ) func executor(in string) { diff --git a/_example/simple-echo/main.go b/_example/simple-echo/main.go index 01341b1..12b1bb4 100644 --- a/_example/simple-echo/main.go +++ b/_example/simple-echo/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" ) func completer(in prompt.Document) []prompt.Suggest { diff --git a/_tools/complete_file/main.go b/_tools/complete_file/main.go index 2c89df1..41015cf 100644 --- a/_tools/complete_file/main.go +++ b/_tools/complete_file/main.go @@ -5,7 +5,7 @@ import ( "os" "strings" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" "github.com/c-bata/go-prompt/completer" ) diff --git a/_tools/vt100_debug/main.go b/_tools/vt100_debug/main.go index 8a0dd35..c6cd955 100644 --- a/_tools/vt100_debug/main.go +++ b/_tools/vt100_debug/main.go @@ -4,7 +4,7 @@ import ( "fmt" "syscall" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" "github.com/pkg/term/termios" ) diff --git a/completer/file.go b/completer/file.go index 4755b1d..46c60a7 100644 --- a/completer/file.go +++ b/completer/file.go @@ -8,7 +8,7 @@ import ( "path/filepath" "runtime" - "github.com/c-bata/go-prompt" + prompt "github.com/c-bata/go-prompt" ) var ( diff --git a/completion.go b/completion.go index 6687987..b4cc293 100644 --- a/completion.go +++ b/completion.go @@ -4,7 +4,7 @@ import ( "log" "strings" - "github.com/mattn/go-runewidth" + runewidth "github.com/mattn/go-runewidth" ) const ( diff --git a/document.go b/document.go index 06b436a..5d2cb8e 100644 --- a/document.go +++ b/document.go @@ -5,7 +5,7 @@ import ( "strings" "unicode/utf8" - "github.com/mattn/go-runewidth" + runewidth "github.com/mattn/go-runewidth" ) // Document has text displayed in terminal and cursor position. diff --git a/input_windows.go b/input_windows.go index f52b538..11be65c 100644 --- a/input_windows.go +++ b/input_windows.go @@ -9,7 +9,7 @@ import ( "unicode/utf8" "unsafe" - "github.com/mattn/go-tty" + tty "github.com/mattn/go-tty" ) const maxReadBytes = 1024 diff --git a/output_windows.go b/output_windows.go index e93bd95..50cf306 100644 --- a/output_windows.go +++ b/output_windows.go @@ -5,7 +5,7 @@ package prompt import ( "io" - "github.com/mattn/go-colorable" + colorable "github.com/mattn/go-colorable" ) // WindowsWriter is a ConsoleWriter implementation for Win32 console. diff --git a/render.go b/render.go index 2d774aa..2f0c0cc 100644 --- a/render.go +++ b/render.go @@ -3,7 +3,7 @@ package prompt import ( "runtime" - "github.com/mattn/go-runewidth" + runewidth "github.com/mattn/go-runewidth" ) // Render to render prompt information from state of Buffer.