我按照https://auth0.com/docs/server-platforms/golang中的步骤操作, 并尝试在Windows 7机器上设置种子项目.
我有ABLE为以下做"去获取";
github.com/gorilla/mux, golang.org/x/oauth2,github.com/astaxie/beego/session,
get github.com/codegangsta/negroni
Run Code Online (Sandbox Code Playgroud)
在这些之后,当我运行去安装我得到错误 ;
C:\Users\TestUser\Documents\go\auth0-golang-sample>go install
main.go:4:2: cannot find package "github.com/auth0/auth0-go/examples/regular-web-app/app" in any of: C:\Go\src\pkg\github.com\auth0\auth0-go\examples\regular-web-app\app (from $GOROOT)
C:\Users\TestUser\Documents\go\src\github.com\auth0\auth0-go\examples\regular-web-app\app (
from $GOPATH)
server.go:4:2: cannot find package "github.com/auth0/auth0-go/examples/regular-web-app/routes/callback" in any of: C:\Go\src\pkg\github.com\auth0\auth0-go\examples\regular-web-app\routes\callback (from $GOROOT)
.....
.....
Run Code Online (Sandbox Code Playgroud)
当我尝试"go get github.com/auth0/auth0-go/"时,我收到以下错误
C:\Users\TestUser\Documents\go\auth0-golang-sample>go get github.com/auth0/auth0-go/
Username for 'https://github.com': user
Password for 'https://user@github.com':
# cd .; git clone https://github.com/auth0/auth0-go C:\Users\TestUser\Documents\go\src\github.com\a
uth0\auth0-go
Cloning into 'C:\Users\TestUser\Documents\go\src\github.com\auth0\auth0-go'...
remote: Repository not found.
fatal: repository 'https://github.com/auth0/auth0-go/' not found
package github.com/auth0/auth0-go: exit status 128
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试去github.com/auth0/auth0-golang/
C:\Users\TestUser\Documents\go\auth0-golang-sample>go get github.com/auth0/auth0-golang/
package github.com/auth0/auth0-golang
imports github.com/auth0/auth0-golang
imports github.com/auth0/auth0-golang: no buildable Go source files in C:\Users\TestUser\Documents\go\src\github.com\auth0\auth0-golang
Run Code Online (Sandbox Code Playgroud)
但创建的文件/文件夹
C:\Users\TestUser\Documents\go\src\github.com\auth0\auth0-golang\
+--examples
+--go-api
--main.go
--README.md
+--regular-web-app
+--app
--app.go
+--public
--app.css
--app.js
+--routes
+--CALLBACK
+--home
+--middlewares
+--user
--templates.go
--main.go
--README.md
--server.go
--.gitignore
--README.md
Run Code Online (Sandbox Code Playgroud)
以下是我的环境
set GOARCH=amd64
set GOBIN=C:\Users\TestUser\Documents\go\bin
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\TestUser\Documents\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
Run Code Online (Sandbox Code Playgroud)
我已被锁定这个问题好几天了,任何帮助将不胜感激.感谢@Vonc,我已经克服了最初的蜷缩.现在go install吐出这个错误
# github.com/auth0/auth0-golang/examples/regular-web-app/routes/callback
..\src\github.com\auth0\auth0-golang\examples\regular-web-app\routes\callback\ca
llback.go:17: undefined: oauth2.New
..\src\github.com\auth0\auth0-golang\examples\regular-web-app\routes\callback\ca
llback.go:18: undefined: oauth2.Client
..\src\github.com\auth0\auth0-golang\examples\regular-web-app\routes\callback\ca
llback.go:19: undefined: oauth2.RedirectURL
Run Code Online (Sandbox Code Playgroud)
我已经'go get golang.org/x/oauth2'和结果(简化)......
C:\Users\TestUser\Documents\go\
+--pkg
+--windows_amd64
+--golang.org
+--x
+--net
+--oauth2
--internal.a
--jws.a
--oauth2.a
+--src
+--golang.org
+--x
+--net
+--oauth2
Run Code Online (Sandbox Code Playgroud)
我已经擦除所有并安装了1.4但我仍然错误未定义oauth2.New,oauth2.Client等
我没有运气去获取github.com/golang/oauth2的结果
can't load package: package github.com/golang/oauth2: code in directory C:\Users
\TestUser\Documents\go\src\github.com\golang\oauth2 expects import "golang.org/x/oauth2"
Run Code Online (Sandbox Code Playgroud)
我真的陷入了泥潭
我刚刚找到了golang auth问题的答案,这是由于代码更改链接到代码