You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added github.com/TykTechnologies/tyk as a git submodule in vendor/github.com/TykTechnologies/tyk.
Checked out the exact same commit in the git submodule as the Tyk binary I am using.
Build my Tyk plugin.
Load my Tyk plugin.
Query HTTP request context info for the metadata that Tyk provides to plugins.
Dump this HTTP request context info to stdout.
What did you expect to see?
A Tyk API definition.
What did you see instead?
The context value is uncastable.
The context key produces a nil value.
I tried Go 1.12, 1.13, and 1.14 with no apparent change in behavior.
I replaced the git submodule with a direct cp -r from the $GOPATH/src/... to vendor/..., with no change in behavior.
I tried all the available GO111MODULE values, with largely no effect. Other than flat out breaking compilation when set to on.
Making sure to use the same environment variables, build flags, host OS for both the Tyk binary and the Tyk plugin.
Workaround
For now, the only way I can consistently work around this struct and iota context key corruption, is to stop vendor/ing my library dependency, and manage the dependency with pure go get... in $GOPATH/src
It's almost as if Go earmarks vendored dependencies differently in the namespace / type system, when comparing Context keys and when casting generic interface{}'s to a more specific type.
The text was updated successfully, but these errors were encountered:
I tried all the available GO111MODULE values, with largely no effect. Other than flat out breaking compilation when set to on.
That's the thing to fix, though.
It's almost as if Go earmarks vendored dependencies differently in the namespace / type system, when comparing Context keys and when casting generic interface{}'s to a more specific type.
In GOPATH mode, the go command treats each vendored copy of a package as a distinct package with its own identity, so the types and values defined in those packages (including when used as context keys) are also distinct.
That is one of the problems that module mode was designed to fix, so the fix here is “use module mode”.
(There may be other issues in using module mode, but if so we should fix those issues — please file them separately. Module mode is the fix for the bad vendor behavior in GOPATH mode.)
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Not sure.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
A Tyk API definition.
What did you see instead?
The context value is uncastable.
The context key produces a nil value.
I tried Go 1.12, 1.13, and 1.14 with no apparent change in behavior.
I replaced the git submodule with a direct
cp -r
from the$GOPATH/src/
... tovendor/
..., with no change in behavior.I tried all the available GO111MODULE values, with largely no effect. Other than flat out breaking compilation when set to on.
Making sure to use the same environment variables, build flags, host OS for both the Tyk binary and the Tyk plugin.
Workaround
For now, the only way I can consistently work around this struct and iota context key corruption, is to stop
vendor/
ing my library dependency, and manage the dependency with purego get
... in$GOPATH/src
It's almost as if Go earmarks vendored dependencies differently in the namespace / type system, when comparing Context keys and when casting generic
interface{}
's to a more specific type.The text was updated successfully, but these errors were encountered: