Document updated on Oct 25, 2024
Check dependencies of plugins
Plugins rely on specific versions of Go, libraries, or system architecture and can face compatibility issues following updates or modifications.
The krakend check-plugin command helps you validate the dependencies used by your plugins, which will determine whether the plugin is compatible, and because of this, you can use the command without providing access to the source code other than the go.sum file.
To get started writing your plugins, see:
Usage of check-plugin
The command compares your plugin’s go.sum file with the libraries initially used to compile the running binary. If there are any incompatibilities between your plugin and KrakenD, a detailed list will be shown.
If you integrate this command as part of your CI/CD pipeline or Dockerfile build, it will exit with a status code 0 when the libraries of your plugin are compatible with KrakenD and with a status code 1 when they are not.
If you want to test that a compiled plugin works (it loads), you can use the test-plugin command once you have it compiled.
The krakend check-plugin command accepts the following options:
Usage of KrakenD check
$krakend check-plugin -h
╓▄█                          ▄▄▌                               ╓██████▄µ
▐███  ▄███╨▐███▄██H╗██████▄  ║██▌ ,▄███╨ ▄██████▄  ▓██▌█████▄  ███▀╙╙▀▀███╕
▐███▄███▀  ▐█████▀"╙▀▀"╙▀███ ║███▄███┘  ███▀""▀███ ████▀╙▀███H ███     ╙███
▐██████▌   ▐███⌐  ,▄████████M║██████▄  ║██████████M███▌   ███H ███     ,███
▐███╨▀███µ ▐███   ███▌  ,███M║███╙▀███  ███▄```▄▄` ███▌   ███H ███,,,╓▄███▀
▐███  ╙███▄▐███   ╙█████████M║██▌  ╙███▄`▀███████╨ ███▌   ███H █████████▀
                     ``                     `'`
Version: 2.8
Validates that the active configuration file has a valid syntax to run the service.
Change the configuration file by using the --config flag
Usage:
  krakend check-plugin [flags]
Examples:
krakend check-plugin -g 1.17.0 -s ./go.sum
Flags:
  -f, --format        Dump the commands to update
  -g, --go string     The version of the go compiler used for your plugin (default "1.17.11")
  -h, --help          help for check-plugin
  -l, --libc string   Version of the libc library used
  -s, --sum string    Path to the go.sum file to analize (default "./go.sum")Flags
Use krakend check-plugin in combination with the following flags:
- -for- --formatto let KrakenD suggest you about the- go getcommands you should launch.
- -sor- --sumto specify the path to the- go.sumfile of your plugin.
- -gor- --goto specify the Go version you are using to compile the plugin.
- -lor- --libcto specify the libc version installed in the system. The libc version must have the prefix- MUSL-,- GLIBC-, and- DARWIN-. For instance, a plugin in Mac Monterrey might use- DARWIN-12.2.1, an Alpine container will need something like- MUSL-1.2.2, and a Linux box will have- GLIBC-2.32. To know your glibc version execute the Find GLIBC script. When there are incompatibilites because the operating system is different, but the libraries (glibc or musl) are in the exact same version, it is safe to ignore them.
Checking a failing plugin example
$krakend check-plugin --go 1.17.7 --libc MUSL-1.2.2 --sum ../plugin-tools/go.sum
15 incompatibility(ies) found...
go
    have: 1.17.0
    want: 1.16.4
libc
    have: MUSL-1.2.2
    want: GLIBC-2.31
github.com/gin-gonic/gin
    have: v1.6.3
    want: v1.7.7
github.com/go-playground/locales
    have: v0.13.0
    want: v0.14.0
github.com/go-playground/universal-translator
    have: v0.17.0
    want: v0.18.0
github.com/go-playground/validator/v10
    have: v10.2.0
    want: v10.9.0
github.com/golang/protobuf
    have: v1.3.3
    want: v1.5.2
github.com/json-iterator/go
    have: v1.1.9
    want: v1.1.12
github.com/leodido/go-urn
    have: v1.2.0
    want: v1.2.1
github.com/mattn/go-isatty
    have: v0.0.12
    want: v0.0.14
github.com/modern-go/concurrent
    have: v0.0.0-20180228061459-e0a39a4cb421
    want: v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/reflect2
    have: v0.0.0-20180701023420-4b7aa43c6742
    want: v1.0.2
github.com/ugorji/go/codec
    have: v1.1.7
    want: v1.2.6
golang.org/x/sys
    have: v0.0.0-20200116001909-b77594299b42
    want: v0.0.0-20211004093028-2c5d950f24ef
golang.org/x/text
    have: v0.3.2
    want: v0.3.7Updating plugin dependencies
A quick attempt to fix your dependencies is to run the command with the -f flag, which will suggest a series of go get commands that you can execute to solve the incompatibilities. For instance:
Fixing dependencies
$krakend check-plugin -s ~/Downloads/go.sum -f 12 incompatibility(ies) found... go get cloud.google.com/go/[email protected] go get github.com/census-instrumentation/[email protected] go get github.com/google/[email protected]+incompatible go get github.com/googleapis/gax-go/[email protected] go get github.com/hashicorp/[email protected] go get golang.org/x/[email protected] go get golang.org/x/[email protected] go get golang.org/x/[email protected] go get golang.org/x/[email protected] go get google.golang.org/[email protected] go get google.golang.org/[email protected] go get google.golang.org/[email protected]
Copy and paste your terminal’s go get commands to update the dependencies. The commands are in alphabetical order.
You might need to use the -f several times and use go mod tidy as well.

