File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,9 @@ func (g *Generator) SetHostname(s string) {
237237
238238// ClearAnnotations clears g.spec.Annotations.
239239func (g * Generator ) ClearAnnotations () {
240- g .initSpec ()
240+ if g .spec == nil {
241+ return
242+ }
241243 g .spec .Annotations = make (map [string ]string )
242244}
243245
@@ -317,7 +319,9 @@ func (g *Generator) SetProcessArgs(args []string) {
317319
318320// ClearProcessEnv clears g.spec.Process.Env.
319321func (g * Generator ) ClearProcessEnv () {
320- g .initSpec ()
322+ if g .spec == nil {
323+ return
324+ }
321325 g .spec .Process .Env = []string {}
322326}
323327
@@ -329,7 +333,9 @@ func (g *Generator) AddProcessEnv(env string) {
329333
330334// ClearProcessAdditionalGids clear g.spec.Process.AdditionalGids.
331335func (g * Generator ) ClearProcessAdditionalGids () {
332- g .initSpec ()
336+ if g .spec == nil {
337+ return
338+ }
333339 g .spec .Process .User .AdditionalGids = []uint32 {}
334340}
335341
You can’t perform that action at this time.
0 commit comments