daemon/graphdriver/fsdiff.go:140:3: naked return in func `ApplyDiff` with 20 lines of code (nakedret)
return
^
daemon/graphdriver/fsdiff.go:149:3: naked return in func `ApplyDiff` with 20 lines of code (nakedret)
return
^
daemon/graphdriver/fsdiff.go:153:2: naked return in func `ApplyDiff` with 20 lines of code (nakedret)
return
^
daemon/graphdriver/fsdiff.go:164:3: naked return in func `DiffSize` with 15 lines of code (nakedret)
return
^
daemon/graphdriver/fsdiff.go:169:3: naked return in func `DiffSize` with 15 lines of code (nakedret)
return
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -137,7 +137,7 @@ func (gdw *NaiveDiffDriver) ApplyDiff(id, parent string, diff io.Reader) (size i |
| 137 | 137 |
// Mount the root filesystem so we can apply the diff/layer. |
| 138 | 138 |
layerRootFs, err := driver.Get(id, "") |
| 139 | 139 |
if err != nil {
|
| 140 |
- return |
|
| 140 |
+ return 0, err |
|
| 141 | 141 |
} |
| 142 | 142 |
defer driver.Put(id) |
| 143 | 143 |
|
| ... | ... |
@@ -145,28 +145,28 @@ func (gdw *NaiveDiffDriver) ApplyDiff(id, parent string, diff io.Reader) (size i |
| 145 | 145 |
options := &archive.TarOptions{IDMap: gdw.IDMap, BestEffortXattrs: gdw.BestEffortXattrs}
|
| 146 | 146 |
start := time.Now().UTC() |
| 147 | 147 |
log.G(context.TODO()).WithField("id", id).Debug("Start untar layer")
|
| 148 |
- if size, err = ApplyUncompressedLayer(layerFs, diff, options); err != nil {
|
|
| 149 |
- return |
|
| 148 |
+ appliedSize, err := ApplyUncompressedLayer(layerFs, diff, options) |
|
| 149 |
+ if err != nil {
|
|
| 150 |
+ return 0, err |
|
| 150 | 151 |
} |
| 151 | 152 |
log.G(context.TODO()).WithField("id", id).Debugf("Untar time: %vs", time.Now().UTC().Sub(start).Seconds())
|
| 152 |
- |
|
| 153 |
- return |
|
| 153 |
+ return appliedSize, nil |
|
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 | 156 |
// DiffSize calculates the changes between the specified layer |
| 157 | 157 |
// and its parent and returns the size in bytes of the changes |
| 158 | 158 |
// relative to its base filesystem directory. |
| 159 |
-func (gdw *NaiveDiffDriver) DiffSize(id, parent string) (size int64, err error) {
|
|
| 159 |
+func (gdw *NaiveDiffDriver) DiffSize(id, parent string) (size int64, _ error) {
|
|
| 160 | 160 |
driver := gdw.ProtoDriver |
| 161 | 161 |
|
| 162 | 162 |
changes, err := gdw.Changes(id, parent) |
| 163 | 163 |
if err != nil {
|
| 164 |
- return |
|
| 164 |
+ return 0, err |
|
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 | 167 |
layerFs, err := driver.Get(id, "") |
| 168 | 168 |
if err != nil {
|
| 169 |
- return |
|
| 169 |
+ return 0, err |
|
| 170 | 170 |
} |
| 171 | 171 |
defer driver.Put(id) |
| 172 | 172 |
|