1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

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 <chriscummer@me.com>
This commit is contained in:
Chris Cummer 2019-12-01 20:47:02 -08:00 committed by GitHub
parent d9464c4a22
commit 31926fd4a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 9 additions and 67 deletions

3
go.mod
View File

@ -46,7 +46,6 @@ require (
github.com/stretchr/testify v1.4.0 github.com/stretchr/testify v1.4.0
github.com/wtfutil/todoist v0.0.1 github.com/wtfutil/todoist v0.0.1
github.com/xanzy/go-gitlab v0.22.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/zmb3/spotify v0.0.0-20191010212056-e12fb981aacb
github.com/zorkian/go-datadog-api v2.25.0+incompatible github.com/zorkian/go-datadog-api v2.25.0+incompatible
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 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/client-go v0.0.0-20190620085101-78d2af792bab
k8s.io/utils v0.0.0-20191010214722-8d271d903fe4 // indirect k8s.io/utils v0.0.0-20191010214722-8d271d903fe4 // indirect
) )
replace github.com/yfronto/newrelic => ./vendor/github.com/yfronto/newrelic

View File

@ -1,23 +1,23 @@
package newrelic package newrelic
import ( import (
nr "github.com/yfronto/newrelic" nr "github.com/wtfutil/wtf/modules/newrelic/client"
) )
type Client struct { type Client2 struct {
applicationId int applicationId int
nrClient *nr.Client nrClient *nr.Client
} }
func NewClient(apiKey string, applicationId int) *Client { func NewClient(apiKey string, applicationId int) *Client2 {
return &Client{ return &Client2{
applicationId: applicationId, applicationId: applicationId,
nrClient: nr.NewClient(apiKey), 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) application, err := client.nrClient.GetApplication(client.applicationId)
if err != nil { if err != nil {
@ -27,7 +27,7 @@ func (client *Client) Application() (*nr.Application, error) {
return application, nil return application, nil
} }
func (client *Client) Deployments() ([]nr.ApplicationDeployment, error) { func (client *Client2) Deployments() ([]nr.ApplicationDeployment, error) {
opts := &nr.ApplicationDeploymentOptions{Page: 1} opts := &nr.ApplicationDeploymentOptions{Page: 1}
deployments, err := client.nrClient.GetApplicationDeployments(client.applicationId, opts) deployments, err := client.nrClient.GetApplicationDeployments(client.applicationId, opts)

View File

@ -3,9 +3,9 @@ package newrelic
import ( import (
"fmt" "fmt"
nr "github.com/wtfutil/wtf/modules/newrelic/client"
"github.com/wtfutil/wtf/utils" "github.com/wtfutil/wtf/utils"
"github.com/wtfutil/wtf/wtf" "github.com/wtfutil/wtf/wtf"
nr "github.com/yfronto/newrelic"
) )
func (widget *Widget) content() (string, string, bool) { func (widget *Widget) content() (string, string, bool) {

View File

@ -13,7 +13,7 @@ type Widget struct {
view.MultiSourceWidget view.MultiSourceWidget
view.TextWidget view.TextWidget
Clients []*Client Clients []*Client2
settings *Settings settings *Settings
} }
@ -59,7 +59,7 @@ func (widget *Widget) HelpText() string {
/* -------------------- Unexported Functions -------------------- */ /* -------------------- Unexported Functions -------------------- */
func (widget *Widget) currentData() *Client { func (widget *Widget) currentData() *Client2 {
if len(widget.Clients) == 0 { if len(widget.Clients) == 0 {
return nil return nil
} }

View File

View File

@ -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

View File

@ -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 <organization> 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 <COPYRIGHT HOLDER>
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.

View File

@ -1,3 +0,0 @@
module github.com/wtfutil/wtf/vendor/github.com/yfronto/newrelic
go 1.12