1
0
mirror of https://github.com/golang/go synced 2024-10-03 21:21:22 -06:00
go/misc/cgo/testplugin/test.bash
David Crawshaw d0e408334b cmd/link: support plugins with no exported symbols
A plugin with no exported symbols is still potentially very useful.
Its init functions are called on load, and it so it can have visible
side effects.

Fixes #17681

Change-Id: Icdca31f48e5ab13c99020a2ef724f3de47dcd74b
Reviewed-on: https://go-review.googlesource.com/32437
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-01 20:56:30 +00:00

31 lines
679 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2016 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
set -e
if [ ! -f src/host/host.go ]; then
cwd=$(pwd)
echo "misc/cgo/testplugin/test.bash is running in $cwd" 1>&2
exit 1
fi
goos=$(go env GOOS)
goarch=$(go env GOARCH)
function cleanup() {
rm -rf plugin1.so host pkg sub
}
trap cleanup EXIT
rm -rf pkg sub
mkdir sub
GOPATH=$(pwd) go build -buildmode=plugin plugin1
GOPATH=$(pwd) go build -buildmode=plugin plugin2
GOPATH=$(pwd) go build -buildmode=plugin -o=sub/plugin1.so sub/plugin1
GOPATH=$(pwd) go build host
LD_LIBRARY_PATH=$(pwd) ./host