Skip to content

Commit 868f9d9

Browse files
committed
Apply code styles
1 parent a2c76c1 commit 868f9d9

9 files changed

Lines changed: 21 additions & 22 deletions

File tree

env/environment.go

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

33
import (
4-
"github.com/pkg/errors"
54
"os"
5+
6+
"github.com/pkg/errors"
67
)
78

89
type Environment struct {

env/load_php_file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package env
22

33
import (
4-
"github.com/SoureCode/kyx/internal/php"
54
"path/filepath"
65

6+
"github.com/SoureCode/kyx/internal/php"
77
"github.com/pkg/errors"
88
)
99

internal/php/load_file_dump.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package php
33
import (
44
"bytes"
55
"fmt"
6-
"github.com/joho/godotenv"
7-
"github.com/pkg/errors"
86
"os"
97
"os/exec"
108
"path/filepath"
119
"strings"
10+
11+
"github.com/joho/godotenv"
12+
"github.com/pkg/errors"
1213
)
1314

1415
func LoadFileDump(f string) (map[string]string, error) {

internal/php/write_file_dump.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ package php
33
import (
44
"os"
55
"strings"
6+
7+
"github.com/pkg/errors"
68
)
79

810
func WriteFileDump(file string, data map[string]string) error {
911
content := formatData(data)
10-
return os.WriteFile(file, []byte(content), 0644)
12+
err := os.WriteFile(file, []byte(content), 0644)
13+
return errors.Wrap(err, "failed to write data to file")
1114
}
1215

1316
func formatData(data map[string]string) string {

macro/sentry_deploys_new.go

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

33
import (
44
"fmt"
5-
"github.com/SoureCode/kyx/project"
6-
"github.com/SoureCode/kyx/shell"
75
"os"
86
"path/filepath"
97
"strings"
108
"time"
9+
10+
"github.com/SoureCode/kyx/project"
11+
"github.com/SoureCode/kyx/shell"
1112
)
1213

1314
func SentryDeploysNew(repo string, startedAt, stoppedAt time.Time) {
@@ -38,9 +39,7 @@ func SentryDeploysNew(repo string, startedAt, stoppedAt time.Time) {
3839
return
3940
}
4041

41-
if strings.HasSuffix(sentryUrl, "/") {
42-
sentryUrl = strings.TrimSuffix(sentryUrl, "/")
43-
}
42+
sentryUrl = strings.TrimSuffix(sentryUrl, "/")
4443

4544
sentryOrg, ok := env.Lookup("SENTRY_ORG")
4645
if !ok {

macro/write_deployment_info.go

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

33
import (
4-
"github.com/SoureCode/kyx/internal/php"
5-
"github.com/SoureCode/kyx/project"
6-
"github.com/SoureCode/kyx/shell"
74
"os"
85
"path/filepath"
96
"strings"
7+
8+
"github.com/SoureCode/kyx/internal/php"
9+
"github.com/SoureCode/kyx/project"
10+
"github.com/SoureCode/kyx/shell"
1011
)
1112

1213
func WriteDeploymentInfo(repo string) {

project/get_directory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package project
22

33
import (
44
"fmt"
5-
"github.com/pkg/errors"
65
"os"
76
"path/filepath"
87

98
"github.com/SoureCode/kyx/git"
9+
"github.com/pkg/errors"
1010
)
1111

1212
func getDirectory() (string, error) {

project/project.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ func HasProject() bool {
6969
composerPath := filepath.Join(directory, "composer.json")
7070
_, err = loadComposerJson(composerPath)
7171

72-
if err != nil {
73-
return false
74-
}
75-
76-
return true
72+
return err == nil
7773
}
7874

7975
func (p *Project) HasDependency(dependency string) bool {

shell/command.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (e *Command) Execute() error {
7373
if err := cmd.Start(); err != nil {
7474
fmt.Fprintln(os.Stderr, err)
7575
e.exitCode = 1
76-
return err
76+
return errors.Wrap(err, "failed to start command")
7777
}
7878

7979
waitChannel := make(chan error, 1)
@@ -122,8 +122,6 @@ func (e *Command) Execute() error {
122122
}
123123
}
124124
}
125-
126-
return nil
127125
}
128126

129127
func NewCommand(binary string) *Command {

0 commit comments

Comments
 (0)