From 31926fd4a7e84442627cdaad7a46ee38a93cca12 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 1 Dec 2019 20:47:02 -0800 Subject: [PATCH] Integrate vendored NewRelic dependency (#767) The NewRelic module relies on yfronto/newrelic, which no longer exists. yfronto deleted that directory quite awhile ago, and since then it has been vendored. But vendoring a missing repository creates problems when trying to update the vendored code. This PR brings the yfronto/newrelic code into the mainline. Signed-off-by: Chris Cummer --- go.mod | 3 -- modules/newrelic/client.go | 12 ++++---- .../newrelic/client}/README.md | 0 .../newrelic/client}/alert_conditions.go | 0 .../newrelic/client}/alert_events.go | 0 .../client}/alert_events_test_fixtures.go | 0 .../client}/application_deployments.go | 0 .../client}/application_host_metrics.go | 0 .../newrelic/client}/application_hosts.go | 0 .../client}/application_instance_metrics.go | 0 .../newrelic/client}/application_instances.go | 0 .../newrelic/client}/application_metrics.go | 0 .../application_metrics_test_fixtures.go | 0 .../newrelic/client}/applications.go | 0 .../client}/applications_test_fixtures.go | 0 .../newrelic/client}/array.go | 0 .../newrelic/client}/browser_applications.go | 0 .../newrelic/client}/common_test_fixtures.go | 0 .../newrelic/client}/component_metrics.go | 0 .../newrelic/client}/http_helper.go | 0 .../client}/http_helper_test_fixtures.go | 0 .../newrelic/client}/key_transactions.go | 0 .../newrelic/client}/legacy_alert_policies.go | 0 .../newrelic/client}/main.go | 0 .../newrelic/client}/metrics.go | 0 .../client}/mobile_application_metrics.go | 0 .../newrelic/client}/mobile_applications.go | 0 .../newrelic/client}/notification_channels.go | 0 .../newrelic/client}/server_metrics.go | 0 .../newrelic/client}/servers.go | 0 .../newrelic/client}/usages.go | 0 modules/newrelic/display.go | 2 +- modules/newrelic/widget.go | 4 +-- vendor/github.com/yfronto/newrelic/.gitignore | 0 .../github.com/yfronto/newrelic/.travis.yml | 22 -------------- vendor/github.com/yfronto/newrelic/LICENSE | 30 ------------------- vendor/github.com/yfronto/newrelic/go.mod | 3 -- 37 files changed, 9 insertions(+), 67 deletions(-) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/README.md (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/alert_conditions.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/alert_events.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/alert_events_test_fixtures.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/application_deployments.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/application_host_metrics.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/application_hosts.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/application_instance_metrics.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/application_instances.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/application_metrics.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/application_metrics_test_fixtures.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/applications.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/applications_test_fixtures.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/array.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/browser_applications.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/common_test_fixtures.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/component_metrics.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/http_helper.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/http_helper_test_fixtures.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/key_transactions.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/legacy_alert_policies.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/main.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/metrics.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/mobile_application_metrics.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/mobile_applications.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/notification_channels.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/server_metrics.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/servers.go (100%) rename {vendor/github.com/yfronto/newrelic => modules/newrelic/client}/usages.go (100%) delete mode 100644 vendor/github.com/yfronto/newrelic/.gitignore delete mode 100644 vendor/github.com/yfronto/newrelic/.travis.yml delete mode 100644 vendor/github.com/yfronto/newrelic/LICENSE delete mode 100644 vendor/github.com/yfronto/newrelic/go.mod diff --git a/go.mod b/go.mod index e9455201..20d27646 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,6 @@ require ( github.com/stretchr/testify v1.4.0 github.com/wtfutil/todoist v0.0.1 github.com/xanzy/go-gitlab v0.22.1 - github.com/yfronto/newrelic v0.0.0-00010101000000-000000000000 github.com/zmb3/spotify v0.0.0-20191010212056-e12fb981aacb github.com/zorkian/go-datadog-api v2.25.0+incompatible golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 @@ -58,5 +57,3 @@ require ( k8s.io/client-go v0.0.0-20190620085101-78d2af792bab k8s.io/utils v0.0.0-20191010214722-8d271d903fe4 // indirect ) - -replace github.com/yfronto/newrelic => ./vendor/github.com/yfronto/newrelic diff --git a/modules/newrelic/client.go b/modules/newrelic/client.go index dc4bf870..1eccbcf3 100644 --- a/modules/newrelic/client.go +++ b/modules/newrelic/client.go @@ -1,23 +1,23 @@ package newrelic import ( - nr "github.com/yfronto/newrelic" + nr "github.com/wtfutil/wtf/modules/newrelic/client" ) -type Client struct { +type Client2 struct { applicationId int nrClient *nr.Client } -func NewClient(apiKey string, applicationId int) *Client { - return &Client{ +func NewClient(apiKey string, applicationId int) *Client2 { + return &Client2{ applicationId: applicationId, nrClient: nr.NewClient(apiKey), } } -func (client *Client) Application() (*nr.Application, error) { +func (client *Client2) Application() (*nr.Application, error) { application, err := client.nrClient.GetApplication(client.applicationId) if err != nil { @@ -27,7 +27,7 @@ func (client *Client) Application() (*nr.Application, error) { return application, nil } -func (client *Client) Deployments() ([]nr.ApplicationDeployment, error) { +func (client *Client2) Deployments() ([]nr.ApplicationDeployment, error) { opts := &nr.ApplicationDeploymentOptions{Page: 1} deployments, err := client.nrClient.GetApplicationDeployments(client.applicationId, opts) diff --git a/vendor/github.com/yfronto/newrelic/README.md b/modules/newrelic/client/README.md similarity index 100% rename from vendor/github.com/yfronto/newrelic/README.md rename to modules/newrelic/client/README.md diff --git a/vendor/github.com/yfronto/newrelic/alert_conditions.go b/modules/newrelic/client/alert_conditions.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/alert_conditions.go rename to modules/newrelic/client/alert_conditions.go diff --git a/vendor/github.com/yfronto/newrelic/alert_events.go b/modules/newrelic/client/alert_events.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/alert_events.go rename to modules/newrelic/client/alert_events.go diff --git a/vendor/github.com/yfronto/newrelic/alert_events_test_fixtures.go b/modules/newrelic/client/alert_events_test_fixtures.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/alert_events_test_fixtures.go rename to modules/newrelic/client/alert_events_test_fixtures.go diff --git a/vendor/github.com/yfronto/newrelic/application_deployments.go b/modules/newrelic/client/application_deployments.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/application_deployments.go rename to modules/newrelic/client/application_deployments.go diff --git a/vendor/github.com/yfronto/newrelic/application_host_metrics.go b/modules/newrelic/client/application_host_metrics.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/application_host_metrics.go rename to modules/newrelic/client/application_host_metrics.go diff --git a/vendor/github.com/yfronto/newrelic/application_hosts.go b/modules/newrelic/client/application_hosts.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/application_hosts.go rename to modules/newrelic/client/application_hosts.go diff --git a/vendor/github.com/yfronto/newrelic/application_instance_metrics.go b/modules/newrelic/client/application_instance_metrics.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/application_instance_metrics.go rename to modules/newrelic/client/application_instance_metrics.go diff --git a/vendor/github.com/yfronto/newrelic/application_instances.go b/modules/newrelic/client/application_instances.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/application_instances.go rename to modules/newrelic/client/application_instances.go diff --git a/vendor/github.com/yfronto/newrelic/application_metrics.go b/modules/newrelic/client/application_metrics.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/application_metrics.go rename to modules/newrelic/client/application_metrics.go diff --git a/vendor/github.com/yfronto/newrelic/application_metrics_test_fixtures.go b/modules/newrelic/client/application_metrics_test_fixtures.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/application_metrics_test_fixtures.go rename to modules/newrelic/client/application_metrics_test_fixtures.go diff --git a/vendor/github.com/yfronto/newrelic/applications.go b/modules/newrelic/client/applications.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/applications.go rename to modules/newrelic/client/applications.go diff --git a/vendor/github.com/yfronto/newrelic/applications_test_fixtures.go b/modules/newrelic/client/applications_test_fixtures.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/applications_test_fixtures.go rename to modules/newrelic/client/applications_test_fixtures.go diff --git a/vendor/github.com/yfronto/newrelic/array.go b/modules/newrelic/client/array.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/array.go rename to modules/newrelic/client/array.go diff --git a/vendor/github.com/yfronto/newrelic/browser_applications.go b/modules/newrelic/client/browser_applications.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/browser_applications.go rename to modules/newrelic/client/browser_applications.go diff --git a/vendor/github.com/yfronto/newrelic/common_test_fixtures.go b/modules/newrelic/client/common_test_fixtures.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/common_test_fixtures.go rename to modules/newrelic/client/common_test_fixtures.go diff --git a/vendor/github.com/yfronto/newrelic/component_metrics.go b/modules/newrelic/client/component_metrics.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/component_metrics.go rename to modules/newrelic/client/component_metrics.go diff --git a/vendor/github.com/yfronto/newrelic/http_helper.go b/modules/newrelic/client/http_helper.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/http_helper.go rename to modules/newrelic/client/http_helper.go diff --git a/vendor/github.com/yfronto/newrelic/http_helper_test_fixtures.go b/modules/newrelic/client/http_helper_test_fixtures.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/http_helper_test_fixtures.go rename to modules/newrelic/client/http_helper_test_fixtures.go diff --git a/vendor/github.com/yfronto/newrelic/key_transactions.go b/modules/newrelic/client/key_transactions.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/key_transactions.go rename to modules/newrelic/client/key_transactions.go diff --git a/vendor/github.com/yfronto/newrelic/legacy_alert_policies.go b/modules/newrelic/client/legacy_alert_policies.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/legacy_alert_policies.go rename to modules/newrelic/client/legacy_alert_policies.go diff --git a/vendor/github.com/yfronto/newrelic/main.go b/modules/newrelic/client/main.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/main.go rename to modules/newrelic/client/main.go diff --git a/vendor/github.com/yfronto/newrelic/metrics.go b/modules/newrelic/client/metrics.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/metrics.go rename to modules/newrelic/client/metrics.go diff --git a/vendor/github.com/yfronto/newrelic/mobile_application_metrics.go b/modules/newrelic/client/mobile_application_metrics.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/mobile_application_metrics.go rename to modules/newrelic/client/mobile_application_metrics.go diff --git a/vendor/github.com/yfronto/newrelic/mobile_applications.go b/modules/newrelic/client/mobile_applications.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/mobile_applications.go rename to modules/newrelic/client/mobile_applications.go diff --git a/vendor/github.com/yfronto/newrelic/notification_channels.go b/modules/newrelic/client/notification_channels.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/notification_channels.go rename to modules/newrelic/client/notification_channels.go diff --git a/vendor/github.com/yfronto/newrelic/server_metrics.go b/modules/newrelic/client/server_metrics.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/server_metrics.go rename to modules/newrelic/client/server_metrics.go diff --git a/vendor/github.com/yfronto/newrelic/servers.go b/modules/newrelic/client/servers.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/servers.go rename to modules/newrelic/client/servers.go diff --git a/vendor/github.com/yfronto/newrelic/usages.go b/modules/newrelic/client/usages.go similarity index 100% rename from vendor/github.com/yfronto/newrelic/usages.go rename to modules/newrelic/client/usages.go diff --git a/modules/newrelic/display.go b/modules/newrelic/display.go index 3f451b6d..d041a42c 100644 --- a/modules/newrelic/display.go +++ b/modules/newrelic/display.go @@ -3,9 +3,9 @@ package newrelic import ( "fmt" + nr "github.com/wtfutil/wtf/modules/newrelic/client" "github.com/wtfutil/wtf/utils" "github.com/wtfutil/wtf/wtf" - nr "github.com/yfronto/newrelic" ) func (widget *Widget) content() (string, string, bool) { diff --git a/modules/newrelic/widget.go b/modules/newrelic/widget.go index 5104e509..16a6348e 100644 --- a/modules/newrelic/widget.go +++ b/modules/newrelic/widget.go @@ -13,7 +13,7 @@ type Widget struct { view.MultiSourceWidget view.TextWidget - Clients []*Client + Clients []*Client2 settings *Settings } @@ -59,7 +59,7 @@ func (widget *Widget) HelpText() string { /* -------------------- Unexported Functions -------------------- */ -func (widget *Widget) currentData() *Client { +func (widget *Widget) currentData() *Client2 { if len(widget.Clients) == 0 { return nil } diff --git a/vendor/github.com/yfronto/newrelic/.gitignore b/vendor/github.com/yfronto/newrelic/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/github.com/yfronto/newrelic/.travis.yml b/vendor/github.com/yfronto/newrelic/.travis.yml deleted file mode 100644 index faa70cc6..00000000 --- a/vendor/github.com/yfronto/newrelic/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: go - -ggo: - - "1.7" - - "1.8" - - "1.9" - - "1.10.x" - - "tip" - -env: - - "PATH=/home/travis/gopath/bin:$PATH" - -install: - - go get -v -t . - -script: - - go get -u github.com/golang/lint/golint - - golint ./... - - test `golint ./... | wc -l` = 0 - - gofmt -l . - - test `gofmt -l . | wc -l` = 0 - - go test -v diff --git a/vendor/github.com/yfronto/newrelic/LICENSE b/vendor/github.com/yfronto/newrelic/LICENSE deleted file mode 100644 index 0de274ef..00000000 --- a/vendor/github.com/yfronto/newrelic/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2016 by authors and contributors. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/yfronto/newrelic/go.mod b/vendor/github.com/yfronto/newrelic/go.mod deleted file mode 100644 index a9761aad..00000000 --- a/vendor/github.com/yfronto/newrelic/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/wtfutil/wtf/vendor/github.com/yfronto/newrelic - -go 1.12