From 5a89261e613631a55e52810b2d4396997a376478 Mon Sep 17 00:00:00 2001 From: zggsong Date: Wed, 9 Nov 2022 16:45:58 +0800 Subject: [PATCH] try --- .drone.yml | 17 +++++++++-------- main.go | 6 +++++- main_test.go | 9 +++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 main_test.go diff --git a/.drone.yml b/.drone.yml index 2c8d4da..b946155 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,9 +1,10 @@ -# .drone.yml -kind: pipeline -name: default +workspace: + base: /go + path: src/gogs.kikakika.com/lihongfeng/first -steps: -- name: run - image: golang - commands: - - go build +pipeline: + build: + image: golang:1.10.2 + commands: + - go test + - go build diff --git a/main.go b/main.go index 52a7925..a83e54f 100644 --- a/main.go +++ b/main.go @@ -5,5 +5,9 @@ import ( ) func main() { - fmt.Println("hello world") + fmt.Printf("hello world") +} + +func hello() string { + return "hello world" } diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..1a5a8cc --- /dev/null +++ b/main_test.go @@ -0,0 +1,9 @@ +package main + +import "testing" + +func TestHello(t *testing.T) { + if hello() != "hello world" { + t.Error("Testing error") + } +}