Skip to content

Commit 3bc775b

Browse files
committed
update golang demo
1 parent 5850c28 commit 3bc775b

File tree

10 files changed

+12
-19
lines changed

10 files changed

+12
-19
lines changed

event-function/fc-event-golang1.x/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Type: Application
22
Name: start-fc-event-golang1.x
3-
Version: 0.0.15
3+
Version: 0.0.16
44
Provider:
55
- 阿里云
66
Description: 快速部署一个 golang1.x 的 Event 类型的 Hello World 函数到阿里云函数计算。
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module main
22

3-
require github.com/aliyun/fc-runtime-go-sdk v0.0.3 // indirect
3+
require github.com/aliyun/fc-runtime-go-sdk v0.2.7

event-function/fc-event-golang1.x/src/code/main.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,8 @@ func main() {
1010
fc.Start(HandleRequest)
1111
}
1212

13-
/*
14-
event:
15-
{
16-
"key1": "value1",
17-
"key2": "value2",
18-
"key3": "value3"
19-
}
20-
*/
21-
func HandleRequest(event map[string]interface{}) (string, error) {
22-
fmt.Printf("event: %v\n", event)
13+
func HandleRequest(event []byte) (string, error) {
14+
fmt.Printf("event: %s\n", string(event))
2315
fmt.Println("hello world! 你好,世界!")
2416
return "hello world! 你好,世界!", nil
2517
}

event-function/fc-event-golang1.x/src/s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
pre-deploy: # 在deploy之前运行
3838
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
3939
path: ./code
40-
- run: GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
40+
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
4141
path: ./code
4242
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # 要运行的组件,格式为【component: 组件名 命令 参数】(可以通过s cli registry search --type Component 获取组件列表)
4343
# - run: docker build xxx # 要执行的系统命令,类似于一种钩子的形式

event-function/fc-event-golang1.x/src/s_en.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
pre-deploy: # run before deploy
3838
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
3939
path: ./code
40-
- run: GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
40+
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
4141
path: ./code
4242
# - 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)
4343
# - run: docker build xxx # System command to execute, similar to a hook

http-function/fc-http-golang1.x/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Type: Application
22
Name: start-fc-http-golang1.x
3-
Version: 0.0.15
3+
Version: 0.0.16
44
Provider:
55
- 阿里云
66
Description: 快速部署一个 golang1.x 的 HTTP 类型的 Hello World 函数到阿里云函数计算。
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module main
22

3-
require github.com/aliyun/fc-runtime-go-sdk v0.0.3 // indirect
3+
require github.com/aliyun/fc-runtime-go-sdk v0.2.7

http-function/fc-http-golang1.x/src/s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
pre-deploy: # 在deploy之前运行
3838
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
3939
path: ./code
40-
- run: GO111MODULE=on GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
40+
- run: GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
4141
path: ./code
4242
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # 要运行的组件,格式为【component: 组件名 命令 参数】(可以通过s cli registry search --type Component 获取组件列表)
4343
# - run: docker build xxx # 要执行的系统命令,类似于一种钩子的形式

http-function/fc-http-golang1.x/src/s_en.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
pre-deploy: # run before deploy
3838
- run: GO111MODULE=on go get github.com/aliyun/fc-runtime-go-sdk
3939
path: ./code
40-
- run: GO111MODULE=on GOOS=linux CGO_ENABLED=0 go build -o target/main main.go
40+
- run: GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
4141
path: ./code
4242
# - 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)
4343
# - run: docker build xxx # System command to execute, similar to a hook

update.list

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
custom-container-function/fc-custom-container-http-springboot
1+
event-function/fc-event-golang1.x
2+
http-function/fc-http-golang1.x

0 commit comments

Comments
 (0)