Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
kripsy committed Nov 9, 2023
1 parent 4cb680e commit 4e590b3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions internal/client/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const (
defaultServerAddress = "127.0.0.1:50051"
)

//nolint:gochecknoglobals
var flags Flags

//nolint:gochecknoglobals
var once sync.Once

func GetConfig() (Config, error) {
Expand All @@ -32,6 +35,7 @@ func GetConfig() (Config, error) {

if _, err := os.Stat(configPath); os.IsNotExist(err) {
// Возвращаем ошибку, если файл конфигурации не существует
//nolint:goerr113
return Config{}, fmt.Errorf("config file not found: %s", configPath)
} else if err != nil {
// Возвращаем ошибку, если есть другая ошибка при проверке файла
Expand All @@ -41,6 +45,7 @@ func GetConfig() (Config, error) {
// Попытка парсинга файла конфигурации
if err := parseConfig(configPath, &fileCfg); err != nil {
fmt.Printf("failed to read yaml config file: %v\n", err)

return Config{}, err
}

Expand Down
1 change: 1 addition & 0 deletions internal/client/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ server_address: "127.0.0.1:8080"
t.Run(tt.name, func(t *testing.T) {
// Если указаны данные конфигурации, записываем их в файл
if len(tt.configFileData) > 0 {
//nolint:gosec
if err := os.WriteFile(tt.configFile, tt.configFileData, 0644); err != nil {
t.Fatalf("Failed to write to config file: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/client/usecase/create.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//nolint:ireturn
package usecase

import (
Expand Down Expand Up @@ -37,6 +36,7 @@ func (c *ClientUsecase) createSecret(secretType int, success bool) {
}
}

//nolint:ireturn,nolintlint
func (c *ClientUsecase) getSecretrData(secretType int) (filemanager.Data, models.DataInfo, error) {
var data filemanager.Data
var filePath string
Expand Down
2 changes: 1 addition & 1 deletion internal/client/usecase/update.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//nolint:ireturn
package usecase

import (
Expand Down Expand Up @@ -54,6 +53,7 @@ func (c *ClientUsecase) updateMetaInfo(secretName string, metaInfo models.DataIn
return nil
}

//nolint:ireturn,nolintlint
func (c *ClientUsecase) getUpdatedData(secretName string, dataType int) (filemanager.Data, error) {
var data filemanager.Data
var err error
Expand Down

0 comments on commit 4e590b3

Please sign in to comment.