chore: update cmd entry folder

This commit is contained in:
Steven 2023-06-20 15:55:42 +08:00
parent 805ab9996e
commit 8ce1d21c2a
5 changed files with 12 additions and 18 deletions

View File

@ -17,7 +17,7 @@ WORKDIR /backend-build
COPY . .
COPY --from=frontend /frontend-build/dist ./server/dist
RUN CGO_ENABLED=0 go build -o shortify ./main.go
RUN go build -o shortify ./cmd/shortify/main.go
# Make workspace with above generated files.
FROM alpine:3.16 AS monolithic

View File

@ -1,4 +1,4 @@
package cmd
package main
import (
"context"
@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
_ "modernc.org/sqlite"
"github.com/boojack/shortify/server"
_profile "github.com/boojack/shortify/server/profile"
@ -127,3 +128,10 @@ func initConfig() {
println("version:", profile.Version)
println("---")
}
func main() {
err := Execute()
if err != nil {
panic(err)
}
}

14
main.go
View File

@ -1,14 +0,0 @@
package main
import (
_ "modernc.org/sqlite"
"github.com/boojack/shortify/cmd"
)
func main() {
err := cmd.Execute()
if err != nil {
panic(err)
}
}

View File

@ -3,7 +3,7 @@ tmp_dir = ".air"
[build]
bin = "./.air/shortify"
cmd = "go build -o ./.air/shortify ./main.go"
cmd = "go build -o ./.air/shortify ./cmd/shortify/main.go"
delay = 1000
exclude_dir = [".air", "web", "build"]
exclude_file = []

View File

@ -8,6 +8,6 @@ cd "$(dirname "$0")/../"
echo "Start building backend..."
go build -o ./build/shortify ./main.go
go build -o ./build/shortify ./cmd/shortify/main.go
echo "Backend built!"