Gob reader?

agolangf · · 365 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Just a quick question. An old coworker encoded some data I need to access in a Gob format and saved it as a file. My grasp of Go is tenuous at best, so I was hoping there might be some sort of Gob reader that could decode the Gob encoding and show me the raw data? I understand I can do it from Go but I don&#39;t have it set up at the moment. Thanks!</p> <hr/>**评论:**<br/><br/>CHAOSFISCH: <pre><p>Was posted a few month back here. <a href="https://github.com/drosseau/degob" rel="nofollow">https://github.com/drosseau/degob</a></p></pre>beknowly: <pre><p>It shouldn&#39;t be much code to decode it. I doubt there&#39;s a utility like what you&#39;re looking for, the data inside isn&#39;t exactly going to be csv or something.</p></pre>Ouroboros998: <pre><p>It&#39;s not much code at all, just didn&#39;t want to set up everything if I didn&#39;t have to. Also, amusingly enough, the data is a histogram of words and counts so I&#39;m about 90% sure it is actually human readable. </p></pre>beknowly: <pre><p>Unfortunately I think you do have to. I don&#39;t think gob has any facilities for decoding to an arbitrary type, so you kind of need to know what the source types were to in order to use the encoded data.</p> <p>edit: If you don&#39;t know what the source types were, you&#39;re gonna have to be implementing your own decoder... See <a href="https://golang.org/src/encoding/gob/debug.go" rel="nofollow">encoding/gob/debug.go</a> for details on how to go about that. Looks like fun :)</p> <p>edit2: Hmm, the above would imply it <em>is</em> possible to make a utility that does what you want. <del>it doesn&#39;t exist tho</del>. Be the hero everybody needs.</p> <p>edit3: i was wrong it exists</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

365 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传