Unrecognized import path on openshift

xuanbao · · 899 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have some local packages defined within my application, for example, I have a crud model located at model/crud/crud.go</p> <p>Within my application I am calling upon them using <code>import(&#34;model/crud&#34;)</code>, for all of my local dependencies.</p> <p>This resolves perfectly fine within the context of my application on my local machine, however when I try to push to openshift I get the following error:</p> <p><code>imports model/crud: unrecognized import path &#34;model/crud&#34;</code></p> <p>It looks like when openshift runs the build tool, it is attempting to run <code>go get</code> on these imports in order to include them in the build path when compiling. </p> <p>Is there a better way to resolve vendor specific dependencies without having to create a separate repo for them? I don&#39;t want to have to manage two separate repositories if I don&#39;t have to.</p> <p>I posted this on Stackoverflow if you&#39;d prefer to get reputation for your answer there. Any help is greatly appreciated.</p> <p><a href="http://stackoverflow.com/q/31094283/1400450">Post on Stackoverflow</a></p> <hr/>**评论:**<br/><br/>anoland: <pre><p>I&#39;m having the same problem on openshift. Openshift does the import to a non standard subdirectory that &#39;go get&#39; doesn&#39;t know how to find. The closest I have come is to put a <em>.gopath</em> file in the root of your openshift repo for a place to put the repo code. I haven&#39;t resolved the import path from that location yet.</p></pre>uabassguy: <pre><p>Hmm, interesting to see that I&#39;m not the only one having this issue. It&#39;d seem more effective if they used something like docker rather than than go cart. </p></pre>anoland: <pre><p>The next version is based on docker. I don&#39;t know how soon that will be released tho.</p></pre>uabassguy: <pre><p>Cool. Yea I saw that go cart was copying to the gopath which seemed to immediately break because the repo itself was in an entirely different location. That and there is limited write access within the home folder to repair those with symlinks. Seemed not very well thought out, or was designed with the purpose of working with external repositories exclusively. Didn&#39;t make sense to me. </p></pre>joefitzgerald: <pre><p>While this may be a completely unproductive response (i.e. if you&#39;re required to use or are sold on OpenShift, feel free to ignore), have you tried other PaaSes, like Cloud Foundry (disclosure: I work for Pivotal), or Heroku? In both scenarios, you can actually just use the null buildpack <a href="https://github.com/ryandotsmith/null-buildpack" rel="nofollow">1</a> which executes a binary that you produce in your CI pipeline. There is also a full lifecycle buildpack for CF <a href="https://github.com/cloudfoundry/go-buildpack" rel="nofollow">2</a> and Heroku <a href="https://github.com/heroku/heroku-buildpack-go" rel="nofollow">3</a>.</p></pre>khaki0: <pre><p>About the null buildpack, doesn&#39;t the git repo become too big quickly? I mean committing binary files - which in case of Go can be several MB or more - can cause the git repo to bloat pretty quickly. </p></pre>uabassguy: <pre><p>Just curious as to why binaries are being handled in this manner? Builds are generally supposed to be triggered by some sort of CI application like Jenkins instead of being deployed through VCS directly. </p></pre>uabassguy: <pre><p>I&#39;m not married to the idea of using openshift, just saw that it was free for small apps and wanted to test response times of a web socket api in an actual server-client scenario. The main reason was the &#39;free for small scale&#39; part since I&#39;m still experimenting with go. </p></pre>klaaax: <pre><p>Which cartridge are you using? it seems the default one isn&#39;t even maintained (last commit in january). That&#39;s the issue with openshift compared to other paas like Heroku, their &#34;buildpacks&#34; are very poor in quality. you need to try another Go cartridge. But frankly I wouldn&#39;t bother for now. Nothing really works in openshift if you don&#39;t invest time to write your own shellscripts. I remember being unable to deploy the latest version of express.js (v3) because it conflicted with a nodejs library pre-installed on the default nodejs cartridge how fucked up is this ? </p> <p>And since openshift 3 is moving to containers , they&#39;ll scrap their legacy architecture sooner or later,I don&#39;t want to be using that in production when everything breaks.</p></pre>khaki0: <pre><p>Where do you usually deploy your Go apps? I&#39;m developing a Go+Postgres+Redis app and so far I think AWS and Heroku are the only viable options. </p> <p>I like Heroku but it is just too expensive. For example the smallest database with a backup node costs at least $200/mo. </p></pre>uabassguy: <pre><p>I develop locally since I&#39;m just recently jumping into go. I&#39;ve been considering Go+Cassandra+Redis though. I&#39;d be better off building my own test machine than paying 200 a month, that is a bit much, especially since this is an experimental personal project. </p></pre>uabassguy: <pre><p>Looks like they&#39;re using Go-cart and I was wondering why they weren&#39;t using docker but I figured &#39;eh, it&#39;s free for a small app, so why not?&#39;. 3 hours later and I&#39;m wondering why I bothered when I could have spent that time writing the code to simulate a server client scenario myself and saved the hassle. </p></pre>

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

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