Fix shadowed variables in various places: Part 2 of 2 (#10176)

This PR fixes shadowed variables in the following packages:
- `app`
- `utils`
- `utils/markdown`
- `services/mailservice`
Этот коммит содержится в:
Hanzei
2019-01-28 21:57:45 +01:00
коммит произвёл GitHub
родитель 58b2a3d16e
Коммит 179e98c245
7 изменённых файлов: 26 добавлений и 22 удалений

Просмотреть файл

@@ -308,7 +308,7 @@ func fixEnvSettingsCase(in map[string]interface{}) (out map[string]interface{},
return nil
}
out := make(map[string]interface{}, len(in))
fixCaseOut := make(map[string]interface{}, len(in))
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
@@ -316,14 +316,14 @@ func fixEnvSettingsCase(in map[string]interface{}) (out map[string]interface{},
key := field.Name
if value, ok := in[strings.ToLower(key)]; ok {
if valueAsMap, ok := value.(map[string]interface{}); ok {
out[key] = fixCase(valueAsMap, field.Type)
fixCaseOut[key] = fixCase(valueAsMap, field.Type)
} else {
out[key] = value
fixCaseOut[key] = value
}
}
}
return out
return fixCaseOut
}
out = fixCase(in, reflect.TypeOf(model.Config{}))

Просмотреть файл

@@ -140,8 +140,8 @@ func (c *Cache) GetOrAdd(key, value interface{}, ttl time.Duration) (actual inte
defer c.lock.Unlock()
// Check for existing item
if value, ok := c.getValue(key); ok {
return value, true
if actualValue, ok := c.getValue(key); ok {
return actualValue, true
}
c.add(key, value, ttl)

Просмотреть файл

@@ -77,10 +77,10 @@ func ParseBlocks(markdown string, lines []Line) (*Document, []*ReferenceDefiniti
didAdd := false
for i := lastMatchIndex; i >= 0; i-- {
if container, ok := openBlocks[i].(ContainerBlock); ok {
if newBlocks := container.AddChild(newBlocks); newBlocks != nil {
if addedBlocks := container.AddChild(newBlocks); addedBlocks != nil {
closeBlocks(openBlocks[i+1:], &referenceDefinitions)
openBlocks = openBlocks[:i+1]
openBlocks = append(openBlocks, newBlocks...)
openBlocks = append(openBlocks, addedBlocks...)
didAdd = true
break
}

Просмотреть файл

@@ -398,8 +398,8 @@ func (p *inlineParser) lookForLinkOrImage() {
p.inlines = append(p.inlines[:d.TextNode], inline)
} else {
p.inlines = append(p.inlines[:d.TextNode], inline)
for element := element.Prev(); element != nil; element = element.Prev() {
if d := element.Value.(*delimiter); d.Type == linkOpeningDelimiter {
for inlineElement := element.Prev(); inlineElement != nil; inlineElement = inlineElement.Prev() {
if d := inlineElement.Value.(*delimiter); d.Type == linkOpeningDelimiter {
d.IsInactive = true
}
}