Skip to content

Commit 4079993

Browse files
lwlee2608wing328
authored andcommitted
add go.mod as supporting files to go-server (#4592)
1 parent eff94da commit 4079993

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoServerCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public void processOpts() {
165165
supportingFiles.add(new SupportingFile("openapi.mustache", "api", "openapi.yaml"));
166166
supportingFiles.add(new SupportingFile("main.mustache", "", "main.go"));
167167
supportingFiles.add(new SupportingFile("Dockerfile.mustache", "", "Dockerfile"));
168+
supportingFiles.add(new SupportingFile("go.mod.mustache", "", "go.mod"));
168169
supportingFiles.add(new SupportingFile("routers.mustache", sourceFolder, "routers.go"));
169170
supportingFiles.add(new SupportingFile("logger.mustache", sourceFolder, "logger.go"));
170171
supportingFiles.add(new SupportingFile("api.mustache", sourceFolder, "api.go"));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}
2+
3+
go 1.13
4+
5+
require github.com/gorilla/mux v1.7.3

modules/openapi-generator/src/main/resources/go-server/main.mustache

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ import (
55
"log"
66
"net/http"
77

8-
// WARNING!
9-
// Change this to a fully-qualified import path
10-
// once you place this file into your project.
11-
// For example,
12-
//
13-
// sw "github.com/myname/myrepo/{{sourceFolder}}"
14-
//
15-
{{packageName}} "./{{sourceFolder}}"
8+
{{packageName}} "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/{{sourceFolder}}"
169
)
1710

1811
func main() {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/GIT_USER_ID/GIT_REPO_ID
2+
3+
go 1.13
4+
5+
require github.com/gorilla/mux v1.7.3

samples/server/petstore/go-api-server/main.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ import (
1313
"log"
1414
"net/http"
1515

16-
// WARNING!
17-
// Change this to a fully-qualified import path
18-
// once you place this file into your project.
19-
// For example,
20-
//
21-
// sw "github.com/myname/myrepo/go"
22-
//
23-
petstoreserver "./go"
16+
petstoreserver "github.com/GIT_USER_ID/GIT_REPO_ID/go"
2417
)
2518

2619
func main() {

0 commit comments

Comments
 (0)