I may be ignorant but can some explain

agolangf · · 361 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I heard Go was open source, but I can&#39;t seem to find it&#39;s source code. All I seem to find is the source code for it&#39;s standard library, nothing with a main function or anything. I&#39;m pretty novice so sorry if this is a really cringey question. As in the source code that actually does the text processing</p> <hr/>**评论:**<br/><br/>chocolateAltoids: <pre><blockquote> <p>I heard Go was open source</p> </blockquote> <p>It is.</p> <blockquote> <p>but I can&#39;t seem to find it&#39;s source code.</p> </blockquote> <p><a href="https://github.com/golang/go">Github</a></p> <blockquote> <p>All I seem to find is the source code for it&#39;s standard library, nothing with a main function or anything.</p> </blockquote> <p>So when you download and install Go onto your local computer you install some pieces of code (packages like &#39;fmt&#39;, &#39;bufio&#39;, &#39;crypto&#39;, etc.) that you can use within the Go program that you are creating. There is no &#39;main&#39; function to speak of because you are dealing with code that cannot execute by itself it needs to be used in something.</p> <p>Now the tools like &#34;go&#34;, &#34;gofmt&#34;, &#34;cgo&#34;, etc. do have a main function. Those tools can be found <a href="https://github.com/golang/go/tree/master/src/cmd">here</a>. It&#39;s the same github link as before in the /cmd directory (it&#39;s because the tools are commands :P)</p> <p>However, there should be little reason for you to poke around the source for the tools. Rather, based on your self describe &#39;novice&#39; level with go, I&#39;d recommend becoming more familiar with the standard library (the packages I spoke about before) and learn how to appropriately leverage them in whatever you are wanting to do.</p> <blockquote> <p>I&#39;m pretty novice so sorry if this is a really cringey question</p> </blockquote> <p>If you are looking to familiarize yourself with Go, I&#39;d highly recommend <a href="https://gobyexample.com/">Go By Example</a> until you get down to the section titled &#34;Variadic Functions&#34;. Then I&#39;d try to start solving &#39;small problems&#39; with Go ( <a href="/r/dailprogrammer">/r/dailprogrammer</a> is a good little list of programming problems ).</p> <p>We were all noobs at one time or another :P Overall, hopefully that clarified some things for you.</p></pre>sabi0: <pre><p>Thanks man you&#39;re really helpful</p></pre>truehum4ndesign: <pre><p>What do you mean? Everything is there: <a href="https://github.com/golang" rel="nofollow">https://github.com/golang</a></p></pre>Thomasdezeeuw: <pre><p><a href="https://github.com/golang/go/blob/58ad0176ca280c07a966249a3208f707ee0b1989/src/cmd/go/main.go#L69" rel="nofollow">https://github.com/golang/go/blob/58ad0176ca280c07a966249a3208f707ee0b1989/src/cmd/go/main.go#L69</a> is the main function for the &#34;go&#34; binary.</p></pre>

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

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