Go plugin compilation error with 3rd party dependencies like go.mongodb.org/mongo-driver

I am trying to compile a plugin with mongo-driver. This is my go.mod file

module tyk-plugin

go 1.15

replace github.com/jensneuse/graphql-go-tools => github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20220722090845-cc0e21901879

require (
	github.com/TykTechnologies/tyk v1.9.2-0.20220816073138-6059d7624b2f
	go.mongodb.org/mongo-driver v1.10.1
)

Compilation steps for v4.0.5 with golang v1.15.15:

rm -rf go.mod go.sum vendor/
go mod init tyk-plugin
go mod edit -replace github.com/jensneuse/graphql-go-tools=github.com/TykTechnologies/[email protected]
go get github.com/TykTechnologies/[email protected]
go get go.mongodb.org/mongo-driver
go mod tidy
go mod vendor
docker container run -v $(pwd):/plugin-source --rm tykio/tyk-plugin-compiler:v4.0.5 plugin.so

I am getting this error:

❯ docker container run -v $(pwd):/plugin-source --rm tykio/tyk-plugin-compiler:v4.0.5 plugin.so
+ plugin_name=plugin.so
+ plugin_id=
+ PLUGIN_BUILD_PATH=/go/src/plugin_plugin
+ '[' -z plugin.so ']'
+ mkdir -p /go/src/plugin_plugin
+ yes
+ cp -r /plugin-source/go.mod /plugin-source/go.sum /plugin-source/plugin.go /plugin-source/tyk-plugin.so /plugin-source/vendor /go/src/plugin_plugin
+ cd /go/src/plugin_plugin
+ '[' -f go.mod ']'
+ '[' '!' -d ./vendor ']'
+ rm -rf go.mod
+ rm -rf /go/src/plugin_plugin/vendor/github.com/TykTechnologies/tyk
+ yes
+ cp -rf /go/src/plugin_plugin/vendor/github.com /go/src/plugin_plugin/vendor/go.mongodb.org /go/src/plugin_plugin/vendor/go.opentelemetry.io /go/src/plugin_plugin/vendor/go.uber.org /go/src/plugin_plugin/vendor/golang.org /go/src/plugin_plugin/vendor/gopkg.in /go/src/plugin_plugin/vendor/gorm.io /go/src/plugin_plugin/vendor/modules.txt /go/src/plugin_plugin/vendor/nhooyr.io /go/src
+ rm -rf /go/src/plugin_plugin/vendor
+ xargs -d '\n' rm -rf
+ sed 's|/go/src/github.com/TykTechnologies/tyk/vendor|/go/src|g'
+ ls -d /go/src/github.com/TykTechnologies/tyk/vendor/github.com/Jeffail/gabs /go/src/github.com/TykTechnologies/tyk/vendor/github.com/Jeffail/tunny /go/src/github.com/TykTechnologies/tyk/vendor/github.com/Masterminds/goutils /go/src/github.com/TykTechnologies/tyk/vendor/github.com/Masterminds/semver /go/src/github.com/TykTechnologies/tyk/vendor/github.com/Masterminds/sprig /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/again /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/circuitbreaker /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/drl /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/goautosocket /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/gojsonschema /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/gorpc /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/goverify /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/graphql-go-tools /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/leakybucket /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/murmur3 /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies/openid2go /go/src/github.com/TykTechnologies/tyk/vendor/github.com/akutz/memconn /go/src/github.com/TykTechnologies/tyk/vendor/github.com/alecthomas/template /go/src/github.com/TykTechnologies/tyk/vendor/github.com/alecthomas/units /go/src/github.com/TykTechnologies/tyk/vendor/github.com/andybalholm/brotli /go/src/github.com/TykTechnologies/tyk/vendor/github.com/armon/go-metrics /go/src/github.com/TykTechnologies/tyk/vendor/github.com/bshuster-repo/logrus-logstash-hook /go/src/github.com/TykTechnologies/tyk/vendor/github.com/buger/jsonparser /go/src/github.com/TykTechnologies/tyk/vendor/github.com/cenk/backoff /go/src/github.com/TykTechnologies/tyk/vendor/github.com/cenkalti/backoff /go/src/github.com/TykTechnologies/tyk/vendor/github.com/certifi/gocertifi /go/src/github.com/TykTechnologies/tyk/vendor/github.com/cespare/xxhash /go/src/github.com/TykTechnologies/tyk/vendor/github.com/clbanning/mxj /go/src/github.com/TykTechnologies/tyk/vendor/github.com/davecgh/go-spew /go/src/github.com/TykTechnologies/tyk/vendor/github.com/dgrijalva/jwt-go /go/src/github.com/TykTechnologies/tyk/vendor/github.com/dgryski/go-rendezvous /go/src/github.com/TykTechnologies/tyk/vendor/github.com/eclipse/paho.mqtt.golang /go/src/github.com/TykTechnologies/tyk/vendor/github.com/evalphobia/logrus_sentry /go/src/github.com/TykTechnologies/tyk/vendor/github.com/facebookgo/clock /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gemnasium/logrus-graylog-hook /go/src/github.com/TykTechnologies/tyk/vendor/github.com/getsentry/raven-go /go/src/github.com/TykTechnologies/tyk/vendor/github.com/go-redis/redis /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gobwas/httphead /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gobwas/pool /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gobwas/ws /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gocraft/health /go/src/github.com/TykTechnologies/tyk/vendor/github.com/golang/protobuf /go/src/github.com/TykTechnologies/tyk/vendor/github.com/golang/snappy /go/src/github.com/TykTechnologies/tyk/vendor/github.com/google/uuid /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gorilla/mux /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gorilla/websocket /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/consul /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/errwrap /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/go-cleanhttp /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/go-immutable-radix /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/go-multierror /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/go-retryablehttp /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/go-rootcerts /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/go-sockaddr /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/golang-lru /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/hcl /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/serf /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp/vault /go/src/github.com/TykTechnologies/tyk/vendor/github.com/huandu/xstrings /go/src/github.com/TykTechnologies/tyk/vendor/github.com/imdario/mergo /go/src/github.com/TykTechnologies/tyk/vendor/github.com/jensneuse/abstractlogger /go/src/github.com/TykTechnologies/tyk/vendor/github.com/jensneuse/byte-template /go/src/github.com/TykTechnologies/tyk/vendor/github.com/jensneuse/pipeline /go/src/github.com/TykTechnologies/tyk/vendor/github.com/jinzhu/inflection /go/src/github.com/TykTechnologies/tyk/vendor/github.com/jinzhu/now /go/src/github.com/TykTechnologies/tyk/vendor/github.com/justinas/alice /go/src/github.com/TykTechnologies/tyk/vendor/github.com/kelseyhightower/envconfig /go/src/github.com/TykTechnologies/tyk/vendor/github.com/klauspost/compress /go/src/github.com/TykTechnologies/tyk/vendor/github.com/konsorten/go-windows-terminal-sequences /go/src/github.com/TykTechnologies/tyk/vendor/github.com/lonelycode/go-uuid /go/src/github.com/TykTechnologies/tyk/vendor/github.com/lonelycode/osin /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mattn/go-colorable /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mattn/go-isatty /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mavricknz/asn1-ber /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mavricknz/ldap /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mgutz/ansi /go/src/github.com/TykTechnologies/tyk/vendor/github.com/miekg/dns /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mitchellh/copystructure /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mitchellh/go-homedir /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mitchellh/mapstructure /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mitchellh/reflectwalk /go/src/github.com/TykTechnologies/tyk/vendor/github.com/nats-io/nats.go /go/src/github.com/TykTechnologies/tyk/vendor/github.com/nats-io/nkeys /go/src/github.com/TykTechnologies/tyk/vendor/github.com/nats-io/nuid /go/src/github.com/TykTechnologies/tyk/vendor/github.com/newrelic/go-agent /go/src/github.com/TykTechnologies/tyk/vendor/github.com/nsf/jsondiff /go/src/github.com/TykTechnologies/tyk/vendor/github.com/opentracing/opentracing-go /go/src/github.com/TykTechnologies/tyk/vendor/github.com/openzipkin/zipkin-go /go/src/github.com/TykTechnologies/tyk/vendor/github.com/oschwald/maxminddb-golang /go/src/github.com/TykTechnologies/tyk/vendor/github.com/paulbellamy/ratecounter /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pierrec/lz4 /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pires/go-proxyproto /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pkg/errors /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pmezard/go-difflib /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pmylund/go-cache /go/src/github.com/TykTechnologies/tyk/vendor/github.com/qri-io/jsonpointer /go/src/github.com/TykTechnologies/tyk/vendor/github.com/qri-io/jsonschema /go/src/github.com/TykTechnologies/tyk/vendor/github.com/robertkrimen/otto /go/src/github.com/TykTechnologies/tyk/vendor/github.com/rs/cors /go/src/github.com/TykTechnologies/tyk/vendor/github.com/ryanuber/go-glob /go/src/github.com/TykTechnologies/tyk/vendor/github.com/satori/go.uuid /go/src/github.com/TykTechnologies/tyk/vendor/github.com/shopspring/decimal /go/src/github.com/TykTechnologies/tyk/vendor/github.com/sirupsen/logrus /go/src/github.com/TykTechnologies/tyk/vendor/github.com/spf13/afero /go/src/github.com/TykTechnologies/tyk/vendor/github.com/spf13/cast /go/src/github.com/TykTechnologies/tyk/vendor/github.com/square/go-jose /go/src/github.com/TykTechnologies/tyk/vendor/github.com/stretchr/testify /go/src/github.com/TykTechnologies/tyk/vendor/github.com/tidwall/gjson /go/src/github.com/TykTechnologies/tyk/vendor/github.com/tidwall/match /go/src/github.com/TykTechnologies/tyk/vendor/github.com/tidwall/pretty /go/src/github.com/TykTechnologies/tyk/vendor/github.com/tidwall/sjson /go/src/github.com/TykTechnologies/tyk/vendor/github.com/uber/jaeger-client-go /go/src/github.com/TykTechnologies/tyk/vendor/github.com/uber/jaeger-lib /go/src/github.com/TykTechnologies/tyk/vendor/github.com/valyala/bytebufferpool /go/src/github.com/TykTechnologies/tyk/vendor/github.com/valyala/fasthttp /go/src/github.com/TykTechnologies/tyk/vendor/github.com/x-cray/logrus-prefixed-formatter /go/src/github.com/TykTechnologies/tyk/vendor/github.com/xeipuuv/gojsonpointer /go/src/github.com/TykTechnologies/tyk/vendor/github.com/xeipuuv/gojsonreference /go/src/github.com/TykTechnologies/tyk/vendor/github.com/xeipuuv/gojsonschema /go/src/github.com/TykTechnologies/tyk/vendor/github.com/xenolf/lego
+ sed 's|/go/src/github.com/TykTechnologies/tyk/vendor|/go/src|g'
+ grep -v github
+ xargs -d '\n' rm -rf
+ ls -d /go/src/github.com/TykTechnologies/tyk/vendor/github.com/Jeffail /go/src/github.com/TykTechnologies/tyk/vendor/github.com/Masterminds /go/src/github.com/TykTechnologies/tyk/vendor/github.com/TykTechnologies /go/src/github.com/TykTechnologies/tyk/vendor/github.com/akutz /go/src/github.com/TykTechnologies/tyk/vendor/github.com/alecthomas /go/src/github.com/TykTechnologies/tyk/vendor/github.com/andybalholm /go/src/github.com/TykTechnologies/tyk/vendor/github.com/armon /go/src/github.com/TykTechnologies/tyk/vendor/github.com/bshuster-repo /go/src/github.com/TykTechnologies/tyk/vendor/github.com/buger /go/src/github.com/TykTechnologies/tyk/vendor/github.com/cenk /go/src/github.com/TykTechnologies/tyk/vendor/github.com/cenkalti /go/src/github.com/TykTechnologies/tyk/vendor/github.com/certifi /go/src/github.com/TykTechnologies/tyk/vendor/github.com/cespare /go/src/github.com/TykTechnologies/tyk/vendor/github.com/clbanning /go/src/github.com/TykTechnologies/tyk/vendor/github.com/davecgh /go/src/github.com/TykTechnologies/tyk/vendor/github.com/dgrijalva /go/src/github.com/TykTechnologies/tyk/vendor/github.com/dgryski /go/src/github.com/TykTechnologies/tyk/vendor/github.com/eclipse /go/src/github.com/TykTechnologies/tyk/vendor/github.com/evalphobia /go/src/github.com/TykTechnologies/tyk/vendor/github.com/facebookgo /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gemnasium /go/src/github.com/TykTechnologies/tyk/vendor/github.com/getsentry /go/src/github.com/TykTechnologies/tyk/vendor/github.com/go-redis /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gobwas /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gocraft /go/src/github.com/TykTechnologies/tyk/vendor/github.com/golang /go/src/github.com/TykTechnologies/tyk/vendor/github.com/google /go/src/github.com/TykTechnologies/tyk/vendor/github.com/gorilla /go/src/github.com/TykTechnologies/tyk/vendor/github.com/hashicorp /go/src/github.com/TykTechnologies/tyk/vendor/github.com/huandu /go/src/github.com/TykTechnologies/tyk/vendor/github.com/imdario /go/src/github.com/TykTechnologies/tyk/vendor/github.com/jensneuse /go/src/github.com/TykTechnologies/tyk/vendor/github.com/jinzhu /go/src/github.com/TykTechnologies/tyk/vendor/github.com/justinas /go/src/github.com/TykTechnologies/tyk/vendor/github.com/kelseyhightower /go/src/github.com/TykTechnologies/tyk/vendor/github.com/klauspost /go/src/github.com/TykTechnologies/tyk/vendor/github.com/konsorten /go/src/github.com/TykTechnologies/tyk/vendor/github.com/lonelycode /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mattn /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mavricknz /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mgutz /go/src/github.com/TykTechnologies/tyk/vendor/github.com/miekg /go/src/github.com/TykTechnologies/tyk/vendor/github.com/mitchellh /go/src/github.com/TykTechnologies/tyk/vendor/github.com/nats-io /go/src/github.com/TykTechnologies/tyk/vendor/github.com/newrelic /go/src/github.com/TykTechnologies/tyk/vendor/github.com/nsf /go/src/github.com/TykTechnologies/tyk/vendor/github.com/opentracing /go/src/github.com/TykTechnologies/tyk/vendor/github.com/openzipkin /go/src/github.com/TykTechnologies/tyk/vendor/github.com/oschwald /go/src/github.com/TykTechnologies/tyk/vendor/github.com/paulbellamy /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pierrec /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pires /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pkg /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pmezard /go/src/github.com/TykTechnologies/tyk/vendor/github.com/pmylund /go/src/github.com/TykTechnologies/tyk/vendor/github.com/qri-io /go/src/github.com/TykTechnologies/tyk/vendor/github.com/robertkrimen /go/src/github.com/TykTechnologies/tyk/vendor/github.com/rs /go/src/github.com/TykTechnologies/tyk/vendor/github.com/ryanuber /go/src/github.com/TykTechnologies/tyk/vendor/github.com/satori /go/src/github.com/TykTechnologies/tyk/vendor/github.com/shopspring /go/src/github.com/TykTechnologies/tyk/vendor/github.com/sirupsen /go/src/github.com/TykTechnologies/tyk/vendor/github.com/spf13 /go/src/github.com/TykTechnologies/tyk/vendor/github.com/square /go/src/github.com/TykTechnologies/tyk/vendor/github.com/stretchr /go/src/github.com/TykTechnologies/tyk/vendor/github.com/tidwall /go/src/github.com/TykTechnologies/tyk/vendor/github.com/uber /go/src/github.com/TykTechnologies/tyk/vendor/github.com/valyala /go/src/github.com/TykTechnologies/tyk/vendor/github.com/x-cray /go/src/github.com/TykTechnologies/tyk/vendor/github.com/xeipuuv /go/src/github.com/TykTechnologies/tyk/vendor/github.com/xenolf /go/src/github.com/TykTechnologies/tyk/vendor/go.opentelemetry.io/otel /go/src/github.com/TykTechnologies/tyk/vendor/go.uber.org/atomic /go/src/github.com/TykTechnologies/tyk/vendor/go.uber.org/multierr /go/src/github.com/TykTechnologies/tyk/vendor/go.uber.org/zap /go/src/github.com/TykTechnologies/tyk/vendor/golang.org/x /go/src/github.com/TykTechnologies/tyk/vendor/google.golang.org/appengine /go/src/github.com/TykTechnologies/tyk/vendor/google.golang.org/genproto /go/src/github.com/TykTechnologies/tyk/vendor/google.golang.org/grpc /go/src/github.com/TykTechnologies/tyk/vendor/google.golang.org/protobuf /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in/alecthomas /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in/mgo.v2 /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in/sourcemap.v1 /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in/square /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in/vmihailenco /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in/xmlpath.v2 /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in/yaml.v3 /go/src/github.com/TykTechnologies/tyk/vendor/gorm.io/gorm /go/src/github.com/TykTechnologies/tyk/vendor/nhooyr.io/websocket /go/src/github.com/TykTechnologies/tyk/vendor/rsc.io/letsencrypt
+ yes
+ cp -rf /go/src/github.com/TykTechnologies/tyk/vendor/github.com /go/src/github.com/TykTechnologies/tyk/vendor/go.opentelemetry.io /go/src/github.com/TykTechnologies/tyk/vendor/go.uber.org /go/src/github.com/TykTechnologies/tyk/vendor/golang.org /go/src/github.com/TykTechnologies/tyk/vendor/google.golang.org /go/src/github.com/TykTechnologies/tyk/vendor/gopkg.in /go/src/github.com/TykTechnologies/tyk/vendor/gorm.io /go/src/github.com/TykTechnologies/tyk/vendor/modules.txt /go/src/github.com/TykTechnologies/tyk/vendor/nhooyr.io /go/src/github.com/TykTechnologies/tyk/vendor/rsc.io /go/src
+ rm -rf /go/src/github.com/TykTechnologies/tyk/vendor
+ rm /go/src/modules.txt
+ GO111MODULE=off
+ go build -buildmode=plugin -o plugin.so
../go.mongodb.org/mongo-driver/x/mongo/driver/compression.go:17:2: cannot find package "github.com/klauspost/compress/zstd" in any of:
        /usr/local/go/src/github.com/klauspost/compress/zstd (from $GOROOT)
        /go/src/github.com/klauspost/compress/zstd (from $GOPATH)
../go.mongodb.org/mongo-driver/x/mongo/driver/ocsp/ocsp.go:24:2: cannot find package "golang.org/x/sync/errgroup" in any of:
        /usr/local/go/src/golang.org/x/sync/errgroup (from $GOROOT)
        /go/src/golang.org/x/sync/errgroup (from $GOPATH)

Any clue what am I doing wrong?

Also GitHub - TykTechnologies/tyk-build-env: Docker environment used to build official images and plugins repo is outdated although docker images published at Docker Hub are up to date. Kindly push latest code in tyk-build-env repo.

We also faced similar problems when compiling our plugins. The problem is that if your plugin uses some go dependencies which are also used by Tyk gateway, then there might be version incompatibilities. To address that, the Tyk devs have developed a ‘build.sh’ script to harmonize the versions. You can find the source of that script here: tyk/build.sh at master · TykTechnologies/tyk · GitHub

The problem is that this script contains some lines at the end to run go mod vendor and then delete and copy vendored dependencies from Tyk sources.

This is a script we use to compile plugins. It does not vendor dependencies, but uses go mod edit -replace to pin specific versions. You might still run into compilation issues (e.g. when your plugin does not work with a different version of specific modules), but at least the problems with deleting vendor directories should be resolved.

#!/usr/bin/env sh

# for any dependency also present in Tyk, change the module version to Tyk's version
go list -m -f '{{ if not .Main }}{{ .Path }} {{ .Version }}{{ end }}' all > /tmp/plugin-deps.txt
(cd $TYK_GW_PATH && go list -m -mod=mod -f '{{ if not .Main }}{{ .Path }} {{ .Version }}{{ end }}' all > /tmp/gw-deps.txt)
awk 'NR==FNR{seen[$1]=$2; next} seen[$1] { print $1 " " seen[$1] " " $2 }' /tmp/plugin-deps.txt /tmp/gw-deps.txt > /tmp/shared-deps.txt

while read PKG VER1 VER2 < /tmp/shared-deps.txt; do if [ $VER1 -ne $VER2 ]; then echo "$PKG $VER1 $VER2"; fi; done

awk 'NR==FNR{seen[$1]=$2; next} seen[$1] && seen[$1] != $2' /tmp/plugin-deps.txt /tmp/gw-deps.txt | while read PKG VER; do
  go mod edit [email protected]$VER
done

go build -buildmode=plugin -o my-plugin.so

The script assumes your plugin has a go.mod with the correct versions of Tyk and go-tools configured.

Hope this helps,
Barry

1 Like