use viper to get value of debug flag
This commit is contained in:
parent
4ad2bc3fd7
commit
c82e61dcfe
@ -46,11 +46,7 @@ goc build -- -ldflags "-extldflags -static" -tags="embed kodo"
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
gocBuild := build.NewBuild(buildFlags, packages, buildOutput)
|
||||
// remove temporary directory if needed
|
||||
defer func() {
|
||||
if !debugGoc {
|
||||
gocBuild.Clean()
|
||||
}
|
||||
}()
|
||||
defer gocBuild.Clean()
|
||||
// doCover with original buildFlags, with new GOPATH( tmp:original )
|
||||
// in the tmp directory
|
||||
cover.Execute(buildFlags, gocBuild.NewGOPATH, gocBuild.TmpDir, mode, center)
|
||||
|
@ -43,11 +43,7 @@ goc build --buildflags="-ldflags '-extldflags -static' -tags='embed kodo'"
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
gocBuild := build.NewInstall(buildFlags, packages)
|
||||
// remove temporary directory if needed
|
||||
defer func() {
|
||||
if !debugGoc {
|
||||
gocBuild.Clean()
|
||||
}
|
||||
}()
|
||||
defer gocBuild.Clean()
|
||||
// doCover with original buildFlags, with new GOPATH( tmp:original )
|
||||
// in the tmp directory
|
||||
cover.Execute(buildFlags, gocBuild.NewGOPATH, gocBuild.TmpDir, mode, center)
|
||||
|
@ -39,11 +39,7 @@ goc run .
|
||||
gocBuild := build.NewBuild(buildFlags, packages, buildOutput)
|
||||
gocBuild.GoRunExecFlag = goRunExecFlag
|
||||
gocBuild.GoRunArguments = goRunArguments
|
||||
defer func() {
|
||||
if !debugGoc {
|
||||
gocBuild.Clean()
|
||||
}
|
||||
}()
|
||||
defer gocBuild.Clean()
|
||||
// start goc server
|
||||
var l = newLocalListener()
|
||||
go cover.GocServer(ioutil.Discard).RunListener(l)
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
|
||||
"github.com/qiniu/goc/pkg/cover"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func (b *Build) MvProjectsToTmp() {
|
||||
@ -155,5 +156,8 @@ func (b *Build) findWhereToInstall() string {
|
||||
|
||||
// Clean clears up the temporary workspace
|
||||
func (b *Build) Clean() error {
|
||||
if !viper.GetBool("debug") {
|
||||
return os.RemoveAll(b.TmpDir)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -26,9 +26,8 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"golang.org/x/tools/cover"
|
||||
"k8s.io/test-infra/gopherage/pkg/cov"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user