Termux and Golang (android)

blov · · 3004 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi Gophers, I recently installed Termux on an android phone (and a whole ecosystem Droid Edit, Amaze, etc...) to try to have my Go development on mobile. I did <strong>apt install golang</strong> with no issues, installed git too, setup my $GOPATH in shared space and all. I could even go get some packages like Bolt and Echo correctly. Then I tried a simple hello.go (simple fmt.Println) and it works via <strong>go run hello.go</strong>, after that I naturally ran <strong>go build</strong> on the hello program and compiles perfectly with no issues. But when I try to run the compiled binary I get the error <strong>can&#39;t execute: Permission Denied</strong>. Which was... expected... so I replicated the procedure on a rooted android device, used su inside Termux give root permissions to the terminal (SuperSu prompted), but I keep getting the same error no matter what I do.</p> <p>Does anyone here know what I&#39;m missing? Thanks for your input.</p> <hr/>**评论:**<br/><br/>ar1819: <pre><p>I had no trouble when my GOPATH was in my home directory, so maybe running things from shared space cause this? go run works differently, by creating temp directory inside /tmp and launching compiled binary from there, IIRC. </p> <p>Edit: hope -&gt; home</p></pre>guesdo: <pre><p>Thanks for the reply! That did it! If I set my GOPATH or write my code inside $HOME but not the shared space, it compiles and runs correctly. I guess Android has safe guards to prevent execution from anything in the shared user space. Now my problem is that I can&#39;t use my code editor and file manager in Termux data space without root access.</p></pre>loafoe: <pre><p>My WoW is using VIM inside Termux. Furthermore all code is stored in GIT, so it&#39;s pretty easy to ship code in and out of the termux environment e.g. you can do your editting on another device.</p></pre>

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

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