0

我试图构建一个go需要的源代码,go-systemd我在源包中看到go.mod 文件go-systemd中也提到了该版本。github.com/coreos/go-systemd/v22 v22.0.0但是当我运行go get -u源代码时。它失败并出现错误,我看到在v22.2.0.

pkg/mod/github.com/coreos/go-systemd/v22@v22.2.0/sdjournal/journal.go:1160:2: could not determine kind of name for C.my_sd_id128_to_string
cgo: 
gcc errors for preamble:
pkg/mod/github.com/coreos/go-systemd/v22@v22.2.0/sdjournal/journal.go:313:60: error: '_SD_ARRAY_STATIC' undeclared here (not in a function)
 // my_sd_id128_to_string(void *f, sd_id128_t boot_id, char s[_SD_ARRAY_STATIC SD_ID128_STRING_MAX])
                                                            ^
In file included from /usr/include/systemd/sd-journal.h:31:0,
                 from pkg/mod/github.com/coreos/go-systemd/v22@v22.2.0/sdjournal/journal.go:27:
pkg/mod/github.com/coreos/go-systemd/v22@v22.2.0/sdjournal/journal.go:313:77: error: expected ']' before numeric constant
 // my_sd_id128_to_string(void *f, sd_id128_t boot_id, char s[_SD_ARRAY_STATIC SD_ID128_STRING_MAX])

我应该如何使用以前没有此代码的版本来避免此错误?我正在go version 1.16使用centos7

提前致谢。

4

0 回答 0