I am trying to setup the build environment for Go language, I am planning to using gradle for its various advantages.
I need your expertise help to build go language project. I am looking for simple gradle script which can build “Hello World” program written in go language.
plugins {
id “org.golang.mobile.bind” version “0.2.1”
}
gobind {
/* The Go package path; must be under one of the GOPATH elements or
a relative to the current directory (e.g. …/…/hello) */
pkg = “/home/SDL/gocode/src/SDL-SRC”
/* GOPATH where the Go package is; check go env */
GOPATH = “/home/SDL/gocode”
/* Absolute path to the go binary */
GO = “/usr/local/go/bin”
}
I get below error:
What went wrong:
A problem occurred evaluating root project ‘SDL-SRC’.
No signature of method: build_4s3bi4u0rg0mg10bktcmg7ughp$_run_closure1.id() is applicable for argument types: (java.lang.String) values: [org.golang.mobile.bind]
Possible solutions: is(java.lang.Object), is(java.lang.Object), find(), find(), find(groovy.lang.Closure), find(groovy.lang.Closure)
plugins {
id 'com.github.blindpirate.gogradle' version <the newest version>
}
golang {
packagePath = 'your/package/path' // path of project to be built
}
as build.gradle into your project, and run gradle build or ./gradlew build (in this case you need to copy gradlew and related jars into the project dir). No need to set GOPATH, and even no need to pre-install go executables!