Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: unclear how to reference a package under test from a plugin #37618

Open
gonzojive opened this issue Mar 3, 2020 · 1 comment
Open
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gonzojive
Copy link

Testing interactions between a plugin and a package under test is complicated.

What version of Go are you using (go version)?

$ go version
go version go1.14 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/red/.cache/go-build"
GOENV="/home/red/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/red/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/red/git/go_example_failed_plugin_test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build817699318=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Tried to reference the package being tested by go test from a plugin. It's unclear how to do this, and thus how to test interactions between plugins and packages being tested.

Reproduction is here:
https://github.com/gonzojive/go_example_failed_plugin_test

git clone https://github.com/gonzojive/go_example_failed_plugin_test
cd go_example_failed_plugin_test
go test codeloader/*.go

What did you expect to see?

All tests should pass

What did you see instead?

$  go test codeloader/*.go
will reference project root "/home/red/git/go_example_failed_plugin_test" when compiling pluginsThe code was loaded!--- FAIL: TestConfig_CompileAndLoadCompileTimeCode (1.21s)
    --- FAIL: TestConfig_CompileAndLoadCompileTimeCode/show_example_of_interaction_of_a_plugin_with_a_non-test_package#01 (0.59s)
        codeloader_test.go:144: manipulates RegisteredPlugins: got [], want ["interaction confirmed"]
FAIL
FAIL    command-line-arguments  1.223s
FAIL
@dmitshur dmitshur changed the title Unclear how to reference a package under test from a plugin plugin: unclear how to reference a package under test from a plugin Mar 3, 2020
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 3, 2020
@dmitshur dmitshur added this to the Backlog milestone Mar 3, 2020
@dmitshur
Copy link
Contributor

dmitshur commented Mar 3, 2020

/cc @ianlancetaylor @cherrymui per owners.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

3 participants