Rename the methods to match my understanding of the behaviour.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
| ... | ... |
@@ -189,7 +189,7 @@ func from(b *Builder, args []string, attributes map[string]bool, original string |
| 189 | 189 |
return err |
| 190 | 190 |
} |
| 191 | 191 |
b.resetImageCache() |
| 192 |
- if _, err := b.imageContexts.new(ctxName, true); err != nil {
|
|
| 192 |
+ if _, err := b.imageContexts.add(ctxName); err != nil {
|
|
| 193 | 193 |
return err |
| 194 | 194 |
} |
| 195 | 195 |
|
| ... | ... |
@@ -846,11 +846,7 @@ func mountByRef(b *Builder, name string) (*imageMount, error) {
|
| 846 | 846 |
if err != nil {
|
| 847 | 847 |
return nil, err |
| 848 | 848 |
} |
| 849 |
- im, err := b.imageContexts.new("", false)
|
|
| 850 |
- if err != nil {
|
|
| 851 |
- return nil, err |
|
| 852 |
- } |
|
| 853 |
- im.id = image.ImageID() |
|
| 849 |
+ im := b.imageContexts.newImageMount(image.ImageID()) |
|
| 854 | 850 |
return im, nil |
| 855 | 851 |
} |
| 856 | 852 |
|
| ... | ... |
@@ -22,7 +22,11 @@ type imageContexts struct {
|
| 22 | 22 |
currentName string |
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 |
-func (ic *imageContexts) new(name string, increment bool) (*imageMount, error) {
|
|
| 25 |
+func (ic *imageContexts) newImageMount(id string) *imageMount {
|
|
| 26 |
+ return &imageMount{ic: ic, id: id}
|
|
| 27 |
+} |
|
| 28 |
+ |
|
| 29 |
+func (ic *imageContexts) add(name string) (*imageMount, error) {
|
|
| 26 | 30 |
im := &imageMount{ic: ic}
|
| 27 | 31 |
if len(name) > 0 {
|
| 28 | 32 |
if ic.byName == nil {
|
| ... | ... |
@@ -33,10 +37,8 @@ func (ic *imageContexts) new(name string, increment bool) (*imageMount, error) {
|
| 33 | 33 |
} |
| 34 | 34 |
ic.byName[name] = im |
| 35 | 35 |
} |
| 36 |
- if increment {
|
|
| 37 |
- ic.list = append(ic.list, im) |
|
| 38 |
- } |
|
| 39 | 36 |
ic.currentName = name |
| 37 |
+ ic.list = append(ic.list, im) |
|
| 40 | 38 |
return im, nil |
| 41 | 39 |
} |
| 42 | 40 |
|