Files
zzyxyz_go_api/magefile.go
zzy 6e513dbeb8 fix(bookmark): 更新书签模型字段为指针类型以支持可选字段
将 Bookmark 模型中的 Link、Detail 和 Description 字段修改为指针类型,
使其在数据库中可以为 NULL,并更新了对应的请求和响应处理逻辑。
同时修复根目录 ParentPathID 的初始化值为 -1。
此外,测试用例中暂时注释掉时间更新的断言并添加 FIXME 注释。
主程序监听地址从 127.0.0.1 改为 localhost。
2025-09-21 20:59:51 +08:00

83 lines
1.8 KiB
Go

//go:build mage
// +build mage
package main
import (
"fmt"
"os"
"os/exec"
"github.com/magefile/mage/mg" // mg contains helpful utility functions, like Deps
)
// Default target to run when none is specified
// If not set, running mage will list available targets
// var Default = Build
// A build step that requires additional params, or platform specific steps for example
// Build builds the application for multiple platforms.
func Build() error {
mg.Deps(InstallDeps)
// Define target platforms
platforms := []struct {
OS string
Arch string
}{
{"linux", "amd64"},
{"linux", "arm64"},
{"darwin", "amd64"},
{"darwin", "arm64"},
{"windows", "amd64"},
}
for _, p := range platforms {
fmt.Printf("Building for %s/%s...\n", p.OS, p.Arch)
// Set environment variables for cross-compilation
env := append(os.Environ(),
fmt.Sprintf("GOOS=%s", p.OS),
fmt.Sprintf("GOARCH=%s", p.Arch))
// Determine output name
outputName := fmt.Sprintf("./bin/zzyxyz_go_api-%s-%s", p.OS, p.Arch)
if p.OS == "windows" {
outputName += ".exe"
}
// Run build command
cmd := exec.Command("go", "build", "-o", outputName, ".")
cmd.Env = env
if err := cmd.Run(); err != nil {
return err
}
}
return nil
}
// A custom install step if you need your bin someplace other than go/bin
func Install() error {
mg.Deps(Build)
// fmt.Println("Installing...")
// return os.Rename("./MyApp", "/usr/bin/MyApp")
return nil
}
// Manage your deps, or running package managers.
func InstallDeps() error {
fmt.Println("Installing Deps...")
// TODO downloads swagger-ui-5.29.0 /dist/*
// cmd := exec.Command("go", "get", "github.com/stretchr/piglatin")
// return cmd.Run()
return nil
}
// Clean up after yourself
func Clean() {
fmt.Println("Cleaning...")
// os.RemoveAll("MyApp")
}