From 001122b0f03925335b2bac722d1c2c91be5f00c0 Mon Sep 17 00:00:00 2001 From: Karagulamos Date: Thu, 2 Jun 2022 19:15:37 +0100 Subject: [PATCH] chore: remove Go scheduled function template (#4660) --- .../.netlify-function-template.js | 5 --- .../go/scheduled-function/go.mod | 5 --- .../go/scheduled-function/go.sum | 21 ----------- .../go/scheduled-function/netlify.toml | 11 ------ .../src/hourly-schedule/main.go | 36 ------------------- 5 files changed, 78 deletions(-) delete mode 100644 src/functions-templates/go/scheduled-function/.netlify-function-template.js delete mode 100644 src/functions-templates/go/scheduled-function/go.mod delete mode 100644 src/functions-templates/go/scheduled-function/go.sum delete mode 100644 src/functions-templates/go/scheduled-function/netlify.toml delete mode 100644 src/functions-templates/go/scheduled-function/src/hourly-schedule/main.go diff --git a/src/functions-templates/go/scheduled-function/.netlify-function-template.js b/src/functions-templates/go/scheduled-function/.netlify-function-template.js deleted file mode 100644 index 9e35ebdd05d..00000000000 --- a/src/functions-templates/go/scheduled-function/.netlify-function-template.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - name: 'scheduled-function', - priority: 1, - description: 'Basic implementation of a scheduled function in Go.', -} diff --git a/src/functions-templates/go/scheduled-function/go.mod b/src/functions-templates/go/scheduled-function/go.mod deleted file mode 100644 index de608502e79..00000000000 --- a/src/functions-templates/go/scheduled-function/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/your-github-handle/{{name}} - -go 1.17 - -require github.com/aws/aws-lambda-go v1.31.1 diff --git a/src/functions-templates/go/scheduled-function/go.sum b/src/functions-templates/go/scheduled-function/go.sum deleted file mode 100644 index 4f6d65221e6..00000000000 --- a/src/functions-templates/go/scheduled-function/go.sum +++ /dev/null @@ -1,21 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/aws/aws-lambda-go v1.28.0 h1:fZiik1PZqW2IyAN4rj+Y0UBaO1IDFlsNo9Zz/XnArK4= -github.com/aws/aws-lambda-go v1.28.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/src/functions-templates/go/scheduled-function/netlify.toml b/src/functions-templates/go/scheduled-function/netlify.toml deleted file mode 100644 index 79d4132fcdb..00000000000 --- a/src/functions-templates/go/scheduled-function/netlify.toml +++ /dev/null @@ -1,11 +0,0 @@ -[build] -functions = "functions" - -[build.environment] -GO_VERSION = "1.17" - -[functions] -directory = "src/" - -[functions.hourly-schedule] -schedule = "@hourly" diff --git a/src/functions-templates/go/scheduled-function/src/hourly-schedule/main.go b/src/functions-templates/go/scheduled-function/src/hourly-schedule/main.go deleted file mode 100644 index 996930651b3..00000000000 --- a/src/functions-templates/go/scheduled-function/src/hourly-schedule/main.go +++ /dev/null @@ -1,36 +0,0 @@ -package main - -import ( - "context" - "encoding/json" - "log" - "net/http" - "time" - - "github.com/aws/aws-lambda-go/events" - "github.com/aws/aws-lambda-go/lambda" -) - -type requestBody struct { - NextRun time.Time `json:"next_run"` -} - -// The schedule for this function is defined inside the netlify.toml file. To learn about scheduled functions -// and supported cron extensions, visit https://ntl.fyi/sched-func. -func handler(ctx context.Context, request events.APIGatewayProxyRequest) (*events.APIGatewayProxyResponse, error) { - requestBody := requestBody{} - - if err := json.Unmarshal([]byte(request.Body), &requestBody); err != nil { - log.Fatalf("cannot parse request body: %s", err.Error()) - } - - log.Printf("Next run at %s\n", requestBody.NextRun.Local()) - - return &events.APIGatewayProxyResponse{ - StatusCode: http.StatusNoContent, - }, nil -} - -func main() { - lambda.Start(handler) -}