goc icon indicating copy to clipboard operation
goc copied to clipboard

Why validatePackageForBuild only allow . as package name?

Open ankitjain1510 opened this issue 2 years ago • 3 comments

For my project, main.go file is inside different directory whereas go.mod file is in different folder. When I am doing the goc build and passing the package path as ./cmd/server, it returns error as below:

time="2022-05-26T11:38:46Z" level=error msg="packages only support \".\"" file="[build/build.go:74]" time="2022-05-26T11:38:46Z" level=fatal msg="Fail to build: packages only support \".\"" file="[cmd/build.go:68]" The command '/bin/sh -c goc build --center=http://127.0.0.1:7777 --agentport=:8500 --output=bin/server ./cmd/server --debug' returned a non-zero code: 1

How to resolve it?

ankitjain1510 avatar May 26 '22 12:05 ankitjain1510

see: #152

Actually, it's a trade-off to support compiling single service only under main package. we originally think that user may choose goc install ./... to compile multi services if they want.

There are some works to let goc to align with go build [packges]. And of course, we appreciate very much if you wish to contribute. @ankitjain1510

CarlJi avatar Jun 10 '22 02:06 CarlJi

七牛的兄弟们, 什么时候支持一下这个问题啊

miaoxiaoy avatar Mar 01 '23 08:03 miaoxiaoy

@CarlJi Do you have a plan to support this enhancement? Most of our builds are done using command go build -mod=vendor -o bin/Core ./cmd/server.

If not, can you suggest any workaround regarding how to use goc build command to generate the instrumented binary?

ankitjain1510 avatar May 16 '23 05:05 ankitjain1510