Skip to content

Commit eb9515f

Browse files
committed
this error is mainly ignored, and I think it would be better to panic in this case
1 parent 8600c4c commit eb9515f

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

packer/registry/image/image.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ func FromArtifact(a packer.Artifact, opts ...ArtifactOverrideFunc) (*Image, erro
118118
// used to override the ProviderName for an existing Image.
119119
func WithProvider(name string) func(*Image) error {
120120
return func(img *Image) error {
121-
if img == nil {
122-
return errors.New("no go on empty image")
123-
}
124-
125121
img.ProviderName = name
126122
return nil
127123
}
@@ -131,10 +127,6 @@ func WithProvider(name string) func(*Image) error {
131127
// used to override the ImageId for an existing Image.
132128
func WithID(id string) func(*Image) error {
133129
return func(img *Image) error {
134-
if img == nil {
135-
return errors.New("no go on empty image")
136-
}
137-
138130
img.ImageID = id
139131
return nil
140132
}
@@ -144,10 +136,6 @@ func WithID(id string) func(*Image) error {
144136
// used to override the SourceImageId for an existing Image.
145137
func WithSourceID(id string) func(*Image) error {
146138
return func(img *Image) error {
147-
if img == nil {
148-
return errors.New("no go on empty image")
149-
}
150-
151139
img.SourceImageID = id
152140
return nil
153141
}
@@ -157,10 +145,6 @@ func WithSourceID(id string) func(*Image) error {
157145
// used to override the ProviderRegion for an existing Image.
158146
func WithRegion(region string) func(*Image) error {
159147
return func(img *Image) error {
160-
if img == nil {
161-
return errors.New("no go on empty image")
162-
}
163-
164148
img.ProviderRegion = region
165149
return nil
166150
}

0 commit comments

Comments
 (0)