From 39a3a322dd2cb8856eb8de90872a9e48507cfefc Mon Sep 17 00:00:00 2001 From: Gordon Byers Date: Tue, 25 Feb 2020 12:17:08 -0800 Subject: [PATCH] App name change toenable vscode compile and debug Cloning the app fromthe repo did not result in a successful compilation. This is likely because no one is currently taking this code, instead they're targeting the image binaries themselves. --- .gitignore | 8 ++++++- .vscode/launch.json | 14 ++++++++++++ Dockerfile | 8 +++---- conf/app.conf | 2 +- controllers/order.go | 2 +- main.go | 2 +- routers/commentsRouter_controllers.go | 31 +++++++++++++++------------ routers/router.go | 2 +- 8 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index d5f58816..b6192749 100644 --- a/.gitignore +++ b/.gitignore @@ -78,4 +78,10 @@ typings/ .fusebox/ # DynamoDB Local files -.dynamodb/ \ No newline at end of file +.dynamodb/ + +# Temp files +*.tmp + +# Debug binary +__debug_bin diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..cbd6ede4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}", + "env": {}, + "args": [] + } + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 733002f4..745dc4c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.9.4 as builder # Set the working directory to the app directory -WORKDIR /go/src/captureorderfd +WORKDIR /go/src/azch-captureorder # Install godeps RUN go get -u -v github.com/astaxie/beego @@ -17,13 +17,13 @@ RUN go get gopkg.in/matryer/try.v1 COPY . . # Build stage -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o captureorderfd . +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o azch-captureorder . ## App stage FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ -COPY --from=builder /go/src/captureorderfd . +COPY --from=builder /go/src/azch-captureorder . # Define environment variables @@ -40,4 +40,4 @@ EXPOSE 8080 # Set the entry point of the container to the bee command that runs the # application and watches for changes -CMD ["./captureorderfd", "run"] +CMD ["./azch-captureorder", "run"] diff --git a/conf/app.conf b/conf/app.conf index 80718a1e..a78c6470 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -1,4 +1,4 @@ -appname = captureorderfd +appname = azch-captureorder httpport = 8080 runmode = dev autorender = false diff --git a/controllers/order.go b/controllers/order.go index eb8be54c..387180dd 100644 --- a/controllers/order.go +++ b/controllers/order.go @@ -1,7 +1,7 @@ package controllers import ( - "captureorderfd/models" + "azch-captureorder/models" "encoding/json" "os" "time" diff --git a/main.go b/main.go index f2391003..b18e2e76 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - _ "captureorderfd/routers" + _ "azch-captureorder/routers" "github.com/astaxie/beego" ) diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index ef95b3f7..051d0709 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -7,19 +7,22 @@ import ( func init() { - beego.GlobalControllerRouter["captureorderfd/controllers:OrderController"] = append(beego.GlobalControllerRouter["captureorderfd/controllers:OrderController"], - beego.ControllerComments{ - Method: "Post", - Router: `/`, - AllowHTTPMethods: []string{"post"}, - MethodParams: param.Make(), - Params: nil}) + beego.GlobalControllerRouter["azch-captureorder/controllers:OrderController"] = append(beego.GlobalControllerRouter["azch-captureorder/controllers:OrderController"], + beego.ControllerComments{ + Method: "Post", + Router: `/`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) + + beego.GlobalControllerRouter["azch-captureorder/controllers:OrderController"] = append(beego.GlobalControllerRouter["azch-captureorder/controllers:OrderController"], + beego.ControllerComments{ + Method: "Get", + Router: `/`, + AllowHTTPMethods: []string{"post"}, + MethodParams: param.Make(), + Filters: nil, + Params: nil}) - beego.GlobalControllerRouter["captureorderfd/controllers:OrderController"] = append(beego.GlobalControllerRouter["captureorderfd/controllers:OrderController"], - beego.ControllerComments{ - Method: "Get", - Router: `/`, - AllowHTTPMethods: []string{"get"}, - MethodParams: param.Make(), - Params: nil}) } diff --git a/routers/router.go b/routers/router.go index 036a163a..ec2b80b5 100644 --- a/routers/router.go +++ b/routers/router.go @@ -8,7 +8,7 @@ package routers import ( - "captureorderfd/controllers" + "azch-captureorder/controllers" "github.com/astaxie/beego" "github.com/astaxie/beego/context"