[v5,14/26] go-helloworld: Use the Golang examples repository

Submitted by Otavio Salvador on Sept. 11, 2017, 12:45 p.m. | Patch ID: 143951

Details

Message ID 20170911124558.2863-15-otavio@ossystems.com.br
State New
Headers show

Commit Message

Otavio Salvador Sept. 11, 2017, 12:45 p.m.
This updates the recipe to use the Golang examples repository so it
makes use of the unpack as well as standard tasks showing how easy it
can be.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---

Changes in v6: None
Changes in v5:
- new patch

Changes in v4: None
Changes in v3: None
Changes in v2: None

 .../go-examples/files/helloworld.go                | 10 ---------
 meta/recipes-extended/go-examples/go-examples.inc  | 10 ---------
 .../go-examples/go-helloworld_0.1.bb               | 24 ++++++++++++++--------
 3 files changed, 15 insertions(+), 29 deletions(-)
 delete mode 100644 meta/recipes-extended/go-examples/files/helloworld.go
 delete mode 100644 meta/recipes-extended/go-examples/go-examples.inc

Patch hide | download patch | download mbox

diff --git a/meta/recipes-extended/go-examples/files/helloworld.go b/meta/recipes-extended/go-examples/files/helloworld.go
deleted file mode 100644
index 0253c40411..0000000000
--- a/meta/recipes-extended/go-examples/files/helloworld.go
+++ /dev/null
@@ -1,10 +0,0 @@ 
-// You can edit this code!
-// Click here and start typing.
-// taken from https://golang.org/
-package main
-
-import "fmt"
-
-func main() {
-	fmt.Println("Hello, 世界")
-}
diff --git a/meta/recipes-extended/go-examples/go-examples.inc b/meta/recipes-extended/go-examples/go-examples.inc
deleted file mode 100644
index c63268116b..0000000000
--- a/meta/recipes-extended/go-examples/go-examples.inc
+++ /dev/null
@@ -1,10 +0,0 @@ 
-DESCRIPTION = "This is a simple example recipe that cross-compiles a Go program."
-SECTION = "examples"
-HOMEPAGE = "https://golang.org/"
-
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
-
-S = "${WORKDIR}"
-
-inherit go
diff --git a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
index 930c57df95..222fc9d349 100644
--- a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
+++ b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
@@ -1,13 +1,19 @@ 
-require go-examples.inc
+DESCRIPTION = "This is a simple example recipe that cross-compiles a Go program."
+SECTION = "examples"
+HOMEPAGE = "https://golang.org/"
 
-SRC_URI += " \
-  file://helloworld.go \
-"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
-do_compile() {
-	go build helloworld.go
-}
+SRC_URI = "git://${GO_IMPORT}"
+SRCREV = "46695d81d1fae905a270fb7db8a4d11a334562fe"
+
+GO_IMPORT = "github.com/golang/example"
+GO_INSTALL = "${GO_IMPORT}/hello"
+
+inherit go
 
-do_install() {
-	install -D -m 0755 ${S}/helloworld ${D}${bindir}/helloworld
+# This is just to make clear where this example is
+do_install_append() {
+    mv ${D}${bindir}/hello ${D}${bindir}/${BPN}
 }