Merge pull request #69 from syumai/use-gonew

use gonew command to initialize project
This commit is contained in:
syumai 2023-09-09 22:19:46 +09:00 committed by GitHub
commit 7689cff40e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 7 deletions

View File

@ -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!"

View File

@ -1,4 +1,4 @@
module github.com/syumai/workers/_examples/pages-functions
module github.com/syumai/workers/_examples/pages-tinygo
go 1.18

View File

@ -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!"

View File

@ -0,0 +1,3 @@
module github.com/syumai/workers/_templates/cloudflare/worker-go
go 1.21.1

View File

@ -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!"

View File

@ -0,0 +1,3 @@
module github.com/syumai/workers/_templates/cloudflare/worker-tinygo
go 1.21.1