Fix golint warnings

This commit is contained in:
Murat Kabilov
2017-08-01 16:08:56 +02:00
committed by GitHub
parent c02a740e10
commit cf663cb841
26 changed files with 122 additions and 89 deletions
+4 -3
View File
@@ -22,7 +22,7 @@ type infrastructureAccount struct {
}
// Team defines informaiton for a single team, including the list of members and infrastructure accounts.
type team struct {
type Team struct {
Dn string `json:"dn"`
ID string `json:"id"`
TeamName string `json:"id_name"`
@@ -43,6 +43,7 @@ type httpClient interface {
Do(req *http.Request) (*http.Response, error)
}
// API describes teams API
type API struct {
httpClient
url string
@@ -61,7 +62,7 @@ func NewTeamsAPI(url string, log *logrus.Logger) *API {
}
// TeamInfo returns information about a given team using its ID and a token to authenticate to the API service.
func (t *API) TeamInfo(teamID, token string) (tm *team, err error) {
func (t *API) TeamInfo(teamID, token string) (tm *Team, err error) {
var (
req *http.Request
resp *http.Response
@@ -103,7 +104,7 @@ func (t *API) TeamInfo(teamID, token string) (tm *team, err error) {
return
}
tm = &team{}
tm = &Team{}
d := json.NewDecoder(resp.Body)
err = d.Decode(tm)
if err != nil {
+5 -5
View File
@@ -18,7 +18,7 @@ var (
var teamsAPItc = []struct {
in string
inCode int
out *team
out *Team
err error
}{
{`{
@@ -67,7 +67,7 @@ var teamsAPItc = []struct {
"parent_team_id": "111221"
}`,
200,
&team{
&Team{
Dn: "cn=100100,ou=official,ou=foobar,dc=zalando,dc=net",
ID: "acid",
TeamName: "ACID",
@@ -169,7 +169,7 @@ func TestInfo(t *testing.T) {
}
}
type mockHttpClient struct {
type mockHTTPClient struct {
}
type mockBody struct {
@@ -183,7 +183,7 @@ func (b *mockBody) Close() error {
return fmt.Errorf("close error")
}
func (c *mockHttpClient) Do(req *http.Request) (*http.Response, error) {
func (c *mockHTTPClient) Do(req *http.Request) (*http.Response, error) {
resp := http.Response{
Status: "200 OK",
StatusCode: 200,
@@ -200,7 +200,7 @@ func TestHttpClientClose(t *testing.T) {
ts := httptest.NewServer(nil)
api := NewTeamsAPI(ts.URL, logger)
api.httpClient = &mockHttpClient{}
api.httpClient = &mockHTTPClient{}
_, err := api.TeamInfo("acid", token)
expError := fmt.Errorf("error when closing response: close error")