我在另一个虚拟机上工作过。我使用的工具版本相同:
我收到以下错误:
13:44 $ gradle build
> Configure project :
Found go 1.9.7 in /home/phil/dev/tools/go/current/bin/go, use it.
> Task :prepare
Use project GOPATH: /home/phil/dev/projects/misc/go/Notification_System_GO/.gogradle/project_gopath
.gogradle/project_gopath/src/com.misc/notifications/vendor/cloud.google.com/go/pubsub/subscription.go:30:2: cannot find package "golang.org/x/sync/errgroup" in any of:
/home/phil/dev/projects/misc/go/Notification_System_GO/.gogradle/project_gopath/src/com.misc/notifications/vendor/golang.org/x/sync/errgroup (vendor tree)
/home/phil/dev/tools/go/go1.9.7/src/golang.org/x/sync/errgroup (from $GOROOT)
/home/phil/dev/projects/misc/go/Notification_System_GO/.gogradle/project_gopath/src/golang.org/x/sync/errgroup (from $GOPATH)
.gogradle/project_gopath/src/com.misc/notifications/vendor/cloud.google.com/go/pubsub/flow_controller.go:19:2: cannot find package "golang.org/x/sync/semaphore" in any of:
/home/phil/dev/projects/misc/go/Notification_System_GO/.gogradle/project_gopath/src/com.misc/notifications/vendor/golang.org/x/sync/semaphore (vendor tree)
/home/phil/dev/tools/go/go1.9.7/src/golang.org/x/sync/semaphore (from $GOROOT)
/home/phil/dev/projects/misc/go/Notification_System_GO/.gogradle/project_gopath/src/golang.org/x/sync/semaphore (from $GOPATH)
.gogradle/project_gopath/src/com.misc/notifications/vendor/google.golang.org/api/transport/grpc/dial.go:29:2: cannot find package "google.golang.org/grpc/credentials/oauth" in any of:
/home/phil/dev/projects/misc/go/Notification_System_GO/.gogradle/project_gopath/src/com.misc/notifications/vendor/google.golang.org/grpc/credentials/oauth (vendor tree)
/home/phil/dev/tools/go/go1.9.7/src/google.golang.org/grpc/credentials/oauth (from $GOROOT)
/home/phil/dev/projects/misc/go/Notification_System_GO/.gogradle/project_gopath/src/google.golang.org/grpc/credentials/oauth (from $GOPATH)
build.gradle如下:
plugins {
id 'com.github.blindpirate.gogradle' version '0.10'
}
golang {
packagePath = 'com.misc/notifications'
}
dependencies {
golang {
build name: 'google.golang.org/appengine', tag: 'v1.1.0'
build name: 'github.com/golang/protobuf'
build name: 'github.com/golang/mock'
build name: 'cloud.google.com/go', tag: 'v0.22.0'
build name: 'github.com/googleapis/gax-go', tag: '1.0.0'
}
}
build {
outputLocation = './bin/notifications'
}
任何帮助将不胜感激
答案 0 :(得分:0)
我已经将2个有问题的库添加到了似乎可以修复的依赖项中。我不确定为什么...
plugins {
id 'com.github.blindpirate.gogradle' version '0.10'
}
golang {
goVersion = '1.9.7'
packagePath = 'com.misc/notifications'
}
dependencies {
golang {
build name: 'google.golang.org/appengine', tag: 'v1.1.0'
build name: 'github.com/golang/protobuf', tag: 'v1.1.0'
build name: 'github.com/golang/mock', tag: 'v1.1.0'
build name: 'cloud.google.com/go', tag: 'v0.24.0'
build name: 'github.com/googleapis/gax-go', tag: '1.0.0'
build name: 'github.com/golang/protobuf', tag: 'v1.1.0'
build name: 'golang.org/x/sync/errgroup', tag: ''
build name: 'google.golang.org/grpc/credentials/oauth', tag: ''
}
}
build {
outputLocation = './bin/notifications'
}