updated dependencies and golangci-lint to v2
This commit is contained in:
@@ -204,13 +204,13 @@ func (p *plugin) update(withBackup bool) error {
|
||||
// try again with an .exe extension
|
||||
newExec = newExec + ".exe"
|
||||
if _, fallbackErr := os.Stat(newExec); fallbackErr != nil {
|
||||
return fmt.Errorf("The executable in the extracted path is missing or it is inaccessible: %v, %v", err, fallbackErr)
|
||||
return fmt.Errorf("the executable in the extracted path is missing or it is inaccessible: %v, %v", err, fallbackErr)
|
||||
}
|
||||
}
|
||||
|
||||
// rename the current executable
|
||||
if err := os.Rename(oldExec, renamedOldExec); err != nil {
|
||||
return fmt.Errorf("Failed to rename the current executable: %w", err)
|
||||
return fmt.Errorf("failed to rename the current executable: %w", err)
|
||||
}
|
||||
|
||||
tryToRevertExecChanges := func() {
|
||||
@@ -227,7 +227,7 @@ func (p *plugin) update(withBackup bool) error {
|
||||
// replace with the extracted binary
|
||||
if err := os.Rename(newExec, oldExec); err != nil {
|
||||
tryToRevertExecChanges()
|
||||
return fmt.Errorf("Failed replacing the executable: %w", err)
|
||||
return fmt.Errorf("failed replacing the executable: %w", err)
|
||||
}
|
||||
|
||||
if withBackup {
|
||||
|
||||
@@ -314,7 +314,7 @@ func (p *plugin) registerHooks() error {
|
||||
func() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
fmtErr := fmt.Errorf("Failed to execute %s:\n - %v", file, err)
|
||||
fmtErr := fmt.Errorf("failed to execute %s:\n - %v", file, err)
|
||||
|
||||
if p.config.HooksWatch {
|
||||
color.Red("%v", fmtErr)
|
||||
|
||||
@@ -145,7 +145,7 @@ func (p *plugin) createCommand() *cobra.Command {
|
||||
|
||||
func (p *plugin) migrateCreateHandler(template string, args []string, interactive bool) (string, error) {
|
||||
if len(args) < 1 {
|
||||
return "", errors.New("Missing migration file name")
|
||||
return "", errors.New("missing migration file name")
|
||||
}
|
||||
|
||||
name := args[0]
|
||||
@@ -172,7 +172,7 @@ func (p *plugin) migrateCreateHandler(template string, args []string, interactiv
|
||||
template, templateErr = p.goBlankTemplate()
|
||||
}
|
||||
if templateErr != nil {
|
||||
return "", fmt.Errorf("Failed to resolve create template: %v\n", templateErr)
|
||||
return "", fmt.Errorf("failed to resolve create template: %v", templateErr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ func (p *plugin) migrateCreateHandler(template string, args []string, interactiv
|
||||
|
||||
// save the migration file
|
||||
if err := os.WriteFile(resultFilePath, []byte(template), 0644); err != nil {
|
||||
return "", fmt.Errorf("Failed to save migration file %q: %v\n", resultFilePath, err)
|
||||
return "", fmt.Errorf("failed to save migration file %q: %v", resultFilePath, err)
|
||||
}
|
||||
|
||||
if interactive {
|
||||
@@ -199,7 +199,7 @@ func (p *plugin) migrateCollectionsHandler(args []string, interactive bool) (str
|
||||
|
||||
collections := []*core.Collection{}
|
||||
if err := p.app.CollectionQuery().OrderBy("created ASC").All(&collections); err != nil {
|
||||
return "", fmt.Errorf("Failed to fetch migrations list: %v\n", err)
|
||||
return "", fmt.Errorf("failed to fetch migrations list: %v", err)
|
||||
}
|
||||
|
||||
var template string
|
||||
@@ -210,7 +210,7 @@ func (p *plugin) migrateCollectionsHandler(args []string, interactive bool) (str
|
||||
template, templateErr = p.goSnapshotTemplate(collections)
|
||||
}
|
||||
if templateErr != nil {
|
||||
return "", fmt.Errorf("Failed to resolve template: %v\n", templateErr)
|
||||
return "", fmt.Errorf("failed to resolve template: %v", templateErr)
|
||||
}
|
||||
|
||||
return p.migrateCreateHandler(template, createArgs, interactive)
|
||||
|
||||
Reference in New Issue
Block a user