29 lines
468 B
Go
29 lines
468 B
Go
|
package instruction
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
type update struct{}
|
||
|
|
||
|
func (d *update) Build(_args string) error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (d update) Exec(ctx ExecutionContext) ([]byte, error) {
|
||
|
|
||
|
// fetch packages
|
||
|
err := ctx.PackageManager.Fetch()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("cannot fetch packages | %s", err)
|
||
|
}
|
||
|
|
||
|
// update packages
|
||
|
err = ctx.PackageManager.Upgrade()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("cannot upgrade | %s", err)
|
||
|
}
|
||
|
|
||
|
return nil, nil
|
||
|
}
|