go install does not recognize “-o” flag

前端 未结 2 2042
别那么骄傲
别那么骄傲 2021-02-04 06:52

I\'m trying to do a go install and rename the output with the -o flag.

go install -o bar.exe src/foo.go

But this fai

2条回答
  •  不思量自难忘°
    2021-02-04 07:24

    You can fake the -o flag, if all you care about is the location, and not the name of the binary. Define GOBIN for the install command:

    GOBIN=`readlink -f my/location` go install some/persons/go-package
    

    Caveat: This doesn't work for cross-compiled binaries.

提交回复
热议问题