github.com/dannin/go@v0.0.0-20161031215817-d35dfd405eaa/misc/cgo/testplugin/test.bash (about) 1 #!/usr/bin/env bash 2 # Copyright 2016 The Go Authors. All rights reserved. 3 # Use of this source code is governed by a BSD-style 4 # license that can be found in the LICENSE file. 5 6 set -e 7 8 if [ ! -f src/host/host.go ]; then 9 cwd=$(pwd) 10 echo "misc/cgo/testplugin/test.bash is running in $cwd" 1>&2 11 exit 1 12 fi 13 14 goos=$(go env GOOS) 15 goarch=$(go env GOARCH) 16 17 function cleanup() { 18 rm -rf plugin1.so host pkg sub 19 } 20 trap cleanup EXIT 21 22 rm -rf pkg sub 23 mkdir sub 24 25 GOPATH=$(pwd) go build -buildmode=plugin plugin1 26 GOPATH=$(pwd) go build -buildmode=plugin -o=sub/plugin1.so sub/plugin1 27 GOPATH=$(pwd) go build host 28 29 LD_LIBRARY_PATH=$(pwd) ./host