Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Jun 4, 2024
1 parent 686bdd9 commit c6f9a58
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/acme/solvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ func (s httpSolver) Present(_ context.Context, challenge acme.Challenge) error {
}

challengeFilePath := filepath.Join(s.path, challenge.HTTP01ResourcePath())
err = os.MkdirAll(filepath.Dir(challengeFilePath), 0o755)
if err != nil {
if err = os.MkdirAll(filepath.Dir(challengeFilePath), 0o755); err != nil {
return fmt.Errorf("无法在网站目录创建 HTTP 挑战所需的目录: %w", err)
}

err = os.WriteFile(challengeFilePath, []byte(challenge.KeyAuthorization), 0o644)
if err != nil {
if err = os.WriteFile(challengeFilePath, []byte(challenge.KeyAuthorization), 0o644); err != nil {
return fmt.Errorf("无法在网站目录创建 HTTP 挑战所需的文件: %w", err)
}

Expand All @@ -45,8 +43,7 @@ func (s httpSolver) CleanUp(_ context.Context, challenge acme.Challenge) error {
return nil
}

err := os.Remove(filepath.Join(s.path, challenge.HTTP01ResourcePath()))
if err != nil {
if err := os.Remove(filepath.Join(s.path, challenge.HTTP01ResourcePath())); err != nil {
return fmt.Errorf("无法删除 HTTP 挑战文件: %w", err)
}

Expand Down Expand Up @@ -167,7 +164,6 @@ func (s manualDNSSolver) Present(ctx context.Context, challenge acme.Challenge)
dnsName := challenge.DNS01TXTRecordName()
keyAuth := challenge.DNS01KeyAuthorization()

// 追加记录到 records 中
*s.records = append(*s.records, DNSRecord{
Key: dnsName,
Value: keyAuth,
Expand All @@ -177,7 +173,6 @@ func (s manualDNSSolver) Present(ctx context.Context, challenge acme.Challenge)
_, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()

// 等待信号以继续
<-s.controlChan
return nil
}
Expand Down

0 comments on commit c6f9a58

Please sign in to comment.