Skip to content

Commit

Permalink
Merge pull request #66 from fanzhe328/update-go-demo
Browse files Browse the repository at this point in the history
update golang demo
  • Loading branch information
fanzhe328 authored Nov 4, 2022
2 parents 5850c28 + 3bc775b commit 86d66d2
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion event-function/fc-event-golang1.x/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Type: Application
Name: start-fc-event-golang1.x
Version: 0.0.15
Version: 0.0.16
Provider:
- 阿里云
Description: 快速部署一个 golang1.x 的 Event 类型的 Hello World 函数到阿里云函数计算。
Expand Down
2 changes: 1 addition & 1 deletion event-function/fc-event-golang1.x/src/code/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module main

require github.com/aliyun/fc-runtime-go-sdk v0.0.3 // indirect
require github.com/aliyun/fc-runtime-go-sdk v0.2.7
12 changes: 2 additions & 10 deletions event-function/fc-event-golang1.x/src/code/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,8 @@ func main() {
fc.Start(HandleRequest)
}

/*
event:
{
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
*/
func HandleRequest(event map[string]interface{}) (string, error) {
fmt.Printf("event: %v\n", event)
func HandleRequest(event []byte) (string, error) {
fmt.Printf("event: %s\n", string(event))
fmt.Println("hello world! 你好,世界!")
return "hello world! 你好,世界!", nil
}
2 changes: 1 addition & 1 deletion event-function/fc-event-golang1.x/src/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
pre-deploy: # 在deploy之前运行
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
path: ./code
- run: GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
path: ./code
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # 要运行的组件,格式为【component: 组件名 命令 参数】(可以通过s cli registry search --type Component 获取组件列表)
# - run: docker build xxx # 要执行的系统命令,类似于一种钩子的形式
Expand Down
2 changes: 1 addition & 1 deletion event-function/fc-event-golang1.x/src/s_en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
pre-deploy: # run before deploy
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
path: ./code
- run: GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
path: ./code
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # The component to run, the format is [component: component name command parameter] (you can get the component list through s cli registry search --type Component)
# - run: docker build xxx # System command to execute, similar to a hook
Expand Down
2 changes: 1 addition & 1 deletion http-function/fc-http-golang1.x/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Type: Application
Name: start-fc-http-golang1.x
Version: 0.0.15
Version: 0.0.16
Provider:
- 阿里云
Description: 快速部署一个 golang1.x 的 HTTP 类型的 Hello World 函数到阿里云函数计算。
Expand Down
2 changes: 1 addition & 1 deletion http-function/fc-http-golang1.x/src/code/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module main

require github.com/aliyun/fc-runtime-go-sdk v0.0.3 // indirect
require github.com/aliyun/fc-runtime-go-sdk v0.2.7
2 changes: 1 addition & 1 deletion http-function/fc-http-golang1.x/src/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
pre-deploy: # 在deploy之前运行
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
path: ./code
- run: GO111MODULE=on GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
- run: GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
path: ./code
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # 要运行的组件,格式为【component: 组件名 命令 参数】(可以通过s cli registry search --type Component 获取组件列表)
# - run: docker build xxx # 要执行的系统命令,类似于一种钩子的形式
Expand Down
2 changes: 1 addition & 1 deletion http-function/fc-http-golang1.x/src/s_en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
pre-deploy: # run before deploy
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
path: ./code
- run: GO111MODULE=on GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
- run: GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
path: ./code
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # The component to run, the format is [component: component name command parameter] (you can get the component list through s cli registry search --type Component)
# - run: docker build xxx # System command to execute, similar to a hook
Expand Down
3 changes: 2 additions & 1 deletion update.list
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
custom-container-function/fc-custom-container-http-springboot
event-function/fc-event-golang1.x
http-function/fc-http-golang1.x

0 comments on commit 86d66d2

Please sign in to comment.