Comments (7)
I'm still having this issue, when using this in a local repostory, I'm not sure if this scenario is supported:
Example:
git clone [email protected]:banzaicloud/bank-vaults.git
cd bank-vaults
xgo --targets=darwin/arm64 ./cmd/bank-vaults
Output:
DBG: config: &{Repository:./cmd/bank-vaults Package: Prefix: Remote: Branch: Dependencies: Arguments: Targets:[darwin/arm64]}
DBG: flags: &{Verbose:false Steps:false Race:false Tags: LdFlags: Mode:default}
INFO: go.mod not found. Skipping go modules
INFO: Cross compiling github.com/banzaicloud/bank-vaults/cmd/bank-vaults package...
INFO: Docker run --rm -v /Users/bonifaido/Code/src/github.com/banzaicloud/bank-vaults:/build -v /var/folders/3q/l731kzc93bd307ftq5b4d18c0000gp/T/xgo-cache:/deps-cache:ro -e REPO_REMOTE= -e REPO_BRANCH= -e PACK= -e DEPS= -e ARGS= -e OUT= -e FLAG_V=false -e FLAG_X=false -e FLAG_RACE=false -e FLAG_TAGS= -e FLAG_LDFLAGS= -e FLAG_BUILDMODE=default -e TARGETS=darwin/arm64 -v /Users/bonifaido/Code/src:/ext-go/1/src:ro -e EXT_GOPATH=/ext-go/1 ghcr.io/crazy-max/xgo:latest github.com/banzaicloud/bank-vaults/cmd/bank-vaults
Building locally github.com/banzaicloud/bank-vaults/cmd/bank-vaults...
Compiling for darwin-10.12/arm64...
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
from xgo.
@bonifaido is it because you are providing ./cmd/bank-vaults
in there? You don't have go.mod
in that folder. You just need to do that in current dir by providing .
. That should work I guess.
from xgo.
There is a CLI built from this directory (it has a main() method) and I would like to build that, the root (.
) doesn't hold any compilable sources on that level. This is a common idiom in Go AFAIK to have the CLIs built from ./cmd/...
according to: https://github.com/golang-standards/project-layout
from xgo.
I see. but xgo expects a go.mod
from the directory where you are building. Not sure how to work around for your case.
from xgo.
This worked in karalabe/xgo
.
from xgo.
I see. in that case, I would defer this to the @crazy-max for this. I have not looked into the differences between these 2 repos. :)
from xgo.
@bonifaido using -pkg
might solve your problem. Here is how I am using it for a similar situation https://github.com/dnote/dnote/blob/master/scripts/cli/build.sh#L80-L89
from xgo.
Related Issues (20)
- CGO with bootstrap step
- Volume Mount Error When GOPATH Contains Multiple Values
- Darwin arm64 binary gets immediately killed
- garble with xgo gcc HOT 1
- Cross-compilation support for Android HOT 2
- Support for more architectures
- CVE's
- Add the possibility of using as a library
- Running xgo on Mac M3 cross compiling to Linux x86_64 has a link error
- fail to detect local docker image
- "fatal: not a git repository" with go 1.18.x HOT 1
- xgo Aliyun HOT 2
- It seems to increase the workload HOT 1
- Are windows arm64 builds supported? HOT 2
- Modules issue building locally vs from reference HOT 1
- Android and ios don't support it HOT 2
- Are you interested in creating a similar compiler for gcc HOT 1
- Release v0.24.0 missing linux_x86_64 download HOT 1
- 编译本地项目报错 HOT 1
- Parallelism
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xgo.