Thank you Dave, I think go build would create the dir `pkg-1` during the building, but it didn't.
My problem is `how to recompile all the source code`, and after a discussion at https://forum.golangbridge.org/t/pkgdir-option-does-not-work-with-go-get-command/5020/ it becomes to another: is `-pkgdir` really a available option? -- This email address (zhuo.dev<at>gmail.com) is only for development affairs, e.g. mail list, please mail to zhuo<at>hexoasis.com or zhuoql<at>zoho.com for other purpose. ZHUO QL (KDr2), http://kdr2.com On Fri, Mar 31, 2017 at 2:10 PM, Dave Cheney <d...@cheney.net> wrote: > > > On Friday, 31 March 2017 16:58:15 UTC+11, KDr2 (ZHUO QL) wrote: >> >> My go workspace is simple: >> >> >> [000]kdr2@Debian-X230:~/gows$ pwd >> /home/kdr2/gows >> [000]kdr2@Debian-X230:~/gows$ tree >> . >> └── src >> └── test >> └── m.go >> >> 2 directories, 1 file >> >> >> And the content of m.go is from https://raw.githubusercontent. >> com/facebookgo/grace/master/gracedemo/demo.go . All ENV variables are >> set. >> >> When I run go get -v -x test, all goes well, it downloads the >> dependencies and build out an executable. But when I run go get -v -x >> -pkgdir pkg-1 test, it leads to an error: >> >> >> ... >> mkdir -p $WORK/net/http/_obj/ >> cd /usr/local/go-1.8/src/net/http >> /usr/local/go-1.8/pkg/tool/linux_amd64/compile -o $WORK/net/http.a -trimpath >> $WORK -p net/http -complete -buildid >> 49a4487ab4c506c0ef8aa1f5f4ceea3fc8b1243d -importmap >> golang_org/x/net/http2/hpack=vendor/golang_org/x/net/http2/hpack -importmap >> golang_org/x/net/idna=vendor/golang_org/x/net/idna -importmap >> golang_org/x/net/lex/httplex=vendor/golang_org/x/net/lex/httplex -importmap >> golang_org/x/text/unicode/norm=vendor/golang_org/x/text/unicode/norm >> -importmap golang_org/x/text/width=vendor/golang_org/x/text/width -D >> _/usr/local/go-1.8/src/net/http -I $WORK -I pkg-1 -pack ./client.go >> ./cookie.go ./doc.go ./filetransport.go ./fs.go ./h2_bundle.go ./header.go >> ./http.go ./jar.go ./method.go ./request.go ./response.go ./server.go >> ./sniff.go ./status.go ./transfer.go ./transport.go >> cp $WORK/net/http.a pkg-1/net/http.agithub.com/facebookgo/httpdown >> mkdir -p $WORK/github.com/facebookgo/httpdown/_obj/ >> cd /home/kdr2/gows/src/github.com/facebookgo/httpdown >> /usr/local/go-1.8/pkg/tool/linux_amd64/compile >> <http://github.com/facebookgo/httpdown/usr/local/go-1.8/pkg/tool/linux_amd64/compile> >> -o $WORK/github.com/facebookgo/httpdown.a -trimpath $WORK -p >> github.com/facebookgo/httpdown -complete -buildid >> 45d38b6b6de48eff9fe8461b5764b769ea669b4c -D >> _/home/kdr2/gows/src/github.com/facebookgo/httpdown -I $WORK -I pkg-1 -pack >> ./httpdown.go >> # github.com/facebookgo/httpdown >> src/github.com/facebookgo/httpdown/httpdown.go:16 >> <http://github.com/facebookgo/httpdownsrc/github.com/facebookgo/httpdown/httpdown.go:16>: >> can't find import: "github.com/facebookgo/clock" >> [002]kdr2@Debian-X230:~/gows$ >> >> >> When I run go build -v -x -pkgdir pkg-1 test, the executable can be >> built well, but it does not create a pkg-1 dir to place the tmp files. >> > > go build builds packages, then throws them away. I think that is why there > is nothing written to the pkg-1 directory. > > >> So, my question is, how to use -pkgdir with go get and go build? does >> -pkgdir work as what its document says? >> > > What are you trying to do? Can you explain the problem you're trying to > solve, maybe someone can suggest a different solution. > > >> Thanks. >> -- >> This email address (zhuo.dev<at>gmail.com) is only for development >> affairs, e.g. mail list, please mail to zhuo<at>hexoasis.com or >> zhuoql<at>zoho.com for other purpose. >> >> ZHUO QL (KDr2), http://kdr2.com >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.