diff --git a/Makefile b/Makefile index b390203..2398262 100644 --- a/Makefile +++ b/Makefile @@ -9,11 +9,14 @@ GOTEST = $(GOCMD) test all: test +.PHONY: test test: $(GOTEST) -v -covermode=count -coverprofile=coverage.out ./... +.PHONY: build build: test $(GOBUILD) +.PHONY: install install: test $(GOINSTALL) diff --git a/current_test.go b/current_test.go index 0789201..8dc8d64 100644 --- a/current_test.go +++ b/current_test.go @@ -52,8 +52,7 @@ func TestNewCurrent(t *testing.T) { t.Error(err) } - _, err = NewCurrent(d, "blah", os.Getenv("OWM_API_KEY")) - if err != nil { + if _, err := NewCurrent(d, "blah", os.Getenv("OWM_API_KEY")); err != nil { t.Log("received expected bad language code error") } @@ -69,7 +68,6 @@ func TestNewCurrent(t *testing.T) { // TestNewCurrentWithCustomHttpClient will verify that a new instance of CurrentWeatherData // is created with custom http client func TestNewCurrentWithCustomHttpClient(t *testing.T) { - hc := http.DefaultClient hc.Timeout = time.Duration(1) * time.Second c, err := NewCurrent("c", "en", os.Getenv("OWM_API_KEY"), WithHttpClient(hc)) @@ -90,7 +88,6 @@ func TestNewCurrentWithCustomHttpClient(t *testing.T) { // TestNewCurrentWithInvalidOptions will verify that returns an error with // invalid option func TestNewCurrentWithInvalidOptions(t *testing.T) { - optionsPattern := [][]Option{ {nil}, {nil, nil}, diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d80d383 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/briandowns/openweathermap + +go 1.13