Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xxl6097/go-service-framework
基于Go语言的服务框架
https://github.com/xxl6097/go-service-framework
Last synced: about 1 month ago
JSON representation
基于Go语言的服务框架
- Host: GitHub
- URL: https://github.com/xxl6097/go-service-framework
- Owner: xxl6097
- Created: 2024-07-05T02:48:21.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-08-15T01:38:41.000Z (5 months ago)
- Last Synced: 2024-11-03T09:27:31.680Z (3 months ago)
- Language: Go
- Size: 646 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
go get github.com/kardianos/service
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build-trimpath -ldflags "-linkmode internal" -o AAServiceApp.exe main.go
go get -u github.com/xxl6097/[email protected]
go get -u github.com/xxl6097/[email protected]
go get -u github.com/xxl6097/[email protected]
go get -u github.com/xxl6097/[email protected]
goversioninfo -manifest versioninfo.json
http://uuxia.cn:8086/files/soft/json/appstore.json
```azure
package main
import (
"fmt"
"os"
)func main() {
os.Chdir("/Users/uuxia/Library/Caches/JetBrains/GoLand2024.1/tmp/GoLand/frpc/")
executable := "/Users/uuxia/Library/Caches/JetBrains/GoLand2024.1/tmp/GoLand/frpc/frpc" // 可执行文件的路径
args := []string{executable, "-c", "frpc.toml"} // 启动参数列表attr := &os.ProcAttr{
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
//Sys: &syscall.SysProcAttr{
// Chroot: "/Users/uuxia/Library/Caches/JetBrains/GoLand2024.1/tmp/GoLand/frpc/",
//},
}p, err := os.StartProcess(executable, args, attr)
if err != nil {
fmt.Printf("Error: %s", err.Error())
return
}
p.Wait()fmt.Println("Process started successfully.")
}```
## windows打包
1、 main.go 文件中添加标签,如下
```
//go:generate goversioninfo -icon=resource/icon.ico -manifest=resource/goversioninfo.exe.manifest
func main() {
}
```2、编译打包
```
go generate
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags "-linkmode internal $ldflags" -o ${appname}_${version}_windows_amd64.exe
```3、生成版本信息
resource文件夹