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

* Fix shadowed variables in cmd package

* Fix shadowed variables in plugin package

* Fix shadowed variables in store package

* Fix shadowed variables in web package

* Changes as requested

Signed-off-by: Hanzei <hanzei@mailbox.org>

* Fix build

* Remove unnessary statements

* Use require all the time

* Fix build

* Rename variables according to feedback

* Fix NPE

* Changes as requested
Этот коммит содержится в:
Hanzei
2019-01-30 18:55:24 +01:00
коммит произвёл Jesse Hallam
родитель 2c9cf41dad
Коммит d898787371
6 изменённых файлов: 62 добавлений и 70 удалений

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

@@ -202,14 +202,16 @@ func sampleDataCmdF(command *cobra.Command, args []string) error {
}
profileImages := []string{}
if profileImagesPath != "" {
profileImagesStat, err := os.Stat(profileImagesPath)
var profileImagesStat os.FileInfo
profileImagesStat, err = os.Stat(profileImagesPath)
if os.IsNotExist(err) {
return errors.New("Profile images folder doesn't exists.")
}
if !profileImagesStat.IsDir() {
return errors.New("profile-images parameters must be a folder path.")
}
profileImagesFiles, err := ioutil.ReadDir(profileImagesPath)
var profileImagesFiles []os.FileInfo
profileImagesFiles, err = ioutil.ReadDir(profileImagesPath)
if err != nil {
return errors.New("Invalid profile-images parameter")
}

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

@@ -105,9 +105,9 @@ func TestRunServerSystemdNotification(t *testing.T) {
socketReader := make(chan string)
go func(ch chan string) {
buffer := make([]byte, 512)
count, err := connection.Read(buffer)
if err != nil {
panic(err)
count, readErr := connection.Read(buffer)
if readErr != nil {
panic(readErr)
}
data := buffer[0:count]
ch <- string(data)