golang 处理多个项目src编译问题 2.0
和之前那个版本区分开来,改了一下脚本代码,支持多个package
exportGOPATH=$HOME/pj/go02 exportPATH=$PATH:$GOPATH/bin exportGOBIN=$GOPATH/bin exportGOSRC=$GOPATH/src all: cd$GOPATH/src forfilein$GOPATH/src/* do iftest-d$file then echo ${file:(${#GOSRC}+1):${#file}} export PACKAGENAME=${file:(${#GOSRC}+1):${#file}} rm-rf $GOPATH/bin/$PACKAGENAME mkdir $GOPATH/bin/$PACKAGENAME forgofilein$file/*.go do iftest-f$gofile then exportGOBIN=$GOPATH/bin/$PACKAGENAME echo$gofile"isbuilding..." goinstall$gofile echo"done" fi done fi done run: #注释掉 :<<word forfilein$GOBIN/* do iftest-f$file then echo"build"$file"success" else echo"build"$file"Failed" fi done word