From c7e5a5f2078d00c3e6f4eb2b3ca9c89eb6b01ffc Mon Sep 17 00:00:00 2001 From: Andrea Fazzi Date: Fri, 31 Jan 2020 15:14:42 +0100 Subject: [PATCH] Remove some commented lines --- benchmarks/gen_targets.go | 2 -- client/client.go | 28 ++-------------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/benchmarks/gen_targets.go b/benchmarks/gen_targets.go index e6686da2..d8049287 100644 --- a/benchmarks/gen_targets.go +++ b/benchmarks/gen_targets.go @@ -66,13 +66,11 @@ func genPOSTResponseTargets(targetName string, conf *config) error { targets := make([]*vegeta.Target, 0) form := url.Values{} form.Set("Singleresponses.0", "32") - // payload := "SingleResponses.0=32&SingleResponses.1=68&SingleResponses.2=34&SingleResponses.3=46&SingleResponses.4=25&SingleResponses.5=42&SingleResponses.6=7&SingleResponses.7=38&SingleResponses.8=13&SingleResponses.9=24&SingleResponses.10=73&SingleResponses.11=1&SingleResponses.12=19&SingleResponses.13=64&SingleResponses.14=80&SingleResponses.15=11&SingleResponses.16=70&SingleResponses.17=54&SingleResponses.18=50&SingleResponses.19=57" for i, participant := range participants { targets = append(targets, &vegeta.Target{ Method: "POST", URL: fmt.Sprintf("%s/responses/%d/update?format=html&tpl_content=responses_add_update&tpl_layout=base&update=true&login_session=%s", conf.Url, i+1, tokens[participant.FiscalCode]), - // Body: []byte(base64.StdEncoding.EncodeToString([]byte(payload))), Body: []byte(form.Encode()), Header: http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}, }) diff --git a/client/client.go b/client/client.go index c7e2ec23..4281a28a 100644 --- a/client/client.go +++ b/client/client.go @@ -62,8 +62,8 @@ func Dial(host, username, password string) (*Client, error) { // GetToken get the token associated with the user. func GetToken(host, username, password string) (string, error) { - client, err := Dial(host, username,password) - + client, err := Dial(host, username, password) + return client.token, err } @@ -235,27 +235,3 @@ func (c *Client) Exists(model orm.IDer) bool { _, err := c.Read(model) return err != gorm.ErrRecordNotFound } - -// // FIXME: refactor this (it's duplicated across the code) -// func pluralizedModelName(value interface{}) string { -// return inflection.Plural(strings.ToLower(reflect.ModelName(value))) -// } - -// // FIXME: refactor this (it's duplicated across the code) -// func callString(value interface{}) string { -// if value != nil { -// switch reflect.ValueOf(value).Kind() { -// case reflect.String: -// return value.(string) -// case reflect.Bool: -// if value.(bool) { -// return i18n.Text["answerCorrect"]["it"] -// } -// return "false" -// default: -// return reflect.ValueOf(value).MethodByName("String").Interface().(func() string)() -// } -// } else { -// return "" -// } -// }