Noob coder with question/problem with Package!

agolangf · · 634 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have been going through GO by example and it has been working fine. I wrote a small program to access an MSSQL database and do a quick select on a table and I get the following errors:</p> <p>PS C:\work\src\gobyex&gt; go run .\go_mssql.go go_mssql.go:5:9: cannot find package &#34;alexbrainman/odbc/&#34; in any of: C:\Go\src\alexbrainman\odbc (from $GOROOT) C:\Work\src\alexbrainman\odbc (from $GOPATH)</p> <p>My go environment is as follow:</p> <p>PS C:\work\src\gobyex&gt; go env set GOARCH=386 set GOBIN= set GOEXE=.exe set GOHOSTARCH=386 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\Work set GORACE= set GOROOT=C:\Go set GOTOOLDIR=C:\Go\pkg\tool\windows_386 set GO15VENDOREXPERIMENT= set CC=gcc set GOGCCFLAGS=-m32 -mthreads -fmessage-length=0 set CXX=g++ set CGO_ENABLED=1</p> <p>I am running on Windows 7 and I did a go get on the odbc package and it is in the pkg directory of work.</p> <p>What have I failed to setup properly such that GO can find the package?</p> <hr/>**评论:**<br/><br/>ZenSwordArts: <pre><p>Maybe I&#39;m wrong but did you import &#34;alexbrainman/odbc&#34; or &#34;github.com/alexbrainman/odbc&#34; ?</p> <p>My guess is that you forgot the github.com part of the package name?</p></pre>ironmig: <pre><p>You did a go get to get this package? Did it come from a website? The package might be github.com/alexbrainman/obdc or something like that. If you use go get from the internet, it goes into a folder by that site&#39;s address.</p></pre>lsumnler: <pre><p>I did the following </p> <pre><code>go get github.com/alexbrainman/odbc </code></pre> <p>it put it under C:\work\pkg\windows_386\github.com\alexbrainman\odbc.a</p></pre>ironmig: <pre><p>When you&#39;re referencing the package in the code you need to include the github.com</p></pre>

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

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