48 lines
875 B
Go
48 lines
875 B
Go
|
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||
|
// Use of this source code is governed by the GPL 3.0
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"go.wit.com/log"
|
||
|
)
|
||
|
|
||
|
func doBuild() error {
|
||
|
v := []string{}
|
||
|
if argv.Verbose {
|
||
|
v = []string{"-v", "-x"}
|
||
|
}
|
||
|
|
||
|
gopath := argv.Build
|
||
|
|
||
|
repo := me.forge.FindByGoPath(gopath)
|
||
|
if repo == nil {
|
||
|
return fmt.Errorf("rep not found: %s", gopath)
|
||
|
}
|
||
|
if err := me.forge.Build(repo, v); err != nil {
|
||
|
log.Warn("Build failed:", repo.GetGoPath(), err)
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func doInstall() error {
|
||
|
v := []string{}
|
||
|
if argv.Verbose {
|
||
|
v = []string{"-v", "-x"}
|
||
|
}
|
||
|
|
||
|
gopath := argv.Install
|
||
|
repo := me.forge.FindByGoPath(gopath)
|
||
|
if repo == nil {
|
||
|
return fmt.Errorf("rep not found: %s", gopath)
|
||
|
}
|
||
|
if err := me.forge.Install(repo, v); err != nil {
|
||
|
log.Warn("Install failed", repo.GetGoPath(), err)
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|