How to change Golang version on Tyk 4.x plugin compiler

Hi, I’m using Tyk 4.3.3 and currently developing a plugin. When the plugin is compiled using Tyk’s plugin compiler, it shows some error saying that some packages are not found:

+ go build -buildmode=plugin -o
AuthPlugin.go:15:2: cannot find package "" in any of:
        /usr/local/go/src/ (from $GOROOT)
        /go/src/ (from $GOPATH)
../ cannot find package "" in any of:
        /usr/local/go/src/ (from $GOROOT)
        /go/src/ (from $GOPATH)

after some research, I realized that those packages uses syntax that are only available on Go 1.18 or newer where Tyk’s plugin compiler ver 4.x uses Go version 1.16.15. is there a way to change the golang version on the plugin compiler without upgrading to Tyk 5.x?


I’m afraid not. As per

Runtime crashes are likely to occur unless all parts of the program 
(the application and all its plugins) are compiled using exactly the same
version of the toolchain, the same build tags, and the same values of 
certain flags and environment variables.

The gateway is open source so it would be possible to compile it locally and use that compiler to create your plugins however we don’t test the gateway against other golang versions so can’t tell what difference changing the compiler might bring.

I do know there there are changes in the way golang compilers deal with certificate CNs, SANs, expiry dates, default TLS versions so great care would have to be taken testing the resulting gateway binary.


Got it, thanks for the help!