Skip to content

Commit f9857f2

Browse files
committed
chore: allow to generate "hello world" app on Golang
Part of #9
1 parent ffacf9c commit f9857f2

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

examples/go/app.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
fmt.Println("Listen on 3000")
7+
}

examples/go/endpoints.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../js/endpoints.yaml

src/cli.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ if (!fs.existsSync(destDir)) {
135135
fs.mkdirSync(destDir, {recursive: true});
136136
}
137137

138+
createApp(destDir, argv.lang, config);
138139
if (argv.lang === 'js') {
139-
createApp(destDir, argv.lang, config);
140140
createEndpoints(destDir, routesFile, config);
141141
createPackageJson(destDir, 'package.json');
142142
}
@@ -148,5 +148,12 @@ if (argv.lang === 'js') {
148148
to install its dependencies and
149149
export DB_NAME=db DB_USER=user DB_PASSWORD=secret
150150
npm start
151-
afteward to run it`);
151+
afteward to run`);
152+
} else if (argv.lang === 'go') {
153+
console.info(`Use
154+
go run app.go
155+
or
156+
go build -o app
157+
./app
158+
to build and run it`)
152159
}

src/templates/app.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
fmt.Println("Listen on 3000")
7+
}

0 commit comments

Comments
 (0)