Merge pull request #2581 from guohuang/bug

Removed local variable declaration in Go
This commit is contained in:
wing328 2016-04-13 13:58:53 +08:00
commit 668dccfbcf
2 changed files with 12 additions and 22 deletions

View File

@ -21,16 +21,13 @@ type Configuration struct {
}
func NewConfiguration() *Configuration {
defaultHeader := make(map[string]string)
apiKey := make(map[string]string)
apiKeyPrefix := make(map[string]string)
return &Configuration{
BasePath: "{{basePath}}",
UserName: "",
Debug: false,
DefaultHeader: defaultHeader,
ApiKey: apiKey,
ApiKeyPrefix: apiKeyPrefix,
DefaultHeader: make(map[string]string),
ApiKey: make(map[string]string),
ApiKeyPrefix: make(map[string]string) ,
}
}
@ -43,11 +40,9 @@ func (c *Configuration) AddDefaultHeader(key string, value string) {
}
func (c *Configuration) GetApiKeyWithPrefix(apiKeyIdentifier string) string {
var returnValue = c.ApiKey[apiKeyIdentifier]
var apiKeyPrefix = c.ApiKeyPrefix[apiKeyIdentifier]
if apiKeyPrefix != ""{
returnValue = apiKeyPrefix + " " + returnValue
if c.ApiKeyPrefix[apiKeyIdentifier] != ""{
return c.ApiKeyPrefix[apiKeyIdentifier] + " " + c.ApiKey[apiKeyIdentifier]
}
return returnValue
return c.ApiKey[apiKeyIdentifier]
}

View File

@ -21,16 +21,13 @@ type Configuration struct {
}
func NewConfiguration() *Configuration {
defaultHeader := make(map[string]string)
apiKey := make(map[string]string)
apiKeyPrefix := make(map[string]string)
return &Configuration{
BasePath: "http://petstore.swagger.io/v2",
UserName: "",
Debug: false,
DefaultHeader: defaultHeader,
ApiKey: apiKey,
ApiKeyPrefix: apiKeyPrefix,
DefaultHeader: make(map[string]string),
ApiKey: make(map[string]string),
ApiKeyPrefix: make(map[string]string) ,
}
}
@ -43,11 +40,9 @@ func (c *Configuration) AddDefaultHeader(key string, value string) {
}
func (c *Configuration) GetApiKeyWithPrefix(apiKeyIdentifier string) string {
var returnValue = c.ApiKey[apiKeyIdentifier]
var apiKeyPrefix = c.ApiKeyPrefix[apiKeyIdentifier]
if apiKeyPrefix != ""{
returnValue = apiKeyPrefix + " " + returnValue
if c.ApiKeyPrefix[apiKeyIdentifier] != ""{
return c.ApiKeyPrefix[apiKeyIdentifier] + " " + c.ApiKey[apiKeyIdentifier]
}
return returnValue
return c.ApiKey[apiKeyIdentifier]
}