user3465651
user3465651

Reputation: 764

struggling to compile go project with gogradle

I had this working in another vm. I have the same versions of the tooling being used:

I receive the following error:

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)

the build.gradle is as follows:

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

Any assistance would be greatly appreciated

Upvotes: 0

Views: 910

Answers (1)

user3465651
user3465651

Reputation: 764

I've added the 2 offending libs to the dependencies which seemed to fix it. Tho I am not sure why...

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

Upvotes: 1

Related Questions