关于generator:安装snmp-generator遇到usrbinld-final-link-failed问题

在github下载代码后 做go build 呈现报错 /usr/bin/ld: xxx : unrecognized relocation (0x2a) in section `.text`/usr/bin/ld: final link failed: 谬误的值# 查看旧版本[root@prometheus-primary1 generator]# ld -v# 以我的为例,以后零碎中 ld 的版本为GNU ld version 2.25.1-31.base.el7ld 工具的版本后, 起因是版本较低更新成 2.26.1 版本[root@prometheus-primary1 generator]# wget http://ftp.gnu.org/gnu/binutils/binutils-2.26.1.tar.gz# 解压[root@prometheus-primary1 generator]# tar -xf binutils-2.26.1.tar.gz [root@prometheus-primary1 generator]# cd ./binutils-2.26.1# 通过 configure 生成 makefile 文件,以及设置 make install 时的装置门路[root@prometheus-primary1 generator]# ./configure --prefix=/home/binutils-2.26.1/build# 编译[root@prometheus-primary1 generator]# make -j# 编译生成文件[root@prometheus-primary1 generator]# make install# 配置零碎环境变量[root@prometheus-primary1 generator]# vim /etc/profile 追加 export PATH=... 也能够 # 这样能够确保机器重启后,导入的环境变量不会被重置echo "export PATH=/home/binutils-2.26.1/build/bin:$PATH" >> /etc/profile.d/localld.shsource /etc/profile.d/localld.sh# test[root@prometheus-primary1 generator]# ld -vGNU ld (GNU Binutils) 2.26.1而后持续测试 go build && make mibs ...

June 11, 2022 · 1 min · jiezi

关于generator:理解-generator

1. 生成器中while设置为trueredux-saga 文档中提到take实现takeEvery在while中应用了yield监听将来的 action 循环有限次 function* watchRequests() { console.info("xx"); let preVal = 0; while (true) { console.info("yy"); const ret = yield preVal + 2; // if (ret === 3) { // break; // } preVal = ret; console.info("output:", ret); }}const it = watchRequests();for (const item of it) { console.info(item);}这么调用,生成器中的while无终止条件,会导致有限循环。 循环无限次数 function* watchRequests() { console.info("xx"); let preVal = 0;//记录上次内部传进来的值 while (true) { console.info("yy"); const ret = yield preVal + 2; // if (ret === 3) { // break; // } preVal = ret; console.info("output:", ret); }}const it = watchRequests();// for (const item of it) {// console.info(item);// }for (let i = 0; i < 5; i++) { const r = it.next(i); console.info("r:", r);}输入: ...

September 14, 2020 · 3 min · jiezi