Skip to content

go build 的二进制包无法脱离项目的目录运行 #96

@alexg9781

Description

@alexg9781

使用master分支代码,win10上运行该项目后,打出的包无法脱离该项目正常运行,提示错误码:10101

操作方法

  1. git clone https://github.com/xinliangnote/go-gin-api.git && cd go-gin-api
  2. go run .
  3. 访问 127.0.01/install 初始化项目(重启后可正常运行)
  4. go build . (在项目中生成的包可正常运行)
  5. 移动打出的包 main.exe 到其他目录并启动,启动登录提示 错误码:10101
  6. CentOS Linux release 7.8.2003 也有相同问题

日志
{"level":"error","time":"2023-03-22 16:01:19","caller":"alert/alert.go:21","msg":"Mail config error","domain":"go-gin-api[fat]"}
{"level":"error","time":"2023-03-22 16:01:19","caller":"alert/alert.go:21","msg":"Mail config error","domain":"go-gin-api[fat]"}
{"level":"info","time":"2023-03-22 16:01:19","caller":"core/core.go:509","msg":"trace-log","domain":"go-gin-api[fat]","method":"GET","path":"/api/admin/info","http_code":500,"business_code":10101,"success":false,"cost_seconds":0.0010475,"trace_id":"dc2a499799fae915a7fe","trace_info":{"trace_id":"dc2a499799fae915a7fe","request":{"ttl":"un-limit","method":"GET","decoded_url":"/api/admin/info","header":{"Authorization":"admin 6be1LaemNpHWS8FsAaKX0AwQj5K9k06iDxr+eRsGmhU=","Authorization-Date":"2023-03-22 16:01:19","Content-Type":"application/x-www-form-urlencoded; charset=utf-8","Token":"1ba4686338ee7354395ad13f7d3466c1"},"body":""},"response":{"header":{"Content-Type":["application/json; charset=utf-8"],"Trace-Id":["dc2a499799fae915a7fe"],"Vary":["Origin"]},"body":null,"business_code":10101,"business_code_msg":"内部服务器错误","http_code":500,"http_code_msg":"Internal Server Error","cost_seconds":0.0010475},"third_party_requests":null,"debugs":null,"sqls":null,"redis":null,"success":false,"cost_seconds":0.0010475}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions