Build CLI

This commit is contained in:
Sung Won Cho 2022-04-29 20:31:38 +10:00
commit cf08ca836a
3 changed files with 15 additions and 8 deletions

1
go.mod
View file

@ -6,6 +6,7 @@ require (
github.com/PuerkitoBio/goquery v1.6.0 // indirect
github.com/andybalholm/cascadia v1.2.0 // indirect
github.com/aymerick/douceur v0.2.0
github.com/crazy-max/xgo v0.14.1 // indirect
github.com/dnote/actions v0.2.0
github.com/dnote/color v1.7.0
github.com/gobuffalo/packr/v2 v2.8.1

2
go.sum
View file

@ -72,6 +72,8 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/crazy-max/xgo v0.14.1 h1:f2VWvoxInGBhnfMhd0tF/plwSTUDSyCoCAJaYaGOWdA=
github.com/crazy-max/xgo v0.14.1/go.mod h1:m/aqfKaN/cYzfw+Pzk7Mk0tkmShg3/rCS4Zdhdugi4o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=

View file

@ -19,9 +19,13 @@ projectDir="$dir/../.."
basedir="$projectDir/pkg/cli"
outputDir="$projectDir/build/cli"
# xgo has issues when using modules
# https://github.com/karalabe/xgo/issues/176
# bypass it by copying the project inside a GOPATH
echo "projectDir: $projectDir"
echo "basedir: $basedir"
echo "outputDir: $projectDir"
xgo has issues when using modules
https://github.com/karalabe/xgo/issues/176
bypass it by copying the project inside a GOPATH
goPathBasedir="$GOPATH/src/github.com/dnote/dnote"
command_exists () {
@ -41,7 +45,7 @@ if [[ $1 == v* ]]; then
exit 1
fi
goVersion=1.13.x
goVersion=1.18.x
get_binary_name() {
platform=$1
@ -77,10 +81,10 @@ build() {
else
xgo \
-go "$goVersion" \
--targets="$platform/$arch" \
-targets="$platform/$arch" \
-ldflags "$ldflags" \
--tags "$tags" \
--dest="$destDir" \
-tags "$tags" \
-dest="$destDir" \
-x \
-v \
"$goPathBasedir/pkg/cli"
@ -106,7 +110,7 @@ build() {
if [ -z "$GOOS" ] && [ -z "$GOARCH" ]; then
# fetch tool
go get -u github.com/dnote/xgo
# go get -u github.com/dnote/xgo
rm -rf "$GOPATH/src/github.com/dnote/dnote"
cp -R "$projectDir" "$goPathBasedir"