Skip to content

Commit 84ce695

Browse files
committed
fix: resolve linting issues in origin and push code
1 parent 2ed6e0e commit 84ce695

7 files changed

Lines changed: 55 additions & 27 deletions

File tree

internal/command/auth.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ func runAuth(cmd *cobra.Command, args []string) error {
5151

5252
// Try to get project context for configured origins
5353
ctx := GetCommandContext(cmd.Context())
54-
if ctx != nil && ctx.IsInProject && ctx.ProjectConfig != nil && len(ctx.ProjectConfig.Origins) > 0 {
54+
if ctx != nil && ctx.IsInProject && ctx.ProjectConfig != nil &&
55+
len(ctx.ProjectConfig.Origins) > 0 {
5556
// Check tools for configured origins
5657
tools := map[string]bool{}
5758
for _, cfg := range ctx.ProjectConfig.Origins {
@@ -77,8 +78,8 @@ func runAuth(cmd *cobra.Command, args []string) error {
7778

7879
// No project context — check both common tools
7980
printer.Info("No .ee project found, checking common tools...")
80-
checkTool(printer, "gh")
81-
checkTool(printer, "wrangler")
81+
_ = checkTool(printer, "gh")
82+
_ = checkTool(printer, "wrangler")
8283
return nil
8384
}
8485

internal/command/init.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,4 +324,3 @@ func GetCurrentProject() (string, error) {
324324
}
325325
return projectConfig.Project, nil
326326
}
327-

internal/command/push.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ func runPush(cmd *cobra.Command, args []string) error {
8787
available = append(available, k)
8888
}
8989
sort.Strings(available)
90-
return fmt.Errorf("origin %q not found in project (available: %s)", originName, strings.Join(available, ", "))
90+
return fmt.Errorf(
91+
"origin %q not found in project (available: %s)",
92+
originName, strings.Join(available, ", "),
93+
)
9194
}
9295

9396
// Determine push mode
@@ -160,9 +163,14 @@ func runPush(cmd *cobra.Command, args []string) error {
160163
}
161164

162165
// resolveArgs resolves origin name and environment name from positional arguments.
163-
func resolveArgs(args []string, origins map[string]origin.Config) (originName, envName string, err error) {
166+
func resolveArgs(
167+
args []string, origins map[string]origin.Config,
168+
) (originName, envName string, err error) {
164169
if len(origins) == 0 {
165-
return "", "", fmt.Errorf("no origins configured in .ee file. Add an 'origins' section to your project config")
170+
return "", "", fmt.Errorf(
171+
"no origins configured in .ee file. " +
172+
"Add an 'origins' section to your project config",
173+
)
166174
}
167175

168176
if len(args) == 2 {
@@ -184,12 +192,20 @@ func resolveArgs(args []string, origins map[string]origin.Config) (originName, e
184192
}
185193
sort.Strings(available)
186194
return "", "", fmt.Errorf(
187-
"multiple origins configured — specify which one: ee push <origin> %s\navailable origins: %s",
188-
envName, strings.Join(available, ", "))
195+
"multiple origins configured — specify which one: "+
196+
"ee push <origin> %s\navailable origins: %s",
197+
envName,
198+
strings.Join(available, ", "),
199+
)
189200
}
190201

191202
// printSecretsSummary shows a preview of what would be pushed.
192-
func printSecretsSummary(printer *output.Printer, values map[string]string, mode origin.PushMode, cfg origin.Config) {
203+
func printSecretsSummary(
204+
printer *output.Printer,
205+
values map[string]string,
206+
mode origin.PushMode,
207+
cfg origin.Config,
208+
) {
193209
keys := make([]string, 0, len(values))
194210
for k := range values {
195211
keys = append(keys, k)

internal/origin/cloudflare.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,19 @@ func (c *Cloudflare) CheckPrerequisites() error {
3131

3232
out, err := RunCommand("wrangler", "whoami")
3333
if err != nil {
34-
return fmt.Errorf("'wrangler' is not authenticated. Run 'wrangler login' first.\n%s", string(out))
34+
return fmt.Errorf(
35+
"'wrangler' is not authenticated. Run 'wrangler login' first.\n%s",
36+
string(out),
37+
)
3538
}
3639

3740
return nil
3841
}
3942

4043
// Push pushes secrets to Cloudflare Workers.
41-
func (c *Cloudflare) Push(env string, values map[string]string, mode PushMode, dryRun bool) (*PushResult, error) {
44+
func (c *Cloudflare) Push(
45+
env string, values map[string]string, mode PushMode, dryRun bool,
46+
) (*PushResult, error) {
4247
if c.cfg.Worker == "" {
4348
return nil, fmt.Errorf("cloudflare origin requires 'worker' field in config")
4449
}

internal/origin/github.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ func (g *GitHub) CheckPrerequisites() error {
3737
}
3838

3939
// Push pushes secrets to GitHub.
40-
func (g *GitHub) Push(env string, values map[string]string, mode PushMode, dryRun bool) (*PushResult, error) {
40+
func (g *GitHub) Push(
41+
env string, values map[string]string, mode PushMode, dryRun bool,
42+
) (*PushResult, error) {
4143
if mode == "" {
4244
mode = ModeBundled
4345
}
@@ -53,7 +55,9 @@ func (g *GitHub) Push(env string, values map[string]string, mode PushMode, dryRu
5355
}
5456

5557
// pushBundled pushes all secrets as a single multi-line KEY=VALUE secret.
56-
func (g *GitHub) pushBundled(env string, values map[string]string, dryRun bool) (*PushResult, error) {
58+
func (g *GitHub) pushBundled(
59+
env string, values map[string]string, dryRun bool,
60+
) (*PushResult, error) {
5761
secretName := g.cfg.SecretName
5862
if secretName == "" {
5963
secretName = fmt.Sprintf("ENV_%s", strings.ToUpper(env))
@@ -80,7 +84,9 @@ func (g *GitHub) pushBundled(env string, values map[string]string, dryRun bool)
8084
}
8185

8286
// pushIndividual pushes each secret as a separate GitHub secret.
83-
func (g *GitHub) pushIndividual(env string, values map[string]string, dryRun bool) (*PushResult, error) {
87+
func (g *GitHub) pushIndividual(
88+
_ string, values map[string]string, dryRun bool,
89+
) (*PushResult, error) {
8490
result := &PushResult{}
8591

8692
keys := sortedKeys(values)

internal/origin/origin.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ const (
1717

1818
// Config represents an origin configuration in the .ee project file.
1919
type Config struct {
20-
Type string `json:"type"` // "github" or "cloudflare"
21-
22-
// Mode controls how secrets are pushed: "bundled" or "individual"
23-
Mode PushMode `json:"mode,omitempty"`
20+
Type string `json:"type"` // "github" or "cloudflare"
21+
Mode PushMode `json:"mode,omitempty"` // "bundled" or "individual"
2422

2523
// GitHub-specific fields
26-
Repo string `json:"repo,omitempty"` // e.g. "owner/repo", defaults to current repo
27-
SecretName string `json:"secret_name,omitempty"` // bundled mode secret name (default: "ENV_<ENV>")
28-
Environment string `json:"environment,omitempty"` // GitHub environment name
24+
Repo string `json:"repo,omitempty"` // e.g. "owner/repo", defaults to current repo
25+
SecretName string `json:"secret_name,omitempty"` // bundled mode secret name (default: "ENV_<ENV>")
26+
Environment string `json:"environment,omitempty"` // GitHub environment name
2927

3028
// Cloudflare-specific fields
3129
Worker string `json:"worker,omitempty"` // Cloudflare Worker name
@@ -57,7 +55,10 @@ func New(name string, cfg Config) (Origin, error) {
5755
case "cloudflare":
5856
return NewCloudflare(name, cfg), nil
5957
default:
60-
return nil, fmt.Errorf("unsupported origin type: %q (supported: github, cloudflare)", cfg.Type)
58+
return nil, fmt.Errorf(
59+
"unsupported origin type: %q (supported: github, cloudflare)",
60+
cfg.Type,
61+
)
6162
}
6263
}
6364

internal/parser/project.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import (
1313

1414
// ProjectConfig represents the structure of a .ee project configuration file
1515
type ProjectConfig struct {
16-
Project string `json:"project"` // Project UUID or name
17-
Schema ProjectConfigSchema `json:"schema"` // Schema definition or reference
18-
Environments map[string]EnvironmentDefinition `json:"environments"` // Environment configurations
19-
Origins map[string]origin.Config `json:"origins,omitempty"` // Remote origin configurations
16+
Project string `json:"project"` // Project UUID or name
17+
Schema ProjectConfigSchema `json:"schema"` // Schema definition or reference
18+
Environments map[string]EnvironmentDefinition `json:"environments"` // Environment configurations
19+
Origins map[string]origin.Config `json:"origins,omitempty"` // Remote origin configurations
2020
}
2121

2222
// ProjectConfigSchema defines the schema for the project, either inline or by reference

0 commit comments

Comments
 (0)