From 58118c46b6f21d6a028c54bc416cd2d5a112b8d8 Mon Sep 17 00:00:00 2001 From: Jonathan Thurman Date: Tue, 2 Jul 2019 09:19:02 -0700 Subject: [PATCH 1/6] Add travis-ci integration for build status --- .travis.yml | 4 ++++ README.md | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e182ec3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: go + +go: +- 1.x diff --git a/README.md b/README.md index a9b112a..9718d18 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # New Relic Insights Client A Go library for interacting with insights. +[![Build Status](https://travis-ci.org/newrelic/go-insights.svg?branch=master)](https://travis-ci.org/newrelic/go-insights) + + ## Disclaimer New Relic has open-sourced this integration to enable monitoring of this technology. This integration is provided AS-IS WITHOUT WARRANTY OR SUPPORT, although you can report issues and contribute to this integration via GitHub. Support for this integration is available with an [Expert Services subscription](newrelic.com/expertservices). From b589e52a6861559339703f653d039790563b5d36 Mon Sep 17 00:00:00 2001 From: Jonathan Thurman Date: Tue, 2 Jul 2019 09:28:13 -0700 Subject: [PATCH 2/6] Remove bootstrap issue of installing govendor with govendor --- Makefile | 115 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index 6fe3ba0..3d612e9 100644 --- a/Makefile +++ b/Makefile @@ -1,44 +1,66 @@ PROJECT_NAME := $(shell basename $(shell pwd)) +PROJECT_VER := $(shell git describe --tags --always --dirty) GO_PKGS := $(shell go list ./... | grep -v -e "/vendor/" -e "/example") -GO_FILES := $(shell find ./ -type f -name "*.go") NATIVEOS := $(shell go version | awk -F '[ /]' '{print $$4}') NATIVEARCH := $(shell go version | awk -F '[ /]' '{print $$5}') SRCDIR ?= . BUILD_DIR := ./bin/ COVERAGE_DIR := ./coverage/ -GOTOOLS = github.com/kardianos/govendor \ - gopkg.in/alecthomas/gometalinter.v2 \ - github.com/axw/gocov/gocov \ +COVERMODE = atomic +GOTOOLS = github.com/axw/gocov/gocov \ github.com/AlekSi/gocov-xml \ github.com/stretchr/testify/assert \ github.com/robertkrimen/godocdown/godocdown \ - - -GO = govendor -GODOC = godocdown -GOMETALINTER = gometalinter.v2 -GOVENDOR = govendor + github.com/golangci/golangci-lint/cmd/golangci-lint + +GO_CMD = go +GODOC = godocdown +DOC_DIR = ./docs/ +GOLINTER = golangci-lint + +# Determine package dep manager +ifneq ("$(wildcard Gopkg.toml)","") + VENDOR = dep + VENDOR_CMD = ${VENDOR} ensure + GOTOOLS += github.com/golang/dep + GO = ${GO_CMD} +else ifneq ("$(wildcard Godeps/*)","") + VENDOR = godep + VENDOR_CMD = echo "Not Implemented" + GOTOOLS += github.com/tools/godep + GO = godep go +else + VENDOR = govendor + VENDOR_CMD = ${VENDOR} sync + GOTOOLS += github.com/kardianos/govendor + GO = ${VENDOR} +endif # Determine packages by looking into pkg/* -PACKAGES=client +ifneq ("$(wildcard ${SRCDIR}/pkg/*)","") + PACKAGES = $(wildcard ${SRCDIR}/pkg/*) +endif +ifneq ("$(wildcard ${SRCDIR}/internal/*)","") + PACKAGES += $(wildcard ${SRCDIR}/internal/*) +endif # Determine commands by looking into cmd/* -COMMANDS=$(wildcard ${SRCDIR}/cmd/*) +COMMANDS = $(wildcard ${SRCDIR}/cmd/*) + +GO_FILES := $(shell find $(COMMANDS) $(PACKAGES) -type f -name "*.go") # Determine binary names by stripping out the dir names BINS=$(foreach cmd,${COMMANDS},$(notdir ${cmd})) -#ifeq (${COMMANDS},) -# $(error Could not determine COMMANDS, set SRCDIR or run in source dir) -#endif -#ifeq (${BINS},) -# $(error Could not determine BINS, set SRCDIR or run in source dir) -#endif - +LDFLAGS='-X main.Version=$(PROJECT_VER)' all: build -build: check-version clean validate test coverage compile document +# Humans running make: +build: check-version clean validate test-unit cover-report compile document + +# Build command for CI tooling +build-ci: check-version clean validate test compile-only clean: @echo "=== $(PROJECT_NAME) === [ clean ]: removing binaries and coverage file..." @@ -46,63 +68,66 @@ clean: tools: check-version @echo "=== $(PROJECT_NAME) === [ tools ]: Installing tools required by the project..." - go get -u $(GOTOOLS) - @$(GOMETALINTER) --install + @$(GO_CMD) get $(GOTOOLS) tools-update: check-version @echo "=== $(PROJECT_NAME) === [ tools-update ]: Updating tools required by the project..." - @$(GO) get -u $(GOTOOLS) - @$(GOMETALINTER) --install + @$(GO_CMD) get -u $(GOTOOLS) deps: tools deps-only deps-only: @echo "=== $(PROJECT_NAME) === [ deps ]: Installing package dependencies required by the project..." - @$(GOVENDOR) sync + @echo "=== $(PROJECT_NAME) === [ deps ]: Detected '$(VENDOR)'" + @$(VENDOR_CMD) validate: deps - @echo "=== $(PROJECT_NAME) === [ validate ]: Validating source code running gometalinter..." - @$(GOMETALINTER) --config=.gometalinter.json ./... + @echo "=== $(PROJECT_NAME) === [ validate ]: Validating source code running $(GOLINTER)..." + @$(GOLINTER) run ./... compile-only: deps-only @echo "=== $(PROJECT_NAME) === [ compile ]: building commands:" @for b in $(BINS); do \ echo "=== $(PROJECT_NAME) === [ compile ]: $$b"; \ BUILD_FILES=`find $(SRCDIR)/cmd/$$b -type f -name "*.go"` ; \ - $(GO) build -o $(BUILD_DIR)/$$b $$BUILD_FILES ; \ + $(GO) build -ldflags=$(LDFLAGS) -o $(BUILD_DIR)/$$b $$BUILD_FILES ; \ done compile: deps compile-only -coverage: - @echo "=== $(PROJECT_NAME) === [ coverage ]: generating coverage results..." - @rm -rf $(COVERAGE_DIR)/* - @for d in $(GO_PKGS); do \ - pkg=`basename $$d` ;\ - $(GO) test -tags 'unit integration' -coverprofile $(COVERAGE_DIR)/$$pkg.tmp $$d ;\ - done - @echo 'mode: set' > $(COVERAGE_DIR)/coverage.out -# || true to ignore grep return code if no matches (i.e. no tests written...) - @cat $(COVERAGE_DIR)/*.tmp | grep -v 'mode: set' >> $(COVERAGE_DIR)/coverage.out || true - @$(GO) tool cover -html=$(COVERAGE_DIR)/coverage.out -o $(COVERAGE_DIR)/coverage.html +test: test-deps test-only +test-only: test-unit test-integration test-unit: @echo "=== $(PROJECT_NAME) === [ unit-test ]: running unit tests..." - @$(GO) test -tags unit $(GO_PKGS) + @mkdir -p $(COVERAGE_DIR) + @$(GO) test -tags unit -covermode=$(COVERMODE) -coverprofile $(COVERAGE_DIR)/unit.tmp $(GO_PKGS) test-integration: @echo "=== $(PROJECT_NAME) === [ integration-test ]: running integrtation tests..." - @$(GO) test -tags integration $(GO_PKGS) + @mkdir -p $(COVERAGE_DIR) + @$(GO) test -tags integration -covermode=$(COVERMODE) -coverprofile $(COVERAGE_DIR)/integration.tmp $(GO_PKGS) + +cover-report: + @echo "=== $(PROJECT_NAME) === [ cover-report ]: generating coverage results..." + @mkdir -p $(COVERAGE_DIR) + @echo 'mode: $(COVERMODE)' > $(COVERAGE_DIR)/coverage.out + @cat $(COVERAGE_DIR)/*.tmp | grep -v 'mode: $(COVERMODE)' >> $(COVERAGE_DIR)/coverage.out || true + @$(GO) tool cover -html=$(COVERAGE_DIR)/coverage.out -o $(COVERAGE_DIR)/coverage.html + @echo "=== $(PROJECT_NAME) === [ cover-report ]: $(COVERAGE_DIR)coverage.html" document: @echo "=== $(PROJECT_NAME) === [ documentation ]: Generating Godoc in Markdown..." @for p in $(PACKAGES); do \ echo "=== $(PROJECT_NAME) === [ documentation ]: $$p"; \ - $(GODOC) $$p > $$p/README.md ; \ + mkdir -p $(DOC_DIR)/$$p ; \ + $(GODOC) $$p > $(DOC_DIR)/$$p/README.md ; \ + done + @for c in $(COMMANDS); do \ + echo "=== $(PROJECT_NAME) === [ documentation ]: $$c"; \ + mkdir -p $(DOC_DIR)/$$c ; \ + $(GODOC) $$c > $(DOC_DIR)/$$c/README.md ; \ done - -test-only: test-unit test-integration -test: test-deps test-only check-version: ifdef GOOS From 3456e0527001e418b6fb7e7d8c091d3c4eac0aaa Mon Sep 17 00:00:00 2001 From: Jonathan Thurman Date: Tue, 2 Jul 2019 09:41:24 -0700 Subject: [PATCH 3/6] Change linter to golangci-lint --- .golangci.yml | 49 ++++++++++++++++++++++++++++++++++++++++++++++ .gometalinter.json | 5 ----- 2 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 .golangci.yml delete mode 100644 .gometalinter.json diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..ab23752 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,49 @@ +# This file contains all available configuration options +# with their default values. + +# options for analysis running +run: + # timeout for analysis, e.g. 30s, 5m, default is 1m + deadline: 5m + + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + + # include test files or not, default is true + tests: true + + +# all available settings of specific linters +linters-settings: + govet: + # report about shadowed variables + check-shadowing: true + golint: + # minimal confidence for issues, default is 0.8 + min-confidence: 0.5 + gocyclo: + # minimal code complexity to report, 30 by default (but we recommend 10-20) + min-complexity: 20 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true + depguard: + list-type: blacklist + include-go-root: false + packages: + - github.com/davecgh/go-spew/spew + misspell: + ignore-words: + - newrelic + lll: + # max line length, lines longer will be reported. Default is 120. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option + line-length: 150 + +linters: + enable-all: true + disable: + - dupl + - gochecknoglobals + - interfacer + diff --git a/.gometalinter.json b/.gometalinter.json deleted file mode 100644 index 62a475f..0000000 --- a/.gometalinter.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Enable": ["deadcode", "errcheck", "gofmt", "golint", "goimports"], - "Vendor": true, - "Exclude": ["../../vendor"] -} From c41bee94d4fa4b6e350adb6108bffdcc5f6c0c81 Mon Sep 17 00:00:00 2001 From: Jonathan Thurman Date: Tue, 2 Jul 2019 10:13:30 -0700 Subject: [PATCH 4/6] Update for new lint rules --- .gitignore | 2 +- client/client_test.go | 5 ---- client/insert.go | 56 ++++++++++++++++++-------------------- client/insert_unit_test.go | 15 ++++++---- client/query.go | 14 +++++----- cmd/go-insights/main.go | 2 -- 6 files changed, 44 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index a056ea5..dfcebe8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Application Specific -go-insights +bin/* vendor/* # Compiled Object files, Static and Dynamic libs (Shared Objects) diff --git a/client/client_test.go b/client/client_test.go index f57d5ce..1bbab50 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -9,11 +9,6 @@ import ( "github.com/stretchr/testify/assert" ) -const ( - testKey = "testKey" - testID = "12345" -) - func TestUseCustomURL(t *testing.T) { c := &Client{ Logger: log.New(), diff --git a/client/insert.go b/client/insert.go index dbf410d..495918d 100644 --- a/client/insert.go +++ b/client/insert.go @@ -48,7 +48,7 @@ func createInsertURL(accountID string) *url.URL { // Start runs the insert client in batch mode. func (c *InsertClient) Start() error { if c.eventQueue != nil { - return errors.New("Insights client already in daemon mode") + return errors.New("the Insights client is already in daemon mode") } c.eventQueue = make(chan []byte, c.BatchSize) @@ -60,18 +60,18 @@ func (c *InsertClient) Start() error { go func() { err := c.watchdog() if err != nil { - log.Errorf("Watchdog returned error: %v", err) + log.Errorf("watchdog returned error: %v", err) } }() go func() { err := c.batchWorker() if err != nil { - log.Errorf("Batch Worker returned error: %v", err) + log.Errorf("batch worker returned error: %v", err) } }() - c.Logger.Infof("Insights client launched in daemon mode with endpoint %s", c.URL) + c.Logger.Infof("the Insights client has launched in daemon mode with endpoint %s", c.URL) return nil } @@ -87,17 +87,17 @@ func (c *InsertClient) StartListener(inputChannel chan interface{}) (err error) } } if inputChannel == nil { - return errors.New("Channel to listen is nil") + return errors.New("channel to listen is nil") } go func() { err := c.queueWorker(inputChannel) if err != nil { - log.Errorf("Queue Worker returned error: %v", err) + log.Errorf("queue worker returned error: %v", err) } }() - c.Logger.Info("Insights client started channel listener") + c.Logger.Info("the Insights client started channel listener") return nil } @@ -105,11 +105,11 @@ func (c *InsertClient) StartListener(inputChannel chan interface{}) (err error) // Validate makes sure the InsertClient is configured correctly for use func (c *InsertClient) Validate() error { if correct, _ := regexp.MatchString("collector.newrelic.com/v1/accounts/[0-9]+/events", c.URL.String()); !correct { - return fmt.Errorf("Invalid insert endpoint %s", c.URL) + return fmt.Errorf("invalid insert endpoint %s", c.URL) } if len(c.InsertKey) < 1 { - return fmt.Errorf("Not a valid license key: %s", c.InsertKey) + return fmt.Errorf("not a valid license key: %s", c.InsertKey) } return nil } @@ -117,7 +117,7 @@ func (c *InsertClient) Validate() error { // EnqueueEvent handles the queueing. Only works in batch mode. func (c *InsertClient) EnqueueEvent(data interface{}) (err error) { if c.eventQueue == nil { - return errors.New("Queueing not enabled for this client") + return errors.New("queueing not enabled for this client") } var jsonData []byte @@ -136,22 +136,22 @@ func (c *InsertClient) EnqueueEvent(data interface{}) (err error) { func (c *InsertClient) PostEvent(data interface{}) error { var jsonData []byte - switch data.(type) { + switch data := data.(type) { case []byte: - jsonData = data.([]byte) + jsonData = data case string: - jsonData = []byte(data.(string)) + jsonData = []byte(data) default: var jsonErr error jsonData, jsonErr = json.Marshal(data) if jsonErr != nil { - return fmt.Errorf("Error marshaling event data: %s", jsonErr.Error()) + return fmt.Errorf("error marshaling event data: %s", jsonErr.Error()) } } // Needs to handle array of events. maybe pull into separate validation func if !strings.Contains(string(jsonData), "eventType") { - return fmt.Errorf("Event data must contain eventType field. %s", jsonData) + return fmt.Errorf("event data must contain eventType field. %s", jsonData) } c.Logger.Debugf("Posting to insights: %s", jsonData) @@ -167,7 +167,7 @@ func (c *InsertClient) PostEvent(data interface{}) error { // This is also used by watchdog when the timer expires. func (c *InsertClient) Flush() error { if c.flushQueue == nil { - return errors.New("Queueing not enabled for this client") + return errors.New("queueing not enabled for this client") } c.Logger.Debug("Flushing insights client") atomic.AddInt64(&c.Statistics.FlushCount, 1) @@ -182,7 +182,7 @@ func (c *InsertClient) Flush() error { // we don't block on EnqueueEvent // func (c *InsertClient) queueWorker(inputChannel chan interface{}) (err error) { - for { + for { //nolint:gosimple select { case msg := <-inputChannel: err = c.EnqueueEvent(msg) @@ -199,10 +199,10 @@ func (c *InsertClient) queueWorker(inputChannel chan interface{}) (err error) { // func (c *InsertClient) watchdog() (err error) { if c.eventTimer == nil { - return errors.New("Invalid timer for watchdog()") + return errors.New("invalid timer for watchdog()") } - for { + for { //nolint:gosimple select { case <-c.eventTimer.C: // Timer expired, and we have data, send it @@ -222,7 +222,7 @@ func (c *InsertClient) watchdog() (err error) { // in its own goroutine. // func (c *InsertClient) batchWorker() (err error) { - eventBuf := make([][]byte, c.BatchSize, c.BatchSize) + eventBuf := make([][]byte, c.BatchSize) count := 0 for { select { @@ -230,12 +230,12 @@ func (c *InsertClient) batchWorker() (err error) { eventBuf[count] = item count++ if count >= c.BatchSize { - err = c.grabAndConsumeEvents(count, eventBuf) + c.grabAndConsumeEvents(count, eventBuf) count = 0 } case <-c.flushQueue: if count > 0 { - err = c.grabAndConsumeEvents(count, eventBuf) + c.grabAndConsumeEvents(count, eventBuf) count = 0 } } @@ -250,14 +250,14 @@ func (c *InsertClient) batchWorker() (err error) { // Even the last error (in the event of trying c.RetryCount times) // is dropped. // -func (c *InsertClient) grabAndConsumeEvents(count int, eventBuf [][]byte) (err error) { +func (c *InsertClient) grabAndConsumeEvents(count int, eventBuf [][]byte) { if count < c.BatchSize-20 { atomic.AddInt64(&c.Statistics.PartialFlushCount, 1) // Allow for some fuzz, although there should be none } else { atomic.AddInt64(&c.Statistics.FullFlushCount, 1) } - saved := make([][]byte, count, count) + saved := make([][]byte, count) for i := 0; i < count; i++ { saved[i] = eventBuf[i] eventBuf[i] = nil @@ -275,8 +275,6 @@ func (c *InsertClient) grabAndConsumeEvents(count int, eventBuf [][]byte) (err e } } }(count, saved) - - return nil } // sendEvents accepts a slice of marshalled JSON and sends it to Insights @@ -379,18 +377,18 @@ func (c *InsertClient) generateJSONPostRequest(body []byte) (request *http.Reque func (c *InsertClient) parseResponse(response *http.Response) error { body, readErr := ioutil.ReadAll(response.Body) if readErr != nil { - return fmt.Errorf("Failed to read response body: %s", readErr.Error()) + return fmt.Errorf("failed to read response body: %s", readErr.Error()) } if response.StatusCode != 200 { - return fmt.Errorf("Bad response from Insights: %d \n\t%s", response.StatusCode, string(body)) + return fmt.Errorf("bad response from Insights: %d \n\t%s", response.StatusCode, string(body)) } c.Logger.Debugf("Response %d body: %s", response.StatusCode, body) respJSON := insertResponse{} if err := json.Unmarshal(body, &respJSON); err != nil { - return fmt.Errorf("Failed to unmarshal insights response: %v", err) + return fmt.Errorf("failed to unmarshal insights response: %v", err) } // Success diff --git a/client/insert_unit_test.go b/client/insert_unit_test.go index 2659e4a..76f6219 100644 --- a/client/insert_unit_test.go +++ b/client/insert_unit_test.go @@ -12,6 +12,11 @@ import ( "github.com/stretchr/testify/assert" ) +const ( + testKey = "testKey" + testID = "12345" +) + /************************************************ * General insert methods ************************************************/ @@ -159,8 +164,7 @@ func TestInsertGrabAndConsumeEvents_partial(t *testing.T) { assert.NoError(t, err) assert.Equal(t, ts.URL, client.URL.String()) - err = client.grabAndConsumeEvents(len(testData)-1, testData) - assert.NoError(t, err) + client.grabAndConsumeEvents(len(testData)-1, testData) } func TestInsertGrabAndConsumeEvents_fullBatch(t *testing.T) { @@ -178,8 +182,7 @@ func TestInsertGrabAndConsumeEvents_fullBatch(t *testing.T) { assert.Equal(t, ts.URL, client.URL.String()) client.BatchSize = len(testData) - 1 - err = client.grabAndConsumeEvents(len(testData)-1, testData) - assert.NoError(t, err) + client.grabAndConsumeEvents(len(testData)-1, testData) } func TestInsertPostEvent(t *testing.T) { @@ -325,12 +328,12 @@ func TestEnqueueNonBuffer_bad(t *testing.T) { enqueueErr := c.EnqueueEvent("{eventType: \"test\", blah: 1}") assert.NotNil(t, enqueueErr) - assert.Equal(t, "Queueing not enabled for this client", enqueueErr.Error(), "Unknown error returned") + assert.Equal(t, "queueing not enabled for this client", enqueueErr.Error(), "Unknown error returned") // Again no queue, so you can't flush it flushErr := c.Flush() assert.NotNil(t, flushErr) - assert.Equal(t, "Queueing not enabled for this client", flushErr.Error(), "Unknown error returned") + assert.Equal(t, "queueing not enabled for this client", flushErr.Error(), "Unknown error returned") } func TestNewInsertClientSetCompression(t *testing.T) { diff --git a/client/query.go b/client/query.go index 1ae574e..e559f92 100644 --- a/client/query.go +++ b/client/query.go @@ -36,11 +36,11 @@ func createQueryURL(accountID string) *url.URL { // Validate makes sure the QueryClient is configured correctly for use func (c *QueryClient) Validate() error { if correct, _ := regexp.MatchString("api.newrelic.com/v1/accounts/[0-9]+/query", c.URL.String()); !correct { - return fmt.Errorf("Invalid query endpoint %s", c.URL) + return fmt.Errorf("invalid query endpoint %s", c.URL) } if len(c.QueryKey) < 1 { - return fmt.Errorf("Not a valid license key: %s", c.QueryKey) + return fmt.Errorf("not a valid license key: %s", c.QueryKey) } return nil } @@ -81,7 +81,7 @@ func (c *QueryClient) queryRequest(nrqlQuery string, queryResult interface{}) (e } if queryResult == nil { - return errors.New("Must have pointer for result") + return errors.New("must have pointer for result") } request, err = http.NewRequest("GET", queryURL, nil) @@ -96,7 +96,7 @@ func (c *QueryClient) queryRequest(nrqlQuery string, queryResult interface{}) (e response, err = client.Do(request) if err != nil { - err = fmt.Errorf("Failed query request for: %v", err) + err = fmt.Errorf("failed query request for: %v", err) return } defer func() { @@ -107,13 +107,13 @@ func (c *QueryClient) queryRequest(nrqlQuery string, queryResult interface{}) (e }() if response.StatusCode != http.StatusOK { - err = fmt.Errorf("Bad response code: %d", response.StatusCode) + err = fmt.Errorf("bad response code: %d", response.StatusCode) return } err = c.parseResponse(response, queryResult) if err != nil { - err = fmt.Errorf("Failed query: %v", err) + err = fmt.Errorf("failed query: %v", err) } return err @@ -149,7 +149,7 @@ func (c *QueryClient) parseResponse(response *http.Response, parsedResponse inte c.Logger.Debugf("Response %d body: %s", response.StatusCode, body) if jsonErr := json.Unmarshal(body, parsedResponse); jsonErr != nil { - return fmt.Errorf("Unable to unmarshal query response: %v", jsonErr) + return fmt.Errorf("unable to unmarshal query response: %v", jsonErr) } return nil diff --git a/cmd/go-insights/main.go b/cmd/go-insights/main.go index 340fab6..fe587aa 100644 --- a/cmd/go-insights/main.go +++ b/cmd/go-insights/main.go @@ -85,6 +85,4 @@ func main() { default: log.Fatal("Unknown command") } - - return } From 806d2f4bfea1a13ee1099ffb4981dd114e09d0ec Mon Sep 17 00:00:00 2001 From: Jonathan Thurman Date: Tue, 2 Jul 2019 10:13:44 -0700 Subject: [PATCH 5/6] New makefile auto-generates docs --- docs/cmd/go-insights/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 docs/cmd/go-insights/README.md diff --git a/docs/cmd/go-insights/README.md b/docs/cmd/go-insights/README.md new file mode 100644 index 0000000..2c5c8e5 --- /dev/null +++ b/docs/cmd/go-insights/README.md @@ -0,0 +1,2 @@ +# go-insights +-- From b2ac4ac64429d1f0ab91d6bf333bd76e9ade60d5 Mon Sep 17 00:00:00 2001 From: Jonathan Thurman Date: Tue, 2 Jul 2019 10:58:37 -0700 Subject: [PATCH 6/6] more linting, with updated tools --- client/insert.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/insert.go b/client/insert.go index 495918d..9d8a65c 100644 --- a/client/insert.go +++ b/client/insert.go @@ -308,7 +308,7 @@ func (c *InsertClient) SetCompression(compression Compression) { } func (c *InsertClient) jsonPostRequest(body []byte) (err error) { - const prependText = "Inisghts Post: " + const prependText = "Insights Post: " req, reqErr := c.generateJSONPostRequest(body) if reqErr != nil {