From 563e3aa43df29e8526635ecf731cd4cf7e0182c9 Mon Sep 17 00:00:00 2001 From: leogtzr Date: Sat, 9 Jun 2018 19:44:00 -0600 Subject: [PATCH] Changing some code according to golint --- gobank_suite_test.go | 22 +++++++++++----------- mountebank.go | 18 +++++++++--------- mountebank_test.go | 18 +++++++++--------- predicates/contains.go | 6 +++--- predicates/deepEquals.go | 6 +++--- predicates/endsWith.go | 6 +++--- predicates/equals.go | 6 +++--- predicates/exists.go | 6 +++--- predicates/matches.go | 6 +++--- predicates/startsWith.go | 6 +++--- 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/gobank_suite_test.go b/gobank_suite_test.go index 2bc8272..3899d5d 100644 --- a/gobank_suite_test.go +++ b/gobank_suite_test.go @@ -10,7 +10,7 @@ import ( "github.com/parnurzeal/gorequest" ) -var MountebankUri string +var MountebankURI string func TestMountebank(t *testing.T) { RegisterFailHandler(Fail) @@ -18,28 +18,28 @@ func TestMountebank(t *testing.T) { } var _ = BeforeSuite(func() { - MountebankUri = os.Getenv("MOUNTEBANK_URI") - if len(MountebankUri) == 0 { - MountebankUri = "http://localhost:2525" + MountebankURI = os.Getenv("MOUNTEBANK_URI") + if len(MountebankURI) == 0 { + MountebankURI = "http://localhost:2525" } - Expect(isMountebankRunning(MountebankUri)).To(BeTrue(), "Mountebank is not running") + Expect(isMountebankRunning(MountebankURI)).To(BeTrue(), "Mountebank is not running") - truncateMountebank(MountebankUri) + truncateMountebank(MountebankURI) }) var _ = AfterSuite(func() { }) -func isMountebankRunning(mountebankBaseUri string) bool { - resp, _, errs := gorequest.New().Get(mountebankBaseUri).End() +func isMountebankRunning(mountebankBaseURI string) bool { + resp, _, errs := gorequest.New().Get(mountebankBaseURI).End() Expect(errs).To(HaveLen(0)) return resp.StatusCode == http.StatusOK } -func truncateMountebank(mountebankBaseUri string) { - impostersUri := mountebankBaseUri + "/imposters" - gorequest.New().Delete(impostersUri).End() +func truncateMountebank(mountebankBaseURI string) { + impostersURI := mountebankBaseURI + "/imposters" + gorequest.New().Delete(impostersURI).End() } diff --git a/mountebank.go b/mountebank.go index ab0e42e..91f697f 100644 --- a/mountebank.go +++ b/mountebank.go @@ -10,19 +10,19 @@ import ( ) type Client struct { - mountebankUri string - impostersUri string + mountebankURI string + impostersURI string } -func NewClient(mountebankUri string) *Client { +func NewClient(mountebankURI string) *Client { return &Client{ - mountebankUri: mountebankUri, - impostersUri: mountebankUri + "/imposters", + mountebankURI: mountebankURI, + impostersURI: mountebankURI + "/imposters", } } func (c *Client) CreateImposter(imposter ImposterElement) (map[string]interface{}, error) { - resp, body, errs := gorequest.New().Post(c.impostersUri).Send(imposter).EndBytes() + resp, body, errs := gorequest.New().Post(c.impostersURI).Send(imposter).EndBytes() if len(errs) > 0 { return nil, errs[0] @@ -39,9 +39,9 @@ func (c *Client) CreateImposter(imposter ImposterElement) (map[string]interface{ } func (c *Client) DeleteImposter(port int) (map[string]interface{}, error) { - imposterUri := c.impostersUri + "/" + strconv.Itoa(port) + imposterURI := c.impostersURI + "/" + strconv.Itoa(port) - resp, body, errs := gorequest.New().Delete(imposterUri).EndBytes() + resp, body, errs := gorequest.New().Delete(imposterURI).EndBytes() if len(errs) > 0 { return nil, errs[0] @@ -58,7 +58,7 @@ func (c *Client) DeleteImposter(port int) (map[string]interface{}, error) { } func (c *Client) DeleteAllImposters() (map[string]interface{}, error) { - resp, body, errs := gorequest.New().Delete(c.impostersUri).EndBytes() + resp, body, errs := gorequest.New().Delete(c.impostersURI).EndBytes() if len(errs) > 0 { return nil, errs[0] diff --git a/mountebank_test.go b/mountebank_test.go index e84902b..d33eb36 100644 --- a/mountebank_test.go +++ b/mountebank_test.go @@ -42,15 +42,15 @@ var _ = Describe("Mountebank Client", func() { expectedImposter = gobank.NewImposterBuilder().Protocol(protocol).Port(port).Name("Greeting Imposter").Stubs(stub).Build() - client := gobank.NewClient(MountebankUri) + client := gobank.NewClient(MountebankURI) createdImposter, err = client.CreateImposter(expectedImposter) log.Println("ActualImposter: ", createdImposter) }) }) It("should have the Imposter installed on Mountebank", func() { - imposterUri := MountebankUri + "/imposters/" + strconv.Itoa(port) - resp, body, _ := gorequest.New().Get(imposterUri).End() + imposterURI := MountebankURI + "/imposters/" + strconv.Itoa(port) + resp, body, _ := gorequest.New().Get(imposterURI).End() log.Println("Imposter from Mountebank. Body: ", body) Expect(resp.StatusCode).To(Equal(http.StatusOK)) @@ -91,7 +91,7 @@ var _ = Describe("Mountebank Client", func() { BeforeEach(func() { once.Do(func() { imposter := gobank.NewImposterBuilder().Protocol(protocol).Port(port).Build() - client := gobank.NewClient(MountebankUri) + client := gobank.NewClient(MountebankURI) client.CreateImposter(imposter) deletedImposter, err = client.DeleteImposter(port) @@ -99,8 +99,8 @@ var _ = Describe("Mountebank Client", func() { }) It("should delete the installed Imposter at Mountebank", func() { - imposterUri := MountebankUri + "/imposters/" + strconv.Itoa(port) - resp, _, _ := gorequest.New().Get(imposterUri).End() + imposterURI := MountebankURI + "/imposters/" + strconv.Itoa(port) + resp, _, _ := gorequest.New().Get(imposterURI).End() Expect(resp.StatusCode).To(Equal(http.StatusNotFound)) }) @@ -131,7 +131,7 @@ var _ = Describe("Mountebank Client", func() { imposter1 := gobank.NewImposterBuilder().Protocol(protocol).Build() imposter2 := gobank.NewImposterBuilder().Protocol(protocol).Build() - client := gobank.NewClient(MountebankUri) + client := gobank.NewClient(MountebankURI) client.CreateImposter(imposter1) client.CreateImposter(imposter2) @@ -140,8 +140,8 @@ var _ = Describe("Mountebank Client", func() { }) It("should delete all the installed Imposters at Mountebank", func() { - impostersUri := MountebankUri + "/imposters" - resp, _, _ := gorequest.New().Get(impostersUri).End() + impostersURI := MountebankURI + "/imposters" + resp, _, _ := gorequest.New().Get(impostersURI).End() Expect(resp.StatusCode).To(Equal(http.StatusOK)) }) diff --git a/predicates/contains.go b/predicates/contains.go index 76d5228..924c797 100644 --- a/predicates/contains.go +++ b/predicates/contains.go @@ -13,10 +13,10 @@ func (p contains) Type() string { func (p contains) MarshalJSON() ([]byte, error) { requestBytes, _ := json.Marshal(p.req) - requestJson := string(requestBytes) - containsJson := " { \"contains\" : " + requestJson + "}" + requestJSON := string(requestBytes) + containsJSON := " { \"contains\" : " + requestJSON + "}" - return []byte(containsJson), nil + return []byte(containsJSON), nil } type ContainsBuilder struct { diff --git a/predicates/deepEquals.go b/predicates/deepEquals.go index 66ed704..6a29a89 100644 --- a/predicates/deepEquals.go +++ b/predicates/deepEquals.go @@ -13,10 +13,10 @@ func (p deepEquals) Type() string { func (p deepEquals) MarshalJSON() ([]byte, error) { requestBytes, _ := json.Marshal(p.req) - requestJson := string(requestBytes) - deepEqualsJson := " { \"deepEquals\" : " + requestJson + "}" + requestJSON := string(requestBytes) + deepEqualsJSON := " { \"deepEquals\" : " + requestJSON + "}" - return []byte(deepEqualsJson), nil + return []byte(deepEqualsJSON), nil } type DeepEqualsBuilder struct { diff --git a/predicates/endsWith.go b/predicates/endsWith.go index ee96cb2..02755c7 100644 --- a/predicates/endsWith.go +++ b/predicates/endsWith.go @@ -13,10 +13,10 @@ func (p endsWith) Type() string { func (p endsWith) MarshalJSON() ([]byte, error) { requestBytes, _ := json.Marshal(p.req) - requestJson := string(requestBytes) - endsWithJson := " { \"endsWith\" : " + requestJson + "}" + requestJSON := string(requestBytes) + endsWithJSON := " { \"endsWith\" : " + requestJSON + "}" - return []byte(endsWithJson), nil + return []byte(endsWithJSON), nil } type EndsWithBuilder struct { diff --git a/predicates/equals.go b/predicates/equals.go index da1a63f..3ad28de 100644 --- a/predicates/equals.go +++ b/predicates/equals.go @@ -13,10 +13,10 @@ func (p equals) Type() string { func (p equals) MarshalJSON() ([]byte, error) { requestBytes, _ := json.Marshal(p.req) - requestJson := string(requestBytes) - equalsJson := " { \"equals\" : " + requestJson + "}" + requestJSON := string(requestBytes) + equalsJSON := " { \"equals\" : " + equalsJSON + "}" - return []byte(equalsJson), nil + return []byte(equalsJSON), nil } type EqualsBuilder struct { diff --git a/predicates/exists.go b/predicates/exists.go index 63269a0..7453869 100644 --- a/predicates/exists.go +++ b/predicates/exists.go @@ -21,10 +21,10 @@ func (p exists) Type() string { func (p exists) MarshalJSON() ([]byte, error) { requestBytes, _ := json.Marshal(p.req) - requestJson := string(requestBytes) - existsJson := " { \"exists\" : " + requestJson + "}" + requestJSON := string(requestBytes) + existsJSON := " { \"exists\" : " + requestJSON + "}" - return []byte(existsJson), nil + return []byte(existsJSON), nil } type ExistsBuilder struct { diff --git a/predicates/matches.go b/predicates/matches.go index 6d0b83c..fd84882 100644 --- a/predicates/matches.go +++ b/predicates/matches.go @@ -13,10 +13,10 @@ func (p matches) Type() string { func (p matches) MarshalJSON() ([]byte, error) { requestBytes, _ := json.Marshal(p.req) - requestJson := string(requestBytes) - matchesJson := " { \"matches\" : " + requestJson + "}" + requestJSON := string(requestBytes) + matchesJSON := " { \"matches\" : " + requestJSON + "}" - return []byte(matchesJson), nil + return []byte(matchesJSON), nil } type MatchesBuilder struct { diff --git a/predicates/startsWith.go b/predicates/startsWith.go index 701d3db..2a9b5c8 100644 --- a/predicates/startsWith.go +++ b/predicates/startsWith.go @@ -13,10 +13,10 @@ func (p startsWith) Type() string { func (p startsWith) MarshalJSON() ([]byte, error) { requestBytes, _ := json.Marshal(p.req) - requestJson := string(requestBytes) - startsWithJson := " { \"startsWith\" : " + requestJson + "}" + requestJSON := string(requestBytes) + startsWithJSON := " { \"startsWith\" : " + requestJSON + "}" - return []byte(startsWithJson), nil + return []byte(startsWithJSON), nil } type StartsWithBuilder struct {