[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: packaging a golang package

From: Timmy Douglas
Subject: Re: packaging a golang package
Date: Sun, 24 Jan 2021 23:18:02 -0800

Helio Machado <> writes:

> So it seems. I'll debug it as soon as I can; the import process is
> unbearably long.

let me know what you find out--i can give it another try when you're

>> I sort of wonder if the `git-fetch` portion of go packages should be
>> something like `git-fetch-and-restore-go-modules` Maybe something like
>> `go mod vendor` could be used an the hash would be calculated on that?
>> I'm not familiar enough with the internals of go modules, but I'm not
>> really seeing the value in generating a bunch of package metadata on all
>> the module dependencies.
> Guix seems to have a strong opinion about dependency vendoring, but it's
> technically viable as long as you don't produce architecture-specific
> artifacts when packaging. See for more
> information about the pitfalls I encountered while packaging go-ethereum
> the fast way.

I tried the go mod vendor approach on a fork I made and it was fairly

1. Update module name in go.mod

2. Run `go mod vendor`

3. Fix .gitignore to make git adding vendor/ easier

the downside is that the package is tied to my personal git. I think
merging updates wouldn't be too hard and I like how it doesn't pollute
the package repo with a bunch of dependencies (cat vendor/modules.txt|wc -l
--> 697), but I'm not sure it'd pass the bar to be accepted into
guix. But it's probably good enough for me to use personally.

$ cat ~/.config/guix-packages/coredns.scm

(define-module (coredns)
               #:use-module (guix packages)
               #:use-module (guix git-download)
               #:use-module (guix build-system go)
               #:use-module ((guix licenses) #:prefix license:))

(define-public coredns
  (let ((commit "78de01a9cddf140c04ec3c4095195177d21cacff")
        (revision "0"))
      (name "coredns")
      (version (git-version "1.8.1" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "";)
                      (commit commit)))
                (file-name (git-file-name name version))
      (build-system go-build-system)
       '(#:import-path ""))
      (synopsis "DNS server/forwarder, written in Go, that chains plugins")
      (description "CoreDNS is a fast and flexible DNS server.
  The key word here is flexible: with CoreDNS you are able to do
what you want with your DNS data by utilizing plugins.  If some
functionality is not provided out of the box you can add it by
writing a plugin.")
      (home-page "";)
      (license license:asl2.0))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]