From 67e3f755d9ab5902f3a7a650e55c59edaf89d1ed Mon Sep 17 00:00:00 2001 From: Italo Vietro Date: Thu, 12 Jul 2018 15:31:08 +0200 Subject: [PATCH] using apex instead of logrus --- .travis.yml | 10 ++++++++++ Gopkg.lock | 46 ++++++++++++++++++++++++++-------------------- Gopkg.toml | 20 ++++++-------------- Makefile | 6 +++--- cmd/root.go | 8 ++++---- 5 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..695ff64 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: go +go: 1.10 +install: make setup +script: make test +after_success: + # - go get github.com/mattn/goveralls + # - goveralls -coverprofile=coverage.out -service=travis-ci -repotoken="$COVERALLS_TOKEN" + - test -n "$TRAVIS_TAG" && curl -sL http://git.io/goreleaser | bash +notifications: + email: false diff --git a/Gopkg.lock b/Gopkg.lock index 0976a9d..a21ae1f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -11,6 +11,21 @@ ] revision = "fa1af6a1f4f56e0e50d427fe901cd604d8c6fb8a" +[[projects]] + name = "github.com/apex/log" + packages = [ + ".", + "handlers/cli" + ] + revision = "0296d6eb16bb28f8a0c55668affcf4876dc269be" + version = "v1.0.0" + +[[projects]] + name = "github.com/davecgh/go-spew" + packages = ["spew"] + revision = "346938d642f2ec3594ed81d874461961cd0faa76" + version = "v1.1.0" + [[projects]] name = "github.com/gojektech/heimdall" packages = ["."] @@ -36,10 +51,10 @@ version = "v0.8.0" [[projects]] - name = "github.com/sirupsen/logrus" - packages = ["."] - revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc" - version = "v1.0.5" + name = "github.com/pmezard/go-difflib" + packages = ["difflib"] + revision = "792786c7400a136282c1664665ae0a8db921c6c2" + version = "v1.0.0" [[projects]] name = "github.com/spf13/cobra" @@ -53,30 +68,21 @@ revision = "583c0c0531f06d5278b7d917446061adc344b5cd" version = "v1.0.1" +[[projects]] + name = "github.com/stretchr/testify" + packages = ["assert"] + revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686" + version = "v1.2.2" + [[projects]] name = "github.com/tcnksm/go-httpstat" packages = ["."] revision = "ae0d799e7ee65d3dc46d7272368daa830aef6c5a" version = "v0.2.0" -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["ssh/terminal"] - revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = [ - "unix", - "windows" - ] - revision = "1b2967e3c290b7c545b3db0deeda16e9be4f98a2" - [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "01524409a91c245bf9c27279ef83c85059f21664c5fb082b6b3285a17d76ad51" + inputs-digest = "6a3b9b45fca197c56bd16db3a1ef0379438c084b865a9910b73c4589e0289669" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index c3ae9ad..0de5e88 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -29,14 +29,6 @@ name = "github.com/gojektech/heimdall" version = "3.0.1" -[[constraint]] - branch = "master" - name = "github.com/hashicorp/errwrap" - -[[constraint]] - branch = "master" - name = "github.com/mitchellh/go-homedir" - [[constraint]] name = "github.com/sirupsen/logrus" version = "1.0.5" @@ -46,17 +38,17 @@ version = "0.0.3" [[constraint]] - name = "github.com/spf13/viper" - version = "1.0.2" + name = "github.com/tcnksm/go-httpstat" + version = "0.2.0" [prune] go-tests = true unused-packages = true [[constraint]] - branch = "master" - name = "golang.org/x/sync" + name = "github.com/stretchr/testify" + version = "1.2.2" [[constraint]] - name = "github.com/tcnksm/go-httpstat" - version = "0.2.0" + name = "github.com/apex/log" + version = "1.0.0" diff --git a/Makefile b/Makefile index cec952a..8f6fd1f 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,11 @@ WARN_COLOR=\033[33;01m # If you change this, run `make clean`. PKG_SRC := github.com/italolelis/reachable -.PHONY: all clean deps build +.PHONY: all clean setup build -all: clean deps test build +all: clean setup test build -deps: +setup: @echo "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)" @go get -u github.com/golang/dep/cmd/dep @go get -u github.com/golang/lint/golint diff --git a/cmd/root.go b/cmd/root.go index 9aa1949..9c171f9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,8 +4,8 @@ import ( "context" "time" - "github.com/italolelis/reachable/pkg/log" - "github.com/sirupsen/logrus" + "github.com/apex/log" + logCtx "github.com/italolelis/reachable/pkg/log" "github.com/spf13/cobra" ) @@ -20,14 +20,14 @@ type ( // NewRootCmd creates the root command func NewRootCmd() *cobra.Command { opts := RootOptions{} - ctx := log.NewContext(context.Background()) + ctx := logCtx.NewContext(context.Background()) cmd := cobra.Command{ Use: "reachable", Short: "Reachable is a CLI tool to check if a domain is up", PersistentPreRun: func(ccmd *cobra.Command, args []string) { if opts.verbose { - log.WithContext(context.Background()).SetLevel(logrus.DebugLevel) + log.SetLevel(log.DebugLevel) } }, }