Giter VIP home page Giter VIP logo

Comments (7)

jmmv avatar jmmv commented on August 22, 2024

Aha, thanks for the details. Yes, I'll do this. I had no idea about what I was doing :-P

from sourcachefs.

jmmv avatar jmmv commented on August 22, 2024

OK, this may be a stupid question... but how do I build my own code from HEAD if I do this?

go build cmd/sourcachefs or similar all fail. Am I supposed to just check out my code into the GOPATH (by means of go get) and edit it from there? Yikes.

from sourcachefs.

stapelberg avatar stapelberg commented on August 22, 2024

go install github.com/jmmv/sourcachefs/cmd/sourcachefs is what I’d use. The binary will end up in $GOPATH/bin.

Alternatives:

(cd cmd/sourcachefs && go build)

go build ./cmd/sourcachefs (this will store the result in $PWD, which might not be what you want)

from sourcachefs.

jmmv avatar jmmv commented on August 22, 2024

I can see how "end users" will be able to just fetch the code and build/install it with go build and go install if I follow your proposal.

But that's not the problem I have. What I'm talking with "building from HEAD" is... I do:

  1. cd ~/os # Directory where I keep all my projects.
  2. git clone https://github.com/jmmv/sourcachefs
  3. cd sourcachefs
  4. go build ??? # What goes here?

If I try the go build ./cmd/sourcachefs that you mention, Go does indeed find the code... but then, it of course complains about all imports of the form github.com/jmmv/sourcachefs/... to be missing.

from sourcachefs.

stapelberg avatar stapelberg commented on August 22, 2024

Ah: you need to keep the project in your $GOPATH. You could use:

export GOPATH=~/os
cd ~/os
mkdir -p src/github.com/jmmv
cd src/github.com/jmmv
git clone [email protected]:jmmv/sourcachefs
# …

(Instead of manually creating the directory and cloning, you could also just use go get -u github.com/jmmv/sourcachefs, then change the git remote to authenticated in order to be able to push.)

from sourcachefs.

jmmv avatar jmmv commented on August 22, 2024

I think this is now resolved.

from sourcachefs.

stapelberg avatar stapelberg commented on August 22, 2024

Almost: you need a subdirectory within cmd/. Currently, your code is compiled into $GOPATH/bin/cmd. I think it should be cmd/sourcachefs/?

from sourcachefs.

Related Issues (1)

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.