努力用gogradle编译go项目

努力用gogradle编译go项目,go,gradle,gcloud,Go,Gradle,Gcloud,我让它在另一个虚拟机上工作。我使用的工具版本相同: 格拉德尔4.9 Java 8更新181 golang 1.9.7 gogradle插头0.10 我收到以下错误: 13:44$gradle建筑 > 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/proj

我让它在另一个虚拟机上工作。我使用的工具版本相同:

  • 格拉德尔4.9
  • Java 8更新181
  • golang 1.9.7
  • gogradle插头0.10
我收到以下错误:

13:44$gradle建筑

> 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'
}

如果您能提供任何帮助,我们将不胜感激。

我已经在依赖项中添加了两个有问题的lib,似乎可以修复它。虽然我不知道为什么

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'
}
可能重复的