go

pkg_config_path error on building with docker

人走茶凉 提交于 2021-01-01 07:50:31
问题 When I am building an image for my Go application through docker, I am getting the following error: # pkg-config --cflags oci8 Package oci8 was not found in the pkg-config search path. Perhaps you should add the directory containing `oci8.pc' to the PKG_CONFIG_PATH environment variable No package 'oci8' found pkg-config: exit status 1 I have set the environment variable in my Dockerfile also. But still the issue persists. My Dockerfile is: *FROM golang:1.9 ARG app_env ENV APP_ENV $app_env ENV

pkg_config_path error on building with docker

﹥>﹥吖頭↗ 提交于 2021-01-01 07:50:25
问题 When I am building an image for my Go application through docker, I am getting the following error: # pkg-config --cflags oci8 Package oci8 was not found in the pkg-config search path. Perhaps you should add the directory containing `oci8.pc' to the PKG_CONFIG_PATH environment variable No package 'oci8' found pkg-config: exit status 1 I have set the environment variable in my Dockerfile also. But still the issue persists. My Dockerfile is: *FROM golang:1.9 ARG app_env ENV APP_ENV $app_env ENV

Correctly pass struct to function in golang

只谈情不闲聊 提交于 2021-01-01 06:33:43
问题 I have a golang structure: type Connection struct { Write chan []byte Quit chan bool } I'm creating it with: newConnection := &Connection{make(chan []byte), make(chan bool)} How to correctly create functional type with Connection parameter and function of this type? I mean that i want to do something like this: type Handler func(string, Connection) and handler(line, newConnection) whene handler is: func handler(input string, conn tcp.Connection) {} cannot use newConnection (type *Connection)

Correctly pass struct to function in golang

对着背影说爱祢 提交于 2021-01-01 06:33:42
问题 I have a golang structure: type Connection struct { Write chan []byte Quit chan bool } I'm creating it with: newConnection := &Connection{make(chan []byte), make(chan bool)} How to correctly create functional type with Connection parameter and function of this type? I mean that i want to do something like this: type Handler func(string, Connection) and handler(line, newConnection) whene handler is: func handler(input string, conn tcp.Connection) {} cannot use newConnection (type *Connection)

uart232串口之二——fpg内部回环仿真

丶灬走出姿态 提交于 2021-01-01 06:32:40
该模块功能, 接收数据。 module rs232_rx_cnt( clk, rst_n, sel_bps, uart_rx, rx_done, data_recv); input clk; input rst_n; input uart_rx; input [2:0] sel_bps; output rx_done; output [7:0] data_recv; reg [11:0] cnt1;//第一阶段计数器 reg [12:0] cnt2; reg [12:0] Time; always @(*) begin if (sel_bps == 3'd0) Time <= 5208; //9600 else if (sel_bps == 3'd1) Time <= 1302; //38400 else if (sel_bps == 3'd2) Time <= 434; //115200 else Time <= 5208; end reg rx1,rx2; always @ (posedge clk or negedge rst_n) begin if ( rst_n == 1'b0) begin rx1 <= 1'b0; rx2 <= 1'b0; end else if (sta ==IDLE) begin rx1 <= uart_rx; rx2 <= rx1; end

golang: read text file line by line of int strings

两盒软妹~` 提交于 2021-01-01 04:42:28
问题 I am dealing with an input file containing a list of integers as a string 10 .. I have choosen to read it line by line with ReadString('\n') method The following code line, error := inputReader.ReadString('\n') lineStr := string(line) console output (length and value) lineStr %v 4 lineStr %v 10 lineStr as a length of "4", maybe because of rune encoding. Then I have tried several way to convert it to simple integer but with no success. Ex1 num, _ := strconv.ParseUint(lineStr, 0, 64) ouputs a

golang: read text file line by line of int strings

时光怂恿深爱的人放手 提交于 2021-01-01 04:41:11
问题 I am dealing with an input file containing a list of integers as a string 10 .. I have choosen to read it line by line with ReadString('\n') method The following code line, error := inputReader.ReadString('\n') lineStr := string(line) console output (length and value) lineStr %v 4 lineStr %v 10 lineStr as a length of "4", maybe because of rune encoding. Then I have tried several way to convert it to simple integer but with no success. Ex1 num, _ := strconv.ParseUint(lineStr, 0, 64) ouputs a

golang protobuf序列化分析

匆匆过客 提交于 2021-01-01 01:55:53
data.proto message ColumnarValue { uint32 id= 1; int32 typ = 2; repeated bytes values = 3; } data.go.proto type ColumnarValue struct { Id uint32 `protobuf:"varint,1,opt,name=id,json=id,proto3" json:"id,omitempty"` Typ int32 `protobuf:"varint,2,opt,name=typ,json=typ,proto3" json:"typ,omitempty"` Values [][]byte `protobuf:"bytes,3,rep,name=values,proto3" json:"values,omitempty"` } 序列化 func (m *ColumnarValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalTo(b) if err != nil { return nil, err } return b[:n], nil } func (m *ColumnarValue) MarshalTo

外甥女问我 加了4G内存条,为啥还是卡的要命?

独自空忆成欢 提交于 2020-12-31 21:24:29
通过前面两篇文章的学习,外甥对电脑的产生了各种好奇,差点把自己电脑拆开来研究研究了 我觉得这种学习精神挺好的,假使她真的把电脑拆坏了,也是赞同的,毕竟这种学习的经历是在的 就在前几天外甥和我抱怨说只要应用打开的比较多或者网页打开比较多,电脑运行超级慢,卡顿半天 我就反手问了一句,你知道为什么么? 她故作无知冷冷的来了一句 不知道 我细细的讲起卡顿有几方面的原因: 打开的app或者网页需要计算的数据量太大,计算机算力不足,此时计算机算力全部被征用了,无法在操作其他 打开的app内存需求量大,打开app多或者单个app内存需求较大,会导致内存被占满,此时会发生磁盘和内存的交换,磁盘速度很慢 app需要读取大量磁盘数据,磁盘读写速度远远低于内存和CPU 网络卡顿,app有网路交互情况,网路非常慢,app会经历超时和重试 巴拉巴拉说了一通,她估计实在忍不住了,打断说 我看了任务管理器,卡顿时内存爆满 100%状态,然后就加装了内存条,诡异的是情况并没有好转,让我非常不解。 问号? 我听到这里,就已经知道病症在那里了,32bit和64bit的问题,今天就给大家讲讲这个病症 文章大纲 32bit和64bit指的是什么? 记得校招面试那会儿,经常被面试官问到,你知道32位和64位的区别是什么么? 那时候我脱口而出 寻址能力不一样 现在看来,这个回答含糊不清、对也不对 首先,我们应该问清楚

02-准备实验环境-008-快速-部署-虚拟机批量克隆-VMware Workstation 15

拈花ヽ惹草 提交于 2020-12-31 20:34:53
《系统工程师实战培训》 -02- 准备实验环境 ( 批量克隆 )-008- 快速 - 部署 - 虚拟机批量克隆 - VMware Workstation 15 作者:学 无 止 境 QQ交流群:454544014 1. 模板机 2. 脚本 param( [string] $importfile = $(Read-Host -prompt "Please enter a file name")) $importedusers = Import-CSV $importfile foreach ($importeduser in $importedusers) { cd "c:\Program Files (x86)\VMware\VMware Workstation\" #1.克?隆?虚¨¦拟a机¨² .\vmrun.exe -T ws clone $importeduser.SourceFile $importeduser.TargetFile full -snapshot $importeduser.CloneSnapshot -cloneName $importeduser.CloneName #3.开a启?虚¨¦拟a机¨² .\vmrun.exe -T ws start $importeduser.TargetFile d: } 3. CSV SourceFile