From 63e3a6f38aca443ea14c57bf6cde497a6ebd4062 Mon Sep 17 00:00:00 2001 From: Masashi SHIBATA Date: Thu, 25 Oct 2018 22:59:47 +0900 Subject: [PATCH] Integrate with Travis CI (#103) * Add .travis.yml --- .gitignore | 1 + .travis.yml | 32 ++++++++++++++++++++++++++++++++ Makefile | 23 ++++++++++++++--------- README.md | 1 + output_posix.go | 3 +++ 5 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index a90cd91..eba2b56 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.o *.a *.so +bin/ # Folders pkg/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a3ddab6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,32 @@ +sudo: false +language: go + +go: + - "1.11.x" + - tip + +os: + - linux + - osx + - windows + +install: + - make setup + +jobs: + include: + - stage: Lint + script: + - diff <(goimports -d $(find . -type f -name '*.go' -not -path "./vendor/*")) <(echo -n "") + - make lint + go: "1.11.x" + os: osx + +script: + - make test + - make build + +matrix: + allow_failures: + - go: tip + - os: windows diff --git a/Makefile b/Makefile index 3cb6edf..c275a87 100644 --- a/Makefile +++ b/Makefile @@ -2,33 +2,38 @@ .PHONY: setup setup: ## Setup for required tools. - go get github.com/golang/lint/golint - go get golang.org/x/tools/cmd/goimports - go get golang.org/x/tools/cmd/stringer + go get -u golang.org/x/lint/golint + go get -u golang.org/x/tools/cmd/goimports + go get -u golang.org/x/tools/cmd/stringer go get -u github.com/golang/dep/cmd/dep dep ensure .PHONY: fmt fmt: ## Formatting source codes. - @goimports -w . + @goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*") .PHONY: lint lint: ## Run golint and go vet. @golint . + @golint -set_exit_status=1 @go vet . .PHONY: test -test: ## Run the tests. - @go test . +test: ## Run the tests with race condition checking. + @go test -race . .PHONY: coverage cover: ## Run the tests. @go test -coverprofile=coverage.o @go tool cover -func=coverage.o -.PHONY: race-test -race-test: ## Checking the race condition. - @go test -race . +.PHONY: build +build: ## Build example command lines. + go build -o bin/exec-command ./_example/exec-command/main.go + go build -o bin/http-prompt ./_example/http-prompt/main.go + go build -o bin/live-prefix ./_example/live-prefix/main.go + go build -o bin/simple-echo ./_example/simple-echo/main.go + go build -o bin/simple-echo-cjk-cyrillic ./_example/simple-echo/cjk-cyrillic/main.go .PHONY: help help: ## Show help text diff --git a/README.md b/README.md index ccfdaec..bcdb9bf 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square) [![Backers on Open Collective](https://opencollective.com/go-prompt/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/go-prompt/sponsors/badge.svg)](#sponsors) [![GoDoc](https://godoc.org/github.com/c-bata/go-prompt?status.svg)](https://godoc.org/github.com/c-bata/go-prompt) +[![Build Status](https://travis-ci.org/c-bata/go-prompt.svg?branch=master)](https://travis-ci.org/c-bata/go-prompt) A library for building powerful interactive prompts inspired by [python-prompt-toolkit](https://github.com/jonathanslenders/python-prompt-toolkit), making it easier to build cross-platform command line tools using Go. diff --git a/output_posix.go b/output_posix.go index e8ec2c1..3c92b48 100644 --- a/output_posix.go +++ b/output_posix.go @@ -43,6 +43,9 @@ func (w *PosixWriter) Flush() error { var _ ConsoleWriter = &PosixWriter{} var ( + // NewStandardOutputWriter returns ConsoleWriter object to write to stdout. + // This generates VT100 escape sequences because almost terminal emulators + // in POSIX OS built on top of a VT100 specification. // Deprecated: Please use NewStdoutWriter NewStandardOutputWriter = NewStdoutWriter )