diff --git a/.drone.yml b/.drone.yml index 81effeb..21e858d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,30 +9,30 @@ volumes: path: /usr/local/path/gopath steps: -# - name: golang-build -# image: golang:1.17-alpine3.15 -# volumes: -# - name: gopath -# path: /go -# commands: -# - export GOPROXY=https://goproxy.cn -# - go mod init test-drone -# - go mod tidy -# - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test-drone -# when: -# target: [ "test","pre" ] - - - name: docker-push - image: plugins/docker - settings: - username: tjqmhu - password: tjqm4912 - repo: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone - dockerfile: Dockerfile - registry: https://registry.cn-hangzhou.aliyuncs.com - tags: ${DRONE_BUILD_NUMBER} + - name: golang-build + image: golang:1.17-alpine3.15 + volumes: + - name: gopath + path: /go + commands: + - export GOPROXY=https://goproxy.cn + - go mod init test-drone + - go mod tidy + - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test-drone when: - target: [ "test","pre"] + target: [ "test","pre" ] + +# - name: docker-push +# image: plugins/docker +# settings: +# username: tjqmhu +# password: tjqm4912 +# repo: registry.cn-hangzhou.aliyuncs.com/huvipg/test-drone +# dockerfile: Dockerfile +# registry: https://registry.cn-hangzhou.aliyuncs.com +# tags: ${DRONE_BUILD_NUMBER} +# when: +# target: [ "test","pre"] - name: rancher-deploy image: registry.cn-hangzhou.aliyuncs.com/hvp/dpr:8 # 直接用busybox diff --git a/main.go b/main.go index f2b7ab2..3b375c0 100644 --- a/main.go +++ b/main.go @@ -1,20 +1,9 @@ package main -// 导入gin包 -import "github.com/gin-gonic/gin" +import "fmt" // 入口函数 func main() { // 初始化一个http服务对象 - r := gin.Default() - - // 设置一个get请求的路由,url为/ping, 处理函数(或者叫控制器函数)是一个闭包函数。 - r.GET("/", func(c *gin.Context) { - // 通过请求上下文对象Context, 直接往客户端返回一个json - c.JSON(200, gin.H{ - "message": "pong9", - }) - }) - - r.Run(":8080") // 监听并在 0.0.0.0:8080 上启动服务 + fmt.Println("ssss1") }