Trying to build K6 with Prometheus extension

Hi there!

I’m following the instructions on Prometheus for install.

I’ve done
> go get go.k6.io/xk6/cmd/xk6@latest

> $ env | grep GO
GOBIN=/home/arun/go/bin
GO111MODULE=on
GOPATH=/home/arun/go

The build fails with

xk6 build --with github.com/grafana/xk6-output-prometheus-remote
2022/08/01 11:23:10 [INFO] Temporary folder: /tmp/buildenv_2022-08-01-1123.653409817
2022/08/01 11:23:10 [INFO] Initializing Go module
2022/08/01 11:23:10 [INFO] exec (timeout=10s): /usr/bin/go mod init k6
go: creating new go.mod: module k6
2022/08/01 11:23:10 [INFO] Pinning versions
2022/08/01 11:23:10 [INFO] exec (timeout=0s): /usr/bin/go mod edit -require github.com/grafana/xk6-output-prometheus-remote@latest
2022/08/01 11:23:10 [INFO] exec (timeout=0s): /usr/bin/go mod tidy -compat=1.17
flag provided but not defined: -compat
usage: go mod tidy [-v]
Run 'go help mod tidy' for details.
2022/08/01 11:23:10 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-08-01-1123.653409817
2022/08/01 11:23:10 [FATAL] exit status 2

hi @arunxls , welcome to the community forum :tada:

This seems like an error due to you using go version before 1.17 and I am not even certain k6 supports that t o begin with.

You can check your go version by running go version.

hi @mstoykov You are right, upgrading fixed it, thank you :slight_smile:

1 Like