Giter Club home page Giter Club logo

Comments (4)

emersion avatar emersion commented on May 14, 2024 1

Why can't I do something like git clone hydroxide ./somewhere; cd ./somewhere; go build;?

This is how you do it with Go 1.11. It should work if you clone outside GOPATH (which is always the case for PKGBUILD), try it.

from hydroxide.

emersion avatar emersion commented on May 14, 2024 1

This behaviour is only the case when GOPATH and GOROOT both are unset. If they are set, it behaves differently.

Hmm, I have GOPATH and GOROOT set and go build ./cmd/hydroxide works. Only works if I cloned outside GOPATH though.

Anyway, nice you've figured it out!

from hydroxide.

cookiengineer avatar cookiengineer commented on May 14, 2024

This is what I tried at first, but then it couldn't find the module that provides hydroxide itself.

Error was/is then:

can't load package: package github.com/emersion/hydroxide: unknown import path "github.com/emersion/hydroxide": cannot find module providing package github.com/emersion/hydroxide

... and I was trying to execute go build inside the repo's root folder (same folder wherein the go.mod file is located).

If I use go build, do I need to set some environment variables or special flags, so that go finds the go.mod file and knows that the repo I'm building is also known as the alias in the source code?

I also tried using the GO111MODULE=on flag, but that has no influence over this behaviour (somewhere somebody said it's only necessary outside GOPATH).

from hydroxide.

cookiengineer avatar cookiengineer commented on May 14, 2024

Okay, for future references (in case somebody has the same problem):

  • go build will only check the local go.mod file if a build target is given, which means cd ./hydroxide; go build ./cmd/hydroxide is necessary. Paths to .go files won't work, and a build target is required. Otherwise the above message is displayed.
  • This behaviour is only the case when GOPATH and GOROOT both are unset. If they are set, it behaves differently.

So all in all, the new PKGBUILD file for hydroxide-git looks super simple, like this (go version 1.11 and later):

pkgname=hydroxide-git
pkgver=r1.05d0806
pkgrel=1
pkgdesc="A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge"
arch=('x86_64')
makedepends=('git' 'go')
url="https://github.com/emersion/hydroxide"
license=('MIT')
source=('git+https://github.com/emersion/hydroxide')
md5sums=('SKIP')

pkgver() {
	cd "$srcdir/hydroxide"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$srcdir/hydroxide";
	go build "./cmd/hydroxide";
}

package() {
	mkdir -p "$pkgdir/usr/bin"
	install -p -m755 "$srcdir/hydroxide/hydroxide" "$pkgdir/usr/bin"
	install -Dm644 "$srcdir/hydroxide/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

@emersion Sorry for the trouble, thanks for the help! Your comment led me on the right path.

from hydroxide.

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.