diff --git a/_templates/cloudflare/pages-tinygo/README.md b/_templates/cloudflare/pages-tinygo/README.md index 73de321..90d9b15 100644 --- a/_templates/cloudflare/pages-tinygo/README.md +++ b/_templates/cloudflare/pages-tinygo/README.md @@ -16,10 +16,18 @@ ## Getting Started +* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command. + ```console -wrangler generate my-app syumai/workers/_templates/cloudflare/pages-tinygo +go install golang.org/x/tools/cmd/gonew@latest +``` + +* Create a new project using this template. + - Second argument passed to `gonew` is a module path of your new app. + +```console +gonew github.com/syumai/workers/_templates/cloudflare/pages-tinygo your.module/my-app # e.g. github.com/syumai/my-app cd my-app -go mod init go mod tidy make dev # start running dev server curl http://localhost:8787/api/hello # outputs "Hello, Pages Functions!" diff --git a/_templates/cloudflare/pages-tinygo/go.mod b/_templates/cloudflare/pages-tinygo/go.mod index 35458cc..f6d3c4f 100644 --- a/_templates/cloudflare/pages-tinygo/go.mod +++ b/_templates/cloudflare/pages-tinygo/go.mod @@ -1,4 +1,4 @@ -module github.com/syumai/workers/_examples/pages-functions +module github.com/syumai/workers/_examples/pages-tinygo go 1.18 diff --git a/_templates/cloudflare/worker-go/README.md b/_templates/cloudflare/worker-go/README.md index bb95224..c19357a 100644 --- a/_templates/cloudflare/worker-go/README.md +++ b/_templates/cloudflare/worker-go/README.md @@ -21,10 +21,20 @@ ## Getting Started +## Getting Started + +* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command. + ```console -wrangler generate my-app syumai/workers/_templates/cloudflare/worker-go +go install golang.org/x/tools/cmd/gonew@latest +``` + +* Create a new project using this template. + - Second argument passed to `gonew` is a module path of your new app. + +```console +gonew github.com/syumai/workers/_templates/cloudflare/worker-go your.module/my-app # e.g. github.com/syumai/my-app cd my-app -go mod init go mod tidy make dev # start running dev server curl http://localhost:8787/hello # outputs "Hello!" diff --git a/_templates/cloudflare/worker-go/go.mod b/_templates/cloudflare/worker-go/go.mod new file mode 100644 index 0000000..762980b --- /dev/null +++ b/_templates/cloudflare/worker-go/go.mod @@ -0,0 +1,3 @@ +module github.com/syumai/workers/_templates/cloudflare/worker-go + +go 1.21.1 diff --git a/_templates/cloudflare/worker-tinygo/README.md b/_templates/cloudflare/worker-tinygo/README.md index 0333a2b..f7ca25d 100644 --- a/_templates/cloudflare/worker-tinygo/README.md +++ b/_templates/cloudflare/worker-tinygo/README.md @@ -16,10 +16,18 @@ ## Getting Started +* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command. + ```console -wrangler generate my-app syumai/workers/_templates/cloudflare/worker-tinygo +go install golang.org/x/tools/cmd/gonew@latest +``` + +* Create a new project using this template. + - Second argument passed to `gonew` is a module path of your new app. + +```console +gonew github.com/syumai/workers/_templates/cloudflare/worker-tinygo your.module/my-app # e.g. github.com/syumai/my-app cd my-app -go mod init go mod tidy make dev # start running dev server curl http://localhost:8787/hello # outputs "Hello!" diff --git a/_templates/cloudflare/worker-tinygo/go.mod b/_templates/cloudflare/worker-tinygo/go.mod new file mode 100644 index 0000000..d8848fb --- /dev/null +++ b/_templates/cloudflare/worker-tinygo/go.mod @@ -0,0 +1,3 @@ +module github.com/syumai/workers/_templates/cloudflare/worker-tinygo + +go 1.21.1