Giter Site home page Giter Site logo

go.mod not found about xgo HOT 7 CLOSED

crazy-max avatar crazy-max commented on May 17, 2024 1
go.mod not found

from xgo.

Comments (7)

bonifaido avatar bonifaido commented on May 17, 2024

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.

shrimalmadhur avatar shrimalmadhur commented on May 17, 2024

@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.

bonifaido avatar bonifaido commented on May 17, 2024

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.

shrimalmadhur avatar shrimalmadhur commented on May 17, 2024

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.

bonifaido avatar bonifaido commented on May 17, 2024

This worked in karalabe/xgo.

from xgo.

shrimalmadhur avatar shrimalmadhur commented on May 17, 2024

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.

sungwoncho avatar sungwoncho commented on May 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.