Skip to content

Commit 2183d15

Browse files
committed
Fix formatting and add missing error wrapping
1 parent 9542ad2 commit 2183d15

20 files changed

Lines changed: 54 additions & 32 deletions

env/load_file.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package env
22

33
import (
4-
"github.com/joho/godotenv"
5-
"github.com/pkg/errors"
64
"os"
75
"path/filepath"
6+
7+
"github.com/joho/godotenv"
8+
"github.com/pkg/errors"
89
)
910

1011
func loadFile(envMap map[string]string, directory string, filename string) error {

env/load_php_file.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package env
22

33
import (
44
"fmt"
5-
"github.com/joho/godotenv"
6-
"github.com/pkg/errors"
75
"io"
86
"os"
97
"os/exec"
108
"path/filepath"
9+
10+
"github.com/joho/godotenv"
11+
"github.com/pkg/errors"
1112
)
1213

1314
func loadPHPFile(envMap map[string]string, directory string, filename string) error {

git/root_directory.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package git
33
import (
44
"os/exec"
55
"path/filepath"
6+
7+
"github.com/pkg/errors"
68
)
79

810
// RootDirectory tries to find the git root directory from the given path.
@@ -12,7 +14,7 @@ func RootDirectory(startDir string) (string, error) {
1214
out, err := cmd.Output()
1315

1416
if err != nil {
15-
return "", err
17+
return "", errors.Wrapf(err, "failed to read git root directory")
1618
}
1719

1820
return string(filepath.Clean(string(out[:len(out)-1]))), nil

macro/check_requirements.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package macro
22

33
import (
4+
"path/filepath"
5+
46
"github.com/SoureCode/kyx/project"
57
"github.com/SoureCode/kyx/shell"
68
"github.com/pkg/errors"
7-
"path/filepath"
89
)
910

1011
func CheckRequirements() {

macro/composer_dump_env.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package macro
22

33
import (
4+
"os"
5+
"path/filepath"
6+
47
"github.com/SoureCode/kyx/project"
58
"github.com/SoureCode/kyx/shell"
69
"github.com/pkg/errors"
7-
"os"
8-
"path/filepath"
910
)
1011

1112
func ComposerDumpEnv() {

macro/docker_compose_down.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package macro
22

33
import (
4+
"path/filepath"
5+
46
"github.com/SoureCode/kyx/project"
57
"github.com/SoureCode/kyx/shell"
68
"github.com/pkg/errors"
7-
"path/filepath"
89
)
910

1011
func DockerComposeDown() {

macro/docker_compose_up.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package macro
22

33
import (
4+
"os"
5+
"path/filepath"
6+
47
"github.com/SoureCode/kyx/project"
58
"github.com/SoureCode/kyx/shell"
69
"github.com/pkg/errors"
7-
"os"
8-
"path/filepath"
910
)
1011

1112
func anyFileExists(filenames ...string) bool {

macro/wait_for_database.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package macro
22

33
import (
4+
"time"
5+
46
"github.com/SoureCode/kyx/project"
57
"github.com/SoureCode/kyx/shell"
68
"github.com/pkg/errors"
7-
"time"
89
)
910

1011
func WaitForDatabase() {

main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ package main
22

33
import (
44
"fmt"
5+
"os"
6+
"slices"
7+
"time"
8+
59
"github.com/SoureCode/kyx/commands"
610
"github.com/SoureCode/kyx/tools"
711
"github.com/pkg/errors"
812
"github.com/symfony-cli/console"
913
"github.com/symfony-cli/dumper"
10-
"os"
11-
"slices"
12-
"time"
1314
)
1415

1516
var (

project/composer_json.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package project
33
import (
44
"encoding/json"
55
"os"
6+
7+
"github.com/pkg/errors"
68
)
79

810
type composerJson struct {
@@ -38,12 +40,12 @@ func loadComposerJson(path string) (*composerJson, error) {
3840
file, err := os.ReadFile(path)
3941

4042
if err != nil {
41-
return nil, err
43+
return nil, errors.Wrap(err, "failed to read file")
4244
}
4345

4446
var composerData composerJson
4547
if err := json.Unmarshal(file, &composerData); err != nil {
46-
return nil, err
48+
return nil, errors.Wrap(err, "failed to unmarshal composer.json")
4749
}
4850

4951
return &composerData, nil

0 commit comments

Comments
 (0)