<p>I am a Go noob, however I am extremely interested in Google and their distributed systems. I came across a Github <a href="https://github.com/alexlambson/go-mapreduce" rel="nofollow">repo</a> about MapReduce. I tried to clone the project and run it, however I can't figure out how to include the project as an import to itself? I feel like that is redundant. I appreciate your help in trying to get this code to run.</p>
<hr/>**评论:**<br/><br/>kl0nos: <pre><p>Make main and import it in it ?</p>
<p>Here you go: <a href="https://talks.golang.org/2014/organizeio.slide" rel="nofollow">https://talks.golang.org/2014/organizeio.slide</a></p>
<p>Start from this.</p></pre>poometrics: <pre><p>Thank you so much! I'll start there.</p></pre>sethammons: <pre><p>And just to drive the point, in case it was not clear. You would have your own directory within your GOPATH ($GOPATH/src/github/$YOU/newpkg). </p>
<p>In newpkg/main.go, you would import the map reduce library and do your stuff in func main() in your main.go. You can then run it with <code>go run main.go</code>. Of course, you have to <code>go get</code> for the library you want. </p>
<p>Cheers.</p></pre>brogrammingsins: <pre><p>Actually, it's just GOPATH/src, the rest with github can be replaced with whatever path you need. If you do want to share your code, that's a different story.
Also, I'd suggest you to star with the language by reading the manual. </p></pre>google_you: <pre><p>GOPATH (or go package management) is like monad. Everybody blogs about it. Different people have different ideas about it.
So many tools are written for it: <a href="https://github.com/golang/go/wiki/PackageManagementTools" rel="nofollow">https://github.com/golang/go/wiki/PackageManagementTools</a></p>
<p>Once you get over GOPATH, it'll be easier. Don't put too much effort around it. Just follow <a href="https://golang.org/doc/code.html" rel="nofollow">https://golang.org/doc/code.html</a> for now.</p>
<p>Good luck.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传