On rhel/centos 6 (x86_64)
Try building 6.0.35 or 7.0.5 Zabbix agent2 or any of the plugins and get an error.
# runtime/cgo cc1: warnings being treated as errors gcc_libinit.c: In function '_cgo_wait_runtime_init_done': gcc_libinit.c:51: error: implicit declaration of function '__atomic_load_n' gcc_libinit.c:51: error: '__ATOMIC_CONSUME' undeclared (first use in this function) gcc_libinit.c:51: error: (Each undeclared identifier is reported only once gcc_libinit.c:51: error: for each function it appears in.) gcc_libinit.c:78: error: implicit declaration of function '__atomic_store_n' gcc_libinit.c:78: error: '__ATOMIC_RELEASE' undeclared (first use in this function) gcc_libinit.c: In function 'x_cgo_notify_runtime_init_done': gcc_libinit.c:129: error: '__ATOMIC_RELEASE' undeclared (first use in this function) gcc_libinit.c: In function 'x_cgo_set_context_function': gcc_libinit.c:137: error: '__ATOMIC_RELEASE' undeclared (first use in this function) gcc_libinit.c: In function '_cgo_get_context_function': gcc_libinit.c:142: error: '__ATOMIC_CONSUME' undeclared (first use in this function) make[2]: *** [golang.zabbix.com/agent2/cmd/zabbix_agent2] Error 1 make[2]: Leaving directory `/tmp/build-rhel-6-x86_64.DSYAOldw/buildroot/BUILD/zabbix-6.0.35/src/go' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/build-rhel-6-x86_64.DSYAOldw/buildroot/BUILD/zabbix-6.0.35/src' make: *** [all-recursive] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.e23ISj (%build)
Agent2 as well as mongodb, postgresql and ember-plus plugins can be built with an older unsupported version of go 1.21.3.
For mssql a different error is produced
+ make go: downloading go1.22 (linux/amd64) go: download go1.22 for linux/amd64: toolchain not available go: downloading go1.22 (linux/amd64) go: download go1.22 for linux/amd64: toolchain not available GOOS="" GOARCH="" go build -o "/tmp/build-rhel-6-x86_64.91uTahlr/buildroot/BUILD/zabbix-agent2-plugin-mssql-6.0.35/zabbix-agent2-plugin-mssql" go: downloading go1.22 (linux/amd64) go: download go1.22 for linux/amd64: toolchain not available make: *** [build] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.IEfygF (%build)
In general it is suboptimal to use an old unsupported version of go.