Skip to content

Commit 7f06d14

Browse files
committed
embed file
1 parent 25315c3 commit 7f06d14

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
APT::Update::Error-Mode "any";

internal/update/apt/service.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package apt
1818
import (
1919
"bufio"
2020
"context"
21+
_ "embed"
2122
"fmt"
2223
"io"
2324
"iter"
@@ -175,16 +176,16 @@ func runUpdateCommand(ctx context.Context) error {
175176
return nil
176177
}
177178

178-
func getAptUpdateConfigFile() (*paths.Path, func(), error) {
179-
// Configure apt return error on any warning during update.
180-
configContent := []byte(`APT::Update::Error-Mode "any";`)
179+
//go:embed apt_update.config
180+
var aptUpdateConfig []byte
181181

182+
func getAptUpdateConfigFile() (*paths.Path, func(), error) {
182183
config, err := paths.MkTempFile(nil, "apt.config")
183184
if err != nil {
184185
return nil, nil, fmt.Errorf("cannot create apt config file: %w", err)
185186
}
186187

187-
if _, err = config.Write(configContent); err != nil {
188+
if _, err = config.Write(aptUpdateConfig); err != nil {
188189
return nil, nil, fmt.Errorf("cannot write temporary apt config file: %w", err)
189190
}
190191

0 commit comments

Comments
 (0)