@@ -120,27 +120,27 @@ func (ri RemoveImages) applyToStackDown(o *stackDownOptions) {
120
120
121
121
type ComposeStackReaders []io.Reader
122
122
123
- func (r ComposeStackReaders ) applyToComposeStack (o * composeStackOptions ) {
123
+ func (r ComposeStackReaders ) applyToComposeStack (o * composeStackOptions ) error {
124
124
f := make ([]string , len (r ))
125
125
baseName := "docker-compose-%d.yml"
126
126
for i , reader := range r {
127
127
tmp := os .TempDir ()
128
128
tmp = filepath .Join (tmp , strconv .FormatInt (time .Now ().UnixNano (), 10 ))
129
129
err := os .MkdirAll (tmp , 0755 )
130
130
if err != nil {
131
- panic ( err )
131
+ return fmt . Errorf ( "failed to create temporary directory: %w" , err )
132
132
}
133
133
134
134
name := fmt .Sprintf (baseName , i )
135
135
136
136
bs , err := io .ReadAll (reader )
137
137
if err != nil {
138
- panic ( err )
138
+ fmt . Errorf ( "failed to read from reader: %w" , err )
139
139
}
140
140
141
141
err = os .WriteFile (filepath .Join (tmp , name ), bs , 0644 )
142
142
if err != nil {
143
- panic ( err )
143
+ fmt . Errorf ( "failed to write to temporary file: %w" , err )
144
144
}
145
145
146
146
f [i ] = filepath .Join (tmp , name )
@@ -150,18 +150,22 @@ func (r ComposeStackReaders) applyToComposeStack(o *composeStackOptions) {
150
150
}
151
151
152
152
o .Paths = f
153
+
154
+ return nil
153
155
}
154
156
155
157
type ComposeStackFiles []string
156
158
157
- func (f ComposeStackFiles ) applyToComposeStack (o * composeStackOptions ) {
159
+ func (f ComposeStackFiles ) applyToComposeStack (o * composeStackOptions ) error {
158
160
o .Paths = f
161
+ return nil
159
162
}
160
163
161
164
type StackIdentifier string
162
165
163
- func (f StackIdentifier ) applyToComposeStack (o * composeStackOptions ) {
166
+ func (f StackIdentifier ) applyToComposeStack (o * composeStackOptions ) error {
164
167
o .Identifier = string (f )
168
+ return nil
165
169
}
166
170
167
171
func (f StackIdentifier ) String () string {
0 commit comments